Lines 493-496
jQuery.extend( jQuery.fn.dataTableExt.oSort, {
Link Here
|
493 |
"title-string-desc": function ( a, b ) { |
493 |
"title-string-desc": function ( a, b ) { |
494 |
return ((a < b) ? 1 : ((a > b) ? -1 : 0)); |
494 |
return ((a < b) ? 1 : ((a > b) ? -1 : 0)); |
495 |
} |
495 |
} |
496 |
} ); |
496 |
} ); |
|
|
497 |
|
498 |
(function() { |
499 |
|
500 |
/* Plugin to allow text sorting to ignore articles |
501 |
* |
502 |
* In DataTables config: |
503 |
* "aoColumns": [ |
504 |
* { "sType": "anti-the" }, |
505 |
* ] |
506 |
* Based on the plugin found here: |
507 |
* http://datatables.net/plug-ins/sorting#anti_the |
508 |
* Modified to exclude HTML tags from sorting |
509 |
* Extended to accept a string of space-separated articles |
510 |
* from a configuration file (in English, "a," "an," and "the") |
511 |
*/ |
512 |
|
513 |
if(CONFIG_EXCLUDE_ARTICLES_FROM_SORT){ |
514 |
var articles = CONFIG_EXCLUDE_ARTICLES_FROM_SORT.split(" "); |
515 |
var rpattern = ""; |
516 |
for(i=0;i<articles.length;i++){ |
517 |
rpattern += "^" + articles[i] + " "; |
518 |
if(i < articles.length - 1){ rpattern += "|"; } |
519 |
} |
520 |
var re = new RegExp(rpattern, "i"); |
521 |
} |
522 |
|
523 |
jQuery.extend( jQuery.fn.dataTableExt.oSort, { |
524 |
"anti-the-pre": function ( a ) { |
525 |
var x = String(a).replace( /<[\s\S]*?>/g, "" ); |
526 |
var y = x.trim(); |
527 |
var z = y.replace(re, "").toLowerCase(); |
528 |
return z; |
529 |
}, |
530 |
|
531 |
"anti-the-asc": function ( a, b ) { |
532 |
return ((a < b) ? -1 : ((a > b) ? 1 : 0)); |
533 |
}, |
534 |
|
535 |
"anti-the-desc": function ( a, b ) { |
536 |
return ((a < b) ? 1 : ((a > b) ? -1 : 0)); |
537 |
} |
538 |
}); |
539 |
|
540 |
}()); |