mirror of
https://github.com/DJ2LS/FreeDATA
synced 2024-05-14 08:04:33 +00:00
Prettified Code!
This commit is contained in:
parent
41d29ec176
commit
6ea0b2fbf7
|
@ -1603,39 +1603,29 @@ window.addEventListener("DOMContentLoaded", () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
document.getElementById("thTime").addEventListener("click", () => {
|
document.getElementById("thTime").addEventListener("click", () => {
|
||||||
if (hslLastSort==0 && hslLastSortDir=="asc")
|
if (hslLastSort == 0 && hslLastSortDir == "asc") hslLastSortDir = "desc";
|
||||||
hslLastSortDir="desc"
|
else hslLastSortDir = "asc";
|
||||||
else
|
sorthslTable(0);
|
||||||
hslLastSortDir="asc"
|
|
||||||
sorthslTable(0)
|
|
||||||
});
|
});
|
||||||
document.getElementById("thFreq").addEventListener("click", () => {
|
document.getElementById("thFreq").addEventListener("click", () => {
|
||||||
if (hslLastSort==1 && hslLastSortDir=="asc")
|
if (hslLastSort == 1 && hslLastSortDir == "asc") hslLastSortDir = "desc";
|
||||||
hslLastSortDir="desc"
|
else hslLastSortDir = "asc";
|
||||||
else
|
sorthslTable(1);
|
||||||
hslLastSortDir="asc"
|
|
||||||
sorthslTable(1)
|
|
||||||
});
|
});
|
||||||
document.getElementById("thDxcall").addEventListener("click", () => {
|
document.getElementById("thDxcall").addEventListener("click", () => {
|
||||||
if (hslLastSort==3 && hslLastSortDir=="asc")
|
if (hslLastSort == 3 && hslLastSortDir == "asc") hslLastSortDir = "desc";
|
||||||
hslLastSortDir="desc"
|
else hslLastSortDir = "asc";
|
||||||
else
|
sorthslTable(3);
|
||||||
hslLastSortDir="asc"
|
|
||||||
sorthslTable(3)
|
|
||||||
});
|
});
|
||||||
document.getElementById("thDxgrid").addEventListener("click", () => {
|
document.getElementById("thDxgrid").addEventListener("click", () => {
|
||||||
if (hslLastSort==4 && hslLastSortDir=="asc")
|
if (hslLastSort == 4 && hslLastSortDir == "asc") hslLastSortDir = "desc";
|
||||||
hslLastSortDir="desc"
|
else hslLastSortDir = "asc";
|
||||||
else
|
sorthslTable(4);
|
||||||
hslLastSortDir="asc"
|
|
||||||
sorthslTable(4)
|
|
||||||
});
|
});
|
||||||
document.getElementById("thDist").addEventListener("click", () => {
|
document.getElementById("thDist").addEventListener("click", () => {
|
||||||
if (hslLastSort==5 && hslLastSortDir=="asc")
|
if (hslLastSort == 5 && hslLastSortDir == "asc") hslLastSortDir = "desc";
|
||||||
hslLastSortDir="desc"
|
else hslLastSortDir = "asc";
|
||||||
else
|
sorthslTable(5);
|
||||||
hslLastSortDir="asc"
|
|
||||||
sorthslTable(5)
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -3553,71 +3543,79 @@ function changeGuiDesign(design) {
|
||||||
document.getElementById("bootstrap_theme").href = escape(theme_path);
|
document.getElementById("bootstrap_theme").href = escape(theme_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
var hslLastSort=0;
|
var hslLastSort = 0;
|
||||||
var hslLastSortDir="asc";
|
var hslLastSortDir = "asc";
|
||||||
|
|
||||||
//https://www.w3schools.com/howto/howto_js_sort_table.asp
|
//https://www.w3schools.com/howto/howto_js_sort_table.asp
|
||||||
function sorthslTable(n) {
|
function sorthslTable(n) {
|
||||||
hslLastSort=n;
|
hslLastSort = n;
|
||||||
var table, rows, switching, i, x, y, shouldSwitch, dir, switchcount = 0;
|
var table,
|
||||||
table = document.getElementById("tblHeardStationList");
|
rows,
|
||||||
switching = true;
|
switching,
|
||||||
// Set the sorting direction to ascending:
|
i,
|
||||||
//hslLastSortDir = "asc";
|
x,
|
||||||
/* Make a loop that will continue until
|
y,
|
||||||
|
shouldSwitch,
|
||||||
|
dir,
|
||||||
|
switchcount = 0;
|
||||||
|
table = document.getElementById("tblHeardStationList");
|
||||||
|
switching = true;
|
||||||
|
// Set the sorting direction to ascending:
|
||||||
|
//hslLastSortDir = "asc";
|
||||||
|
/* Make a loop that will continue until
|
||||||
no switching has been done: */
|
no switching has been done: */
|
||||||
while (switching) {
|
while (switching) {
|
||||||
// Start by saying: no switching is done:
|
// Start by saying: no switching is done:
|
||||||
switching = false;
|
switching = false;
|
||||||
rows = table.rows;
|
rows = table.rows;
|
||||||
/* Loop through all table rows (except the
|
/* Loop through all table rows (except the
|
||||||
first, which contains table headers): */
|
first, which contains table headers): */
|
||||||
for (i = 1; i < (rows.length - 1); i++) {
|
for (i = 1; i < rows.length - 1; i++) {
|
||||||
// Start by saying there should be no switching:
|
// Start by saying there should be no switching:
|
||||||
shouldSwitch = false;
|
shouldSwitch = false;
|
||||||
/* Get the two elements you want to compare,
|
/* Get the two elements you want to compare,
|
||||||
one from current row and one from the next: */
|
one from current row and one from the next: */
|
||||||
x = rows[i].getElementsByTagName("TD")[n];
|
x = rows[i].getElementsByTagName("TD")[n];
|
||||||
y = rows[i + 1].getElementsByTagName("TD")[n];
|
y = rows[i + 1].getElementsByTagName("TD")[n];
|
||||||
/* Check if the two rows should switch place,
|
/* Check if the two rows should switch place,
|
||||||
based on the direction, asc or desc: */
|
based on the direction, asc or desc: */
|
||||||
if (hslLastSortDir == "asc") {
|
if (hslLastSortDir == "asc") {
|
||||||
if (x.innerHTML.toLowerCase() > y.innerHTML.toLowerCase()) {
|
if (x.innerHTML.toLowerCase() > y.innerHTML.toLowerCase()) {
|
||||||
// If so, mark as a switch and break the loop:
|
// If so, mark as a switch and break the loop:
|
||||||
shouldSwitch = true;
|
shouldSwitch = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else if (hslLastSortDir == "desc") {
|
} else if (hslLastSortDir == "desc") {
|
||||||
if (x.innerHTML.toLowerCase() < y.innerHTML.toLowerCase()) {
|
if (x.innerHTML.toLowerCase() < y.innerHTML.toLowerCase()) {
|
||||||
// If so, mark as a switch and break the loop:
|
// If so, mark as a switch and break the loop:
|
||||||
shouldSwitch = true;
|
shouldSwitch = true;
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (shouldSwitch) {
|
}
|
||||||
/* If a switch has been marked, make the switch
|
if (shouldSwitch) {
|
||||||
|
/* If a switch has been marked, make the switch
|
||||||
and mark that a switch has been done: */
|
and mark that a switch has been done: */
|
||||||
rows[i].parentNode.insertBefore(rows[i + 1], rows[i]);
|
rows[i].parentNode.insertBefore(rows[i + 1], rows[i]);
|
||||||
switching = true;
|
switching = true;
|
||||||
// Each time a switch is done, increase this count by 1:
|
// Each time a switch is done, increase this count by 1:
|
||||||
switchcount ++;
|
switchcount++;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function autostart() {
|
function autostart() {
|
||||||
//Auto start stuff if option is enabled
|
//Auto start stuff if option is enabled
|
||||||
if (config.auto_start == 1) {
|
if (config.auto_start == 1) {
|
||||||
//Start rigctld if radiocontrol is in correct mode and is not active
|
//Start rigctld if radiocontrol is in correct mode and is not active
|
||||||
if (config.radiocontrol == "rigctld" && rigctldActive == false) {
|
if (config.radiocontrol == "rigctld" && rigctldActive == false) {
|
||||||
//console.log("Autostarting rigctld");
|
//console.log("Autostarting rigctld");
|
||||||
document.getElementById("hamlib_rigctld_start").click();
|
document.getElementById("hamlib_rigctld_start").click();
|
||||||
}
|
|
||||||
//Now start TNC
|
|
||||||
document.getElementById("startTNC").click();
|
|
||||||
}
|
}
|
||||||
|
//Now start TNC
|
||||||
|
document.getElementById("startTNC").click();
|
||||||
}
|
}
|
||||||
setTimeout(() => {
|
}
|
||||||
autostart();
|
setTimeout(() => {
|
||||||
}, 5000);
|
autostart();
|
||||||
|
}, 5000);
|
||||||
|
|
|
@ -1163,8 +1163,7 @@
|
||||||
<!--<th scope="col">Off</th>-->
|
<!--<th scope="col">Off</th>-->
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody id="heardstations">
|
<tbody id="heardstations"></tbody>
|
||||||
</tbody>
|
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<!-- END OF HEARD STATIONS TABLE -->
|
<!-- END OF HEARD STATIONS TABLE -->
|
||||||
|
|
Loading…
Reference in a new issue