46 lines
1.5 KiB
JavaScript
46 lines
1.5 KiB
JavaScript
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.Menu = void 0;
|
|
var Menu = /** @class */ (function () {
|
|
function Menu() {
|
|
this.menuContainer = document.querySelector('.ntsh_menubar');
|
|
this.tabContainer = document.querySelector('.ntsh_tabs');
|
|
this.registerListeners();
|
|
if (window.location.search.includes('advanced'))
|
|
this.selectTab('advanced');
|
|
}
|
|
Menu.prototype.selectTab = function (tabId) {
|
|
this.menuContainer
|
|
.querySelectorAll('.ntsh_menubar-item')
|
|
.forEach(function (item) {
|
|
if (item.getAttribute('tabid') === tabId) {
|
|
item.classList.add('selected');
|
|
}
|
|
else {
|
|
item.classList.remove('selected');
|
|
}
|
|
});
|
|
this.tabContainer.querySelectorAll('.ntsh_tab').forEach(function (tab) {
|
|
if (tab.getAttribute('tabid') === tabId) {
|
|
tab.classList.add('visible');
|
|
}
|
|
else {
|
|
tab.classList.remove('visible');
|
|
}
|
|
});
|
|
};
|
|
Menu.prototype.registerListeners = function () {
|
|
var _this = this;
|
|
this.menuContainer
|
|
.querySelectorAll('.ntsh_menubar-item')
|
|
.forEach(function (item) {
|
|
item.addEventListener('click', function () {
|
|
var itemId = item.getAttribute('tabid');
|
|
_this.selectTab(itemId);
|
|
});
|
|
});
|
|
};
|
|
return Menu;
|
|
}());
|
|
exports.Menu = Menu;
|
|
//# sourceMappingURL=menu.js.map
|