diff options
author | Florian Pritz <bluewind@xinu.at> | 2014-08-13 15:03:30 +0200 |
---|---|---|
committer | Florian Pritz <bluewind@xinu.at> | 2014-08-29 17:43:19 +0200 |
commit | 4312a6ddf160a284e7bc5b3e1f27bd7a38f08816 (patch) | |
tree | 91602099de0d31ff8153da4ed33baca912c7199c /data/js/script.js | |
parent | 3c6b4d9311fb622a5ccf5276a5f551aa9471f803 (diff) |
Simplify sorting of history table
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'data/js/script.js')
-rw-r--r-- | data/js/script.js | 35 |
1 files changed, 12 insertions, 23 deletions
diff --git a/data/js/script.js b/data/js/script.js index ea9bac814..9e535643c 100644 --- a/data/js/script.js +++ b/data/js/script.js @@ -185,30 +185,19 @@ function fixedEncodeURIComponent (str) { }, type: 'numeric' }); - $.tablesorter.addParser({ - // set a unique id - id: 'mydate', - re: /t=([0-9]+)$/, - is: function(s) { - // return false so this parser is not auto detected - return false; - }, - format: function(s) { - var matches = this.re.exec(s); - if (!matches) { - return 0; + + $(".tablesorter").tablesorter({ + textExtraction: function(node) { + var attr = $(node).attr('data-sort-value'); + if (typeof attr !== 'undefined' && attr !== false) { + var intAttr = parseInt(attr); + if (!isNaN(intAttr)) { + return intAttr; + } + return attr; } - //console.log(s, matches); - return matches[1]; - }, - type: 'numeric' - }); - $("#upload_history:has(tbody tr)").tablesorter({ - headers: { - 0: {sorter: false}, - 4: {sorter: "mydate"}, - }, - sortList: [[4,1]], + return $(node).text(); + } }); } |