|
|
|
@ -5,23 +5,25 @@ var CONSTANT_ESCAPE_KEY = 27;
|
|
|
|
|
var CONSTANT_S_KEY = 83;
|
|
|
|
|
var CONSTANT_s_KEY = 115;
|
|
|
|
|
|
|
|
|
|
// global sorting vars (new window is always last_changed, descending)
|
|
|
|
|
// globals
|
|
|
|
|
var loading;
|
|
|
|
|
var sort_column;
|
|
|
|
|
var sort_order;
|
|
|
|
|
var sort_column; // new window or tab is always last_changed
|
|
|
|
|
var sort_order; // new window or tab is always descending
|
|
|
|
|
var coordX;
|
|
|
|
|
var coordY;
|
|
|
|
|
|
|
|
|
|
// restore scroll position on submit/reload
|
|
|
|
|
document.addEventListener("DOMContentLoaded", function(event) {
|
|
|
|
|
var scrollpos = sessionStorage.getItem('scrollpos');
|
|
|
|
|
if (scrollpos) window.scrollTo(0, scrollpos);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// mobile scroll position retention
|
|
|
|
|
if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
|
|
|
|
|
document.addEventListener("visibilitychange", function() {
|
|
|
|
|
storeScrollAndSearch();
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
} else {
|
|
|
|
|
// non-mobile scroll position retention
|
|
|
|
|
window.onbeforeunload = function(e) {
|
|
|
|
|
storeScrollAndSearch();
|
|
|
|
@ -31,6 +33,7 @@ function storeScrollAndSearch() {
|
|
|
|
|
sessionStorage.setItem('scrollpos', window.pageYOffset);
|
|
|
|
|
sessionStorage.setItem('searchtxt', document.getElementById("txtInput").value);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// (ctl)-alt-s search hotkey
|
|
|
|
|
document.onkeyup = function(e) {
|
|
|
|
|
var e = e || window.event; // for IE to cover IEs window event-object
|
|
|
|
@ -40,6 +43,13 @@ document.onkeyup=function(e){
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// keep track of click position for placement of checkbox-functions grid display
|
|
|
|
|
document.addEventListener("click", clickPos);
|
|
|
|
|
function clickPos(event) {
|
|
|
|
|
coordX = event.clientX;
|
|
|
|
|
coordY = event.clientY;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// page load functions
|
|
|
|
|
window.addEventListener('DOMContentLoaded', (event) => {
|
|
|
|
|
load_functions();
|
|
|
|
@ -66,7 +76,8 @@ function load_functions() {
|
|
|
|
|
|
|
|
|
|
// sorting
|
|
|
|
|
function sortTable(n) {
|
|
|
|
|
var table, rows, switching, i, x, y, shouldSwitch, dir, switchcount = 0, sortimgs, sortableimgs;
|
|
|
|
|
var table, rows, switching, i, x, y, shouldSwitch, dir, switchcount = 0,
|
|
|
|
|
sortimgs, sortableimgs;
|
|
|
|
|
table = document.getElementById("watch-table");
|
|
|
|
|
switching = true;
|
|
|
|
|
//Set the sorting direction, either default 9, 1 or saved
|
|
|
|
@ -74,8 +85,7 @@ function sortTable(n) {
|
|
|
|
|
getSort();
|
|
|
|
|
dir = (sort_order == 0) ? "asc" : "desc";
|
|
|
|
|
loading = false;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
} else {
|
|
|
|
|
dir = "asc";
|
|
|
|
|
}
|
|
|
|
|
/*Make a loop that will continue until
|
|
|
|
@ -143,8 +153,7 @@ function sortTable(n) {
|
|
|
|
|
// show current asc/desc sort arrow and set sort_order var
|
|
|
|
|
if (dir == "asc") {
|
|
|
|
|
document.getElementById("sort-" + n + "a").style.display = "";
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
} else {
|
|
|
|
|
document.getElementById("sort-" + n + "d").style.display = "";
|
|
|
|
|
}
|
|
|
|
|
// show all sortable indicators
|
|
|
|
@ -165,22 +174,19 @@ function sortTable(n) {
|
|
|
|
|
function checkAll(e) {
|
|
|
|
|
var i;
|
|
|
|
|
var checkboxes = document.getElementsByName('check');
|
|
|
|
|
var checkboxFunctions = document.querySelectorAll('[id=checkbox-functions]');
|
|
|
|
|
var checkboxFunctions = document.getElementById('checkbox-functions');
|
|
|
|
|
if (e.checked) {
|
|
|
|
|
for (i = 0; i < checkboxes.length; i++) {
|
|
|
|
|
checkboxes[i].checked = true;
|
|
|
|
|
}
|
|
|
|
|
for (i = 0; i < checkboxFunctions.length; i++) {
|
|
|
|
|
checkboxFunctions[i].style.display = "";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
checkboxFunctions.style.left = coordX + 25 + "px";
|
|
|
|
|
checkboxFunctions.style.top = coordY + "px";
|
|
|
|
|
checkboxFunctions.style.display = "";
|
|
|
|
|
} else {
|
|
|
|
|
for (i = 0; i < checkboxes.length; i++) {
|
|
|
|
|
checkboxes[i].checked = false;
|
|
|
|
|
}
|
|
|
|
|
for (i = 0; i < checkboxFunctions.length; i++) {
|
|
|
|
|
checkboxFunctions[i].style.display = "none";
|
|
|
|
|
}
|
|
|
|
|
checkboxFunctions.style.display = "none";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -189,22 +195,23 @@ function checkChange(){
|
|
|
|
|
var i;
|
|
|
|
|
var totalCheckbox = document.querySelectorAll('input[name="check"]').length;
|
|
|
|
|
var totalChecked = document.querySelectorAll('input[name="check"]:checked').length;
|
|
|
|
|
var checkboxFunctions = document.querySelectorAll('[id=checkbox-functions]');
|
|
|
|
|
var checkboxFunctions = document.getElementById('checkbox-functions'); //document.querySelectorAll('[id=checkbox-functions]');
|
|
|
|
|
if (totalCheckbox == totalChecked) {
|
|
|
|
|
document.getElementsByName("showhide")[0].checked = true;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
} else {
|
|
|
|
|
document.getElementsByName("showhide")[0].checked = false;
|
|
|
|
|
}
|
|
|
|
|
if(totalChecked == 0) {
|
|
|
|
|
for (i = 0; i < checkboxFunctions.length; i++) {
|
|
|
|
|
checkboxFunctions[i].style.display = "none";
|
|
|
|
|
}
|
|
|
|
|
if (totalChecked > 0) {
|
|
|
|
|
checkboxFunctions.style.display = "";
|
|
|
|
|
checkboxFunctions.style.left = coordX + 25 + "px";
|
|
|
|
|
if ( coordY > ( window.innerHeight - checkboxFunctions.offsetHeight) ) {
|
|
|
|
|
checkboxFunctions.style.top = (window.innerHeight - checkboxFunctions.offsetHeight) + "px";
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
for (i = 0; i < checkboxFunctions.length; i++) {
|
|
|
|
|
checkboxFunctions[i].style.display = "";
|
|
|
|
|
checkboxFunctions.style.top = coordY + "px";
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
checkboxFunctions.style.display = "none";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -225,8 +232,7 @@ function tblSearch(evt) {
|
|
|
|
|
txtValue = td.textContent || td.innerText;
|
|
|
|
|
if (txtValue.toUpperCase().indexOf(filter) > -1) {
|
|
|
|
|
tr[i].style.display = "";
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
} else {
|
|
|
|
|
tr[i].style.display = "none";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -254,8 +260,7 @@ function restripe () {
|
|
|
|
|
if (i % 2 == 0) {
|
|
|
|
|
row.classList.remove('pure-table-odd');
|
|
|
|
|
row.classList.add('pure-table-even');
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
} else {
|
|
|
|
|
row.classList.remove('pure-table-even');
|
|
|
|
|
row.classList.add('pure-table-odd');
|
|
|
|
|
}
|
|
|
|
@ -278,8 +283,7 @@ function getChecked(items) {
|
|
|
|
|
|
|
|
|
|
if (items === undefined) {
|
|
|
|
|
checkedArr = document.querySelectorAll('input[name="check"]:checked');
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
} else {
|
|
|
|
|
checkedArr = document.querySelectorAll('input[name="check"]');
|
|
|
|
|
}
|
|
|
|
|
if (checkedArr.length > 0) {
|
|
|
|
@ -304,8 +308,7 @@ function processChecked(func, tag) {
|
|
|
|
|
|
|
|
|
|
if (func == 'mark_all_notviewed') {
|
|
|
|
|
uuids = getChecked('all');
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
} else {
|
|
|
|
|
uuids = getChecked();
|
|
|
|
|
}
|
|
|
|
|
// confirm if deleting
|
|
|
|
@ -361,8 +364,7 @@ function getSort() {
|
|
|
|
|
if (sessionStorage.getItem("sort_column") != null) {
|
|
|
|
|
sort_column = sessionStorage.getItem("sort_column");
|
|
|
|
|
sort_order = sessionStorage.getItem("sort_order");
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
} else {
|
|
|
|
|
sort_column = 7; // last changed
|
|
|
|
|
sort_order = 1; // desc
|
|
|
|
|
//alert("Your web browser does not support retaining sorting and page position.");
|
|
|
|
|