1
0
Fork 0

reworked showing of tabs

For easier mainainance and for future developments configuration is modified
Please take a look at config.js
main
Kim Huebel 4 years ago
parent 414778e81c
commit dacf004b36

@ -37,25 +37,25 @@
</nav> </nav>
<ul class="nav nav-tabs" id="myTab" role="tablist"> <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> <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>
<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> <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>
<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> <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>
<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> <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>
<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> <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>
<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> <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>
<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> <a class="nav-link" id="about-tab" data-toggle="tab" href="#about" role="tab" aria-controls="about" aria-selected="false">About</a>
</li> </li>
</ul> </ul>
@ -293,7 +293,7 @@
"order": [[ 0, "desc" ]] "order": [[ 0, "desc" ]]
} ); } );
if (showSysInfoTab) { if (sysinfo > 0) {
var ws3 = new WebSocket("ws://" + window.location.hostname + ":5678/SYSINFO"); var ws3 = new WebSocket("ws://" + window.location.hostname + ":5678/SYSINFO");
ws3.onmessage = function (event) { ws3.onmessage = function (event) {
getSysInfo(document, event); getSysInfo(document, event);
@ -327,7 +327,7 @@
t_qso.row('.selected').remove().draw( false ); t_qso.row('.selected').remove().draw( false );
} ); } );
if (showDAPNETMessagesTab) { if (dapnet > 0) {
var ws2 = new WebSocket("ws://" + window.location.hostname + ":5678/DAPNET"); var ws2 = new WebSocket("ws://" + window.location.hostname + ":5678/DAPNET");
ws2.onmessage = function (event) { ws2.onmessage = function (event) {
getDapnetMessages(document, event); getDapnetMessages(document, event);

@ -10,13 +10,13 @@ var emergencylevel = 500;
// 1 = show tab, 0 = suppress it // 1 = show tab, 0 = suppress it
var showCurrTXTab = 1; var currtx = 1;
var showLastHeardTab = 1; var lastheard = 1;
var showLocalHeadTab = 1; var localheard = 1;
var showInQSOTab = 1; var qso = 1;
var showDAPNETMessagesTab = 1; var dapnet = 1;
var showSysInfoTab = 1; var sysinfo = 1;
var showAboutTab = 1; var about = 1;
// default-tab to show // default-tab to show
// chose from following list: CurrTXTab, LastHeardTab, LocalHeadTab, InQSOTab, DAPNETMessagesTab, SysInfoTab, AboutTab // 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() { $(document).ready(function() {
if(showCurrTXTab == 0){ for (i = 0; i < document.getElementById("myTab").children.length; ++i) {
document.getElementById("myTab").children[0].style.display="none"; tabname = document.getElementById("myTab").children[i].getAttribute("name");
document.getElementById("currtx").style.display="none"; if (eval(tabname) == 0) {
} document.getElementById("myTab").children[i].style.display="none";
if(showLastHeardTab == 0){ document.getElementById(tabname).style.display="none";
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";
} }
switch (defaultTab) { switch (defaultTab) {
case "CurrTXTab": case "CurrTXTab":
var element = document.getElementById("currtx-tab"); activateDefaultTab("currtx");
element.classList.add("active");
var element = document.getElementById("currtx");
element.classList.add("show");
element.classList.add("active");
break; break;
case "LastHeardTab": case "LastHeardTab":
var element = document.getElementById("lastheard-tab"); activateDefaultTab("lastheard");
element.classList.add("active");
var element = document.getElementById("lastheard");
element.classList.add("show");
element.classList.add("active");
break; break;
case "LocalHeadTab": case "LocalHeadTab":
var element = document.getElementById("localheard-tab"); activateDefaultTab("localheard");
element.classList.add("active");
var element = document.getElementById("localheard");
element.classList.add("show");
element.classList.add("active");
break; break;
case "InQSOTab": case "InQSOTab":
var element = document.getElementById("qso-tab"); activateDefaultTab("qso");
element.classList.add("active");
var element = document.getElementById("qso");
element.classList.add("show");
element.classList.add("active");
break; break;
case "DAPNETMessagesTab": case "DAPNETMessagesTab":
var element = document.getElementById("dapnet-tab"); activateDefaultTab("dapnet");
element.classList.add("active");
var element = document.getElementById("dapnet");
element.classList.add("show");
element.classList.add("active");
break; break;
case "SysInfoTab": case "SysInfoTab":
var element = document.getElementById("sysinfo-tab"); activateDefaultTab("sysinfo");
element.classList.add("active");
var element = document.getElementById("sysinfo");
element.classList.add("show");
element.classList.add("active");
break; break;
case "AboutTab": case "AboutTab":
var element = document.getElementById("about-tab"); activateDefaultTab("about");
element.classList.add("active");
var element = document.getElementById("about");
element.classList.add("show");
element.classList.add("active");
break; break;
default: default:
var element = document.getElementById("currtx-tab"); activateDefaultTab("currtx");
element.classList.add("active");
var element = document.getElementById("currtx");
element.classList.add("show");
element.classList.add("active");
break; break;
} }
}); });

Loading…
Cancel
Save