summaryrefslogtreecommitdiff
path: root/media/archweb.js
diff options
context:
space:
mode:
authorNicolás Reynolds <fauno@kiwwwi.com.ar>2011-01-09 17:52:29 -0300
committerNicolás Reynolds <fauno@kiwwwi.com.ar>2011-01-09 17:52:29 -0300
commit5c168b231a814c033264326b39084f184c06e0c4 (patch)
treec96380294e52ffcb46893fc7647532ba8c235d3c /media/archweb.js
parentb3232ae7e075e551145017b6a698968124003f8e (diff)
more merge
Diffstat (limited to 'media/archweb.js')
-rw-r--r--media/archweb.js22
1 files changed, 19 insertions, 3 deletions
diff --git a/media/archweb.js b/media/archweb.js
index c5025ded..1c80ab64 100644
--- a/media/archweb.js
+++ b/media/archweb.js
@@ -36,18 +36,34 @@ if(typeof $.tablesorter !== "undefined") {
$.tablesorter.addParser({
/* sorts duration; put '', 'unknown', and '∞' last. */
id: 'duration',
- is: function(s,table) {
+ re: /^([0-9]+):([0-5][0-9])$/,
+ is: function(s) {
var special = ['', 'unknown', '∞'];
- return ($.inArray(s, special) > -1) || /^[0-9]+:[0-5][0-9]$/.test(s);
+ return ($.inArray(s, special) > -1) || this.re.test(s);
},
format: function(s) {
var special = ['', 'unknown', '∞'];
if($.inArray(s, special) > -1) return Number.MAX_VALUE;
- matches = /^([0-9]+):([0-5][0-9])$/.exec(s);
+ var matches = this.re.exec(s);
return matches[1] * 60 + matches[2];
},
type: 'numeric'
});
+ $.tablesorter.addParser({
+ id: 'longDateTime',
+ re: /^(\d{4})-(\d{2})-(\d{2}) ([012]\d):([0-5]\d)(:([0-5]\d))?( (\w+))?$/,
+ is: function (s) {
+ return this.re.test(s);
+ },
+ format: function (s) {
+ var matches = this.re.exec(s);
+ /* skip group 6, group 7 is optional seconds */
+ if(matches[7] == undefined) matches[7] = "0";
+ return $.tablesorter.formatFloat(new Date(
+ matches[1],matches[2],matches[3],matches[4],matches[5],matches[7]).getTime());
+ },
+ type: "numeric"
+ });
}
/* news/add.html */