reworked showing of tabs
For easier mainainance and for future developments configuration is modified Please take a look at config.js
This commit is contained in:
parent
414778e81c
commit
dacf004b36
3 changed files with 39 additions and 91 deletions
|
@ -37,25 +37,25 @@
|
|||
</nav>
|
||||
|
||||
<ul class="nav nav-tabs" id="myTab" role="tablist">
|
||||
<li class="nav-item">
|
||||
<li class="nav-item" name="currtx">
|
||||
<a class="nav-link" id="currtx-tab" data-toggle="tab" href="#currtx" role="tab" aria-controls="currtx" aria-selected="true">Currently TXing</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<li class="nav-item" name="lastheard">
|
||||
<a class="nav-link" id="lastheard-tab" data-toggle="tab" href="#lastheard" role="tab" aria-controls="lastheard" aria-selected="false">Last Heard</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<li class="nav-item" name="localheard">
|
||||
<a class="nav-link" id="localheard-tab" data-toggle="tab" href="#localheard" role="tab" aria-controls="localheard" aria-selected="false">Local Heard</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<li class="nav-item" name="qso">
|
||||
<a class="nav-link" id="qso-tab" data-toggle="tab" href="#qso" role="tab" aria-controls="qso" aria-selected="false">In QSO</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<li class="nav-item" name="dapnet">
|
||||
<a class="nav-link" id="dapnet-tab" data-toggle="tab" href="#dapnet" role="tab" aria-controls="dapnet" aria-selected="false">DAPNET Messages</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<li class="nav-item" name="sysinfo">
|
||||
<a class="nav-link" id="sysinfo-tab" data-toggle="tab" href="#sysinfo" role="tab" aria-controls="sysinfo" aria-selected="false">System Info</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<li class="nav-item" name="about">
|
||||
<a class="nav-link" id="about-tab" data-toggle="tab" href="#about" role="tab" aria-controls="about" aria-selected="false">About</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
@ -293,7 +293,7 @@
|
|||
"order": [[ 0, "desc" ]]
|
||||
} );
|
||||
|
||||
if (showSysInfoTab) {
|
||||
if (sysinfo > 0) {
|
||||
var ws3 = new WebSocket("ws://" + window.location.hostname + ":5678/SYSINFO");
|
||||
ws3.onmessage = function (event) {
|
||||
getSysInfo(document, event);
|
||||
|
@ -327,7 +327,7 @@
|
|||
t_qso.row('.selected').remove().draw( false );
|
||||
} );
|
||||
|
||||
if (showDAPNETMessagesTab) {
|
||||
if (dapnet > 0) {
|
||||
var ws2 = new WebSocket("ws://" + window.location.hostname + ":5678/DAPNET");
|
||||
ws2.onmessage = function (event) {
|
||||
getDapnetMessages(document, event);
|
||||
|
|
|
@ -10,13 +10,13 @@ var emergencylevel = 500;
|
|||
|
||||
|
||||
// 1 = show tab, 0 = suppress it
|
||||
var showCurrTXTab = 1;
|
||||
var showLastHeardTab = 1;
|
||||
var showLocalHeadTab = 1;
|
||||
var showInQSOTab = 1;
|
||||
var showDAPNETMessagesTab = 1;
|
||||
var showSysInfoTab = 1;
|
||||
var showAboutTab = 1;
|
||||
var currtx = 1;
|
||||
var lastheard = 1;
|
||||
var localheard = 1;
|
||||
var qso = 1;
|
||||
var dapnet = 1;
|
||||
var sysinfo = 1;
|
||||
var about = 1;
|
||||
|
||||
// default-tab to show
|
||||
// chose from following list: CurrTXTab, LastHeardTab, LocalHeadTab, InQSOTab, DAPNETMessagesTab, SysInfoTab, AboutTab
|
||||
|
|
|
@ -602,100 +602,48 @@ function getSysInfo(document, event) {
|
|||
});
|
||||
}
|
||||
|
||||
function activateDefaultTab(name) {
|
||||
var element = document.getElementById(name + "-tab");
|
||||
element.classList.add("active");
|
||||
|
||||
var element = document.getElementById(name);
|
||||
element.classList.add("show");
|
||||
element.classList.add("active");
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
if(showCurrTXTab == 0){
|
||||
document.getElementById("myTab").children[0].style.display="none";
|
||||
document.getElementById("currtx").style.display="none";
|
||||
}
|
||||
if(showLastHeardTab == 0){
|
||||
document.getElementById("myTab").children[1].style.display="none";
|
||||
document.getElementById("lastheard").style.display="none";
|
||||
}
|
||||
if(showLocalHeadTab == 0){
|
||||
document.getElementById("myTab").children[2].style.display="none";
|
||||
document.getElementById("localheard").style.display="none";
|
||||
}
|
||||
if(showInQSOTab == 0){
|
||||
document.getElementById("myTab").children[3].style.display="none";
|
||||
document.getElementById("qso").style.display="none";
|
||||
}
|
||||
if(showDAPNETMessagesTab == 0){
|
||||
document.getElementById("myTab").children[4].style.display="none";
|
||||
document.getElementById("dapnet").style.display="none";
|
||||
}
|
||||
if(showSysInfoTab == 0){
|
||||
document.getElementById("myTab").children[5].style.display="none";
|
||||
document.getElementById("sysinfo").style.display="none";
|
||||
}
|
||||
if(showAboutTab == 0){
|
||||
document.getElementById("myTab").children[6].style.display="none";
|
||||
document.getElementById("about").style.display="none";
|
||||
for (i = 0; i < document.getElementById("myTab").children.length; ++i) {
|
||||
tabname = document.getElementById("myTab").children[i].getAttribute("name");
|
||||
if (eval(tabname) == 0) {
|
||||
document.getElementById("myTab").children[i].style.display="none";
|
||||
document.getElementById(tabname).style.display="none";
|
||||
}
|
||||
}
|
||||
|
||||
switch (defaultTab) {
|
||||
case "CurrTXTab":
|
||||
var element = document.getElementById("currtx-tab");
|
||||
element.classList.add("active");
|
||||
|
||||
var element = document.getElementById("currtx");
|
||||
element.classList.add("show");
|
||||
element.classList.add("active");
|
||||
activateDefaultTab("currtx");
|
||||
break;
|
||||
case "LastHeardTab":
|
||||
var element = document.getElementById("lastheard-tab");
|
||||
element.classList.add("active");
|
||||
|
||||
var element = document.getElementById("lastheard");
|
||||
element.classList.add("show");
|
||||
element.classList.add("active");
|
||||
activateDefaultTab("lastheard");
|
||||
break;
|
||||
case "LocalHeadTab":
|
||||
var element = document.getElementById("localheard-tab");
|
||||
element.classList.add("active");
|
||||
|
||||
var element = document.getElementById("localheard");
|
||||
element.classList.add("show");
|
||||
element.classList.add("active");
|
||||
activateDefaultTab("localheard");
|
||||
break;
|
||||
case "InQSOTab":
|
||||
var element = document.getElementById("qso-tab");
|
||||
element.classList.add("active");
|
||||
|
||||
var element = document.getElementById("qso");
|
||||
element.classList.add("show");
|
||||
element.classList.add("active");
|
||||
activateDefaultTab("qso");
|
||||
break;
|
||||
case "DAPNETMessagesTab":
|
||||
var element = document.getElementById("dapnet-tab");
|
||||
element.classList.add("active");
|
||||
|
||||
var element = document.getElementById("dapnet");
|
||||
element.classList.add("show");
|
||||
element.classList.add("active");
|
||||
activateDefaultTab("dapnet");
|
||||
break;
|
||||
case "SysInfoTab":
|
||||
var element = document.getElementById("sysinfo-tab");
|
||||
element.classList.add("active");
|
||||
|
||||
var element = document.getElementById("sysinfo");
|
||||
element.classList.add("show");
|
||||
element.classList.add("active");
|
||||
activateDefaultTab("sysinfo");
|
||||
break;
|
||||
case "AboutTab":
|
||||
var element = document.getElementById("about-tab");
|
||||
element.classList.add("active");
|
||||
|
||||
var element = document.getElementById("about");
|
||||
element.classList.add("show");
|
||||
element.classList.add("active");
|
||||
activateDefaultTab("about");
|
||||
break;
|
||||
default:
|
||||
var element = document.getElementById("currtx-tab");
|
||||
element.classList.add("active");
|
||||
|
||||
var element = document.getElementById("currtx");
|
||||
element.classList.add("show");
|
||||
element.classList.add("active");
|
||||
activateDefaultTab("currtx");
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue