code reformat
This commit is contained in:
parent
6ee0d1a7a5
commit
9dcc74c22f
62
sortt.js
62
sortt.js
@ -6,41 +6,37 @@
|
||||
Credits to Stuart Langridge, http://www.kryogenix.org/code/browser/sortt/ and its contributors
|
||||
*/
|
||||
|
||||
//safe url sort param global
|
||||
window.sortt_url=window.location.search;
|
||||
if (window.sortt_url.indexOf("sort=") < 0) {
|
||||
//no sort url argument found
|
||||
window.sortt_url="";
|
||||
|
||||
} else {
|
||||
window.sortt_url=window.sortt_url.substr(window.sortt_url.indexOf("sort=")+5);
|
||||
window.sortt_url=window.sortt_url.substr(0,window.sortt_url.indexOf("&"));
|
||||
}
|
||||
//creat global function with main routine
|
||||
window.sortt_f=function(sort_atr){
|
||||
//sortTable [sort attribute]
|
||||
|
||||
if (sort_atr.length = 0) return;
|
||||
|
||||
//split sort_atribute in its parts
|
||||
sortdefault = false;
|
||||
if ( sort_atr.indexOf("*") == 0 ) {
|
||||
sortdefault = true;
|
||||
sort_atr = sort_atr.substr(1);
|
||||
}
|
||||
if ( sort_atr.indexOf(",") == -1 ) {
|
||||
revsort = "";
|
||||
normsort = sort_atr;
|
||||
} else {
|
||||
normsort = sort_atr.substr(0,sort_atr.indexOf(","));
|
||||
revsort = sort_atr.substr(sort_atr.indexOf(",")+1);
|
||||
}
|
||||
|
||||
//safe url sort param global
|
||||
window.sortt_url=window.location.search;
|
||||
if (window.sortt_url.indexOf("sort=") < 0) {
|
||||
//no sort url argument found
|
||||
window.sortt_url="";
|
||||
// look at ReadMe
|
||||
console.log("sortTable() normsort:\"" + normsort + "\" revsort:\"" + revsort + "\" sortdefault:\"" + sortdefault + "\"");
|
||||
|
||||
} else {
|
||||
window.sortt_url=window.sortt_url.substr(window.sortt_url.indexOf("sort=")+5);
|
||||
window.sortt_url=window.sortt_url.substr(0,window.sortt_url.indexOf("&"));
|
||||
}
|
||||
//creat global function with main routine
|
||||
window.sortt_f=function(sort_atr){
|
||||
//sortTable [sort attribute]
|
||||
|
||||
if (sort_atr.length = 0) return;
|
||||
|
||||
//split sort_atribute in its parts
|
||||
sortdefault = false;
|
||||
if ( sort_atr.indexOf("*") == 0 ) {
|
||||
sortdefault = true;
|
||||
sort_atr = sort_atr.substr(1);
|
||||
}
|
||||
if ( sort_atr.indexOf(",") == -1 ) {
|
||||
revsort = "";
|
||||
normsort = sort_atr;
|
||||
} else {
|
||||
normsort = sort_atr.substr(0,sort_atr.indexOf(","));
|
||||
revsort = sort_atr.substr(sort_atr.indexOf(",")+1);
|
||||
}
|
||||
|
||||
// look at ReadMe
|
||||
console.log("sortTable() normsort:\"" + normsort + "\" revsort:\"" + revsort + "\" sortdefault:\"" + sortdefault + "\"");
|
||||
|
||||
};
|
||||
};
|
||||
|
Reference in New Issue
Block a user