add func getArrow

this return a arrow char if colum header corelates with sort param in url
This commit is contained in:
6543 2019-09-18 21:14:34 +02:00
parent 0ba4bb3e26
commit 35b566ed07
Signed by: 6543
GPG Key ID: A1CA74D27FD13271

View File

@ -45,6 +45,38 @@ window.sortt=function(normsort,revsort,isdefault){
window.location.replace(url.href); window.location.replace(url.href);
}; };


//create global function with main routine
function getArrow(normsort,revsort,isdefault){
//sortt [normsort] (revsort) (isdefault)

//arrows
var arrow_down = '⯆'; // U+2BC6
var arrow_up = '⯅'; // U+2BC5

//normsort is needed
if (!(normsort)) return false;

//default values of optinal parameters
if (!(revsort)) revsort = "";

//get sort param from url
let url_sort = (new URL(window.location)).searchParams.get("sort");

if ((url_sort === null) && isdefault) {
//if sort is sorted as default add arrow tho this table header
if (isdefault) return arrow_down;
} else {

if (url_sort === normsort) {
return arrow_down;
} else if (url_sort === revsort) {
return arrow_up;
} else {
return false;
}
}
}



//USE Functions //USE Functions