1
0
Fork 0
mirror of https://github.com/lidarr/Lidarr synced 2024-12-27 01:57:21 +00:00
Lidarr/UI/Mixins/tablesorter.extensions.js

51 lines
1.3 KiB
JavaScript
Raw Normal View History

2013-02-17 01:16:37 +00:00
$.tablesorter.addParser({
// set a unique id
id : 'title',
2013-05-01 22:42:30 +00:00
is : function () {
2013-02-17 01:16:37 +00:00
// return false so this parser is not auto detected
return false;
},
format: function (s) {
// format your data for normalization
return s.match(/title="(.*?)"/)[1].toLowerCase();
},
// set type, either numeric or text
type : 'text'
2013-02-17 01:16:37 +00:00
});
$.tablesorter.addParser({
// set a unique id
id : 'date',
2013-05-01 22:42:30 +00:00
is : function () {
2013-02-17 01:16:37 +00:00
// return false so this parser is not auto detected
return false;
},
format: function (s) {
// format your data for normalization
var match = s.match(/data-date="(.*?)"/)[1];
if (match === '') {
2013-02-17 01:16:37 +00:00
return Date.create().addYears(100).format(Date.ISO8601_DATETIME);
}
2013-02-17 01:16:37 +00:00
return match;
},
// set type, either numeric or text
type : 'text'
2013-02-17 01:16:37 +00:00
});
$.tablesorter.addParser({
// set a unique id
id : 'innerHtml',
2013-05-01 22:42:30 +00:00
is : function () {
2013-02-17 01:16:37 +00:00
// return false so this parser is not auto detected
return false;
},
format: function (s) {
// format your data for normalization
return $(s).get(0).innerHTML;
},
// set type, either numeric or text
type : 'text'
2013-05-01 22:42:30 +00:00
});