2015-03-28 20:03:50 +00:00
|
|
|
/*! Parser: Month - updated 10/26/2014 (v2.18.0) */
|
|
|
|
/* Demo: http://jsfiddle.net/Mottie/abkNM/4169/ */
|
2013-03-26 21:05:21 +00:00
|
|
|
/*jshint jquery:true */
|
|
|
|
;(function($){
|
2015-07-23 04:29:51 +00:00
|
|
|
'use strict';
|
2013-03-26 21:05:21 +00:00
|
|
|
|
2013-09-29 19:37:03 +00:00
|
|
|
var ts = $.tablesorter;
|
|
|
|
ts.dates = $.extend({}, ts.dates, {
|
2015-03-28 20:03:50 +00:00
|
|
|
// *** modify this array to match the desired language ***
|
2013-03-26 21:05:21 +00:00
|
|
|
monthCased : [ 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec' ]
|
|
|
|
});
|
2013-09-29 19:37:03 +00:00
|
|
|
ts.dates.monthLower = ts.dates.monthCased.join(',').toLocaleLowerCase().split(',');
|
2013-03-26 21:05:21 +00:00
|
|
|
|
2013-09-29 19:37:03 +00:00
|
|
|
ts.addParser({
|
2015-07-23 04:29:51 +00:00
|
|
|
id: 'month',
|
2013-03-26 21:05:21 +00:00
|
|
|
is: function(){
|
|
|
|
return false;
|
|
|
|
},
|
|
|
|
format: function(s, table) {
|
2014-09-30 21:20:04 +00:00
|
|
|
if (s) {
|
|
|
|
var j = -1, c = table.config,
|
|
|
|
n = c.ignoreCase ? s.toLocaleLowerCase() : s;
|
2015-07-23 04:29:51 +00:00
|
|
|
$.each(ts.dates[ 'month' + (c.ignoreCase ? 'Lower' : 'Cased') ], function(i, v){
|
2014-09-30 21:20:04 +00:00
|
|
|
if (j < 0 && n.match(v)) {
|
|
|
|
j = i;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
// return s (original string) if there isn't a match
|
|
|
|
// (non-weekdays will sort separately and empty cells will sort as expected)
|
|
|
|
return j < 0 ? s : j;
|
|
|
|
}
|
|
|
|
return s;
|
2013-03-26 21:05:21 +00:00
|
|
|
},
|
2015-07-23 04:29:51 +00:00
|
|
|
type: 'numeric'
|
2013-03-26 21:05:21 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
})(jQuery);
|