From f9dcd05b1f620cb3351557e7cc0bd4073c5298cf Mon Sep 17 00:00:00 2001 From: Rob Garrison Date: Mon, 5 Sep 2016 09:12:34 -0500 Subject: [PATCH] Mark: Remove internal case matching --- dist/js/widgets/widget-mark.min.js | 2 +- docs/example-widget-mark.html | 32 +++++++++++++++++++++++++----- js/widgets/widget-mark.js | 4 +--- 3 files changed, 29 insertions(+), 9 deletions(-) diff --git a/dist/js/widgets/widget-mark.min.js b/dist/js/widgets/widget-mark.min.js index 0ad1d65e..b81841ed 100644 --- a/dist/js/widgets/widget-mark.min.js +++ b/dist/js/widgets/widget-mark.min.js @@ -1,2 +1,2 @@ /*! Widget: mark.js - updated 9/1/2016 (v2.27.6) */ -!function(a){"use strict";var b=a.tablesorter;b.mark={init:function(c){if("function"==typeof a.fn.mark){var d,e=c.widgetOptions.mark_tsUpdate;c.$table.on("filterEnd.tsmark pagerComplete.tsmark"+(e?" "+e:""),function(a,d){b.mark.update(c,a.type===e?d:"")}),d="(?:<|=|>|\\||\"|\\'|\\s+(?:&&|-|"+(b.language.and||"and")+"|"+(b.language.or||"or")+"|"+(b.language.to||"to")+")\\s+)",b.mark.regex.filter=new RegExp(d,"gim")}else console.warn('Widget-mark not initialized: missing "jquery.mark.js"')},regex:{mark:/^mark_(.+)$/,pure:/^\/((?:\\\/|[^\/])+)\/([mig]{0,3})?$/},checkRegex:function(a){if(a instanceof RegExp){var b="".match(a);return null===b||b.length<5}return!1},cleanMatches:function(a){for(var b=[],c=a&&a.length||0;c--;)""!==a[c]&&(b[b.length]=a[c]);return b},ignoreColumns:function(b){for(var c=b.widgetOptions,d=b.columns,e=[];d--;)(c.mark_tsIgnore[d]||a(b.$headerIndexed[d]).hasClass("mark-ignore"))&&(e[e.length]=":nth-child("+(d+1)+")");return e.length?":not("+e.join(",")+")":""},update:function(c,d){var e={},f=c.widgetOptions,g="undefined"==typeof f.filter_ignoreCase||f.filter_ignoreCase,h=b.mark.regex,i=c.$table.find("tbody tr").unmark().not("."+(c.widgetOptions.filter_filteredRow||"filtered"));d=d||a.tablesorter.getFilters(c.$table),a.each(c.widgetOptions,function(a,b){var c=a.match(h.mark);c&&"undefined"!=typeof c[1]&&(e[c[1]]=b)}),a.each(d,function(d,j){if(j&&!a(c.$headerIndexed[d]).hasClass("mark-ignore")&&!f.mark_tsIgnore[d]){var k=null,l=j,m=!1,n=d===c.columns?b.mark.ignoreColumns(c):":nth-child("+(d+1)+")";if(h.pure.test(j)){l=h.pure.exec(j),".*"===l[1]&&(l[1]="");try{k=new RegExp(l[1],"gim"),l=new RegExp(l[1],l[2])}catch(a){l=null}return void(b.mark.checkRegex(k)&&i.children(n).markRegExp(l,e))}0===j.indexOf("~")?(m=!0,l=j.replace(/~/g,"").split("")):(j.indexOf("?")>-1&&(m=!0,j=j.replace(/\?/g,"\\S{1}")),j.indexOf("*")>-1&&(m=!0,j=j.replace(/\*/g,"\\S*")),l=j.split(h.filter)),m&&l&&l.length?(l=new RegExp(b.mark.cleanMatches(l).join(".*"),"gm"+(g?"i":"")),b.mark.checkRegex(l)&&i.children(n).markRegExp(l,e)):i.children(n).mark(b.mark.cleanMatches(l),e)}})}},b.addWidget({id:"mark",options:{mark_tsUpdate:"markUpdate",mark_tsIgnore:{}},init:function(a,c,d,e){b.mark.init(d,e)},remove:function(a,b){var c=b.widgetOptions.mark_tsUpdate;b.$table.off("filterEnd.tsmark pagerComplete.tsmark"+(c?" "+c:""))}})}(jQuery); \ No newline at end of file +!function(a){"use strict";var b=a.tablesorter;b.mark={init:function(c){if("function"==typeof a.fn.mark){var d,e=c.widgetOptions.mark_tsUpdate;c.$table.on("filterEnd.tsmark pagerComplete.tsmark"+(e?" "+e:""),function(a,d){b.mark.update(c,a.type===e?d:"")}),d="(?:<|=|>|\\||\"|\\'|\\s+(?:&&|-|"+(b.language.and||"and")+"|"+(b.language.or||"or")+"|"+(b.language.to||"to")+")\\s+)",b.mark.regex.filter=new RegExp(d,"gim")}else console.warn('Widget-mark not initialized: missing "jquery.mark.js"')},regex:{mark:/^mark_(.+)$/,pure:/^\/((?:\\\/|[^\/])+)\/([mig]{0,3})?$/},checkRegex:function(a){if(a instanceof RegExp){var b="".match(a);return null===b||b.length<5}return!1},cleanMatches:function(a){for(var b=[],c=a&&a.length||0;c--;)""!==a[c]&&(b[b.length]=a[c]);return b},ignoreColumns:function(b){for(var c=b.widgetOptions,d=b.columns,e=[];d--;)(c.mark_tsIgnore[d]||a(b.$headerIndexed[d]).hasClass("mark-ignore"))&&(e[e.length]=":nth-child("+(d+1)+")");return e.length?":not("+e.join(",")+")":""},update:function(c,d){var e={},f=c.widgetOptions,g=b.mark.regex,h=c.$table.find("tbody tr").unmark().not("."+(c.widgetOptions.filter_filteredRow||"filtered"));d=d||a.tablesorter.getFilters(c.$table),a.each(c.widgetOptions,function(a,b){var c=a.match(g.mark);c&&"undefined"!=typeof c[1]&&(e[c[1]]=b)}),a.each(d,function(d,i){if(i&&!a(c.$headerIndexed[d]).hasClass("mark-ignore")&&!f.mark_tsIgnore[d]){var j=null,k=i,l=!1,m=d===c.columns?b.mark.ignoreColumns(c):":nth-child("+(d+1)+")";if(g.pure.test(i)){k=g.pure.exec(i),".*"===k[1]&&(k[1]="");try{j=new RegExp(k[1],"gim"),k=new RegExp(k[1],k[2])}catch(a){k=null}return void(b.mark.checkRegex(j)&&h.children(m).markRegExp(k,e))}0===i.indexOf("~")?(l=!0,k=i.replace(/~/g,"").split("")):(i.indexOf("?")>-1&&(l=!0,i=i.replace(/\?/g,"\\S{1}")),i.indexOf("*")>-1&&(l=!0,i=i.replace(/\*/g,"\\S*")),k=i.split(g.filter)),l&&k&&k.length?(k=new RegExp(b.mark.cleanMatches(k).join(".*"),"gm"),b.mark.checkRegex(k)&&h.children(m).markRegExp(k,e)):h.children(m).mark(b.mark.cleanMatches(k),e)}})}},b.addWidget({id:"mark",options:{mark_tsUpdate:"markUpdate",mark_tsIgnore:{}},init:function(a,c,d,e){b.mark.init(d,e)},remove:function(a,b){var c=b.widgetOptions.mark_tsUpdate;b.$table.off("filterEnd.tsmark pagerComplete.tsmark"+(c?" "+c:""))}})}(jQuery); \ No newline at end of file diff --git a/docs/example-widget-mark.html b/docs/example-widget-mark.html index e7b0dac7..199ffd4e 100644 --- a/docs/example-widget-mark.html +++ b/docs/example-widget-mark.html @@ -11,9 +11,11 @@ + + @@ -32,7 +34,7 @@ th.tablesorter-header.ignore, .ignore { background-color: #e6bf99; } - + @@ -148,6 +162,7 @@ th.tablesorter-header.ignore, .ignore { background-color: #e6bf99; }

Notes