Overall: set jsHint "undef" & "unused" options. Fixed issues

The math widget had a javascript error which jsHint was not catching
This commit is contained in:
Mottie 2015-07-28 15:57:01 -05:00
parent b3dd4b7c75
commit 10bc23fa24
17 changed files with 45 additions and 35 deletions

View File

@ -244,15 +244,20 @@ module.exports = function( grunt ) {
},
options: {
globals: {
'JSON': false,
'localStorage': false,
'navigator': false,
'console': false,
'alert': false
'require': false,
'define': false,
'module': false
},
'loopfunc': true,
'jquery': true,
'browser': true,
'es3': true
'es3': true,
'unused': true,
'undef': true
}
},

View File

@ -29,7 +29,7 @@
* @contributor Rob Garrison - https://github.com/Mottie/tablesorter
*/
/*jshint browser:true, jquery:true, unused:false, expr: true */
/*global console:false, alert:false, require:false, define:false, module:false */
/*global console:false */
;(function($){
'use strict';
$.extend({
@ -2244,6 +2244,7 @@
})(jQuery);
/*! Widget: storage - updated 3/26/2015 (v2.21.3) */
/*global JSON:false */
;(function ($, window, document) {
'use strict';
@ -2705,7 +2706,7 @@
types: {
or : function( c, data, vars ) {
if ( /\|/.test( data.iFilter ) || ts.filter.regex.orSplit.test( data.filter ) ) {
var indx, filterMatched, txt, query, regex,
var indx, filterMatched, query, regex,
// duplicate data but split filter
data2 = $.extend( {}, data ),
index = data.index,
@ -2740,7 +2741,7 @@
// Look for an AND or && operator ( logical and )
and : function( c, data, vars ) {
if ( ts.filter.regex.andTest.test( data.filter ) ) {
var indx, filterMatched, result, txt, query, regex,
var indx, filterMatched, result, query, regex,
// duplicate data but split filter
data2 = $.extend( {}, data ),
index = data.index,

View File

@ -27,7 +27,7 @@
* @contributor Rob Garrison - https://github.com/Mottie/tablesorter
*/
/*jshint browser:true, jquery:true, unused:false, expr: true */
/*global console:false, alert:false, require:false, define:false, module:false */
/*global console:false */
;(function($){
'use strict';
$.extend({

View File

@ -11,6 +11,7 @@
}(function($) {
/*! Widget: storage - updated 3/26/2015 (v2.21.3) */
/*global JSON:false */
;(function ($, window, document) {
'use strict';
@ -472,7 +473,7 @@
types: {
or : function( c, data, vars ) {
if ( /\|/.test( data.iFilter ) || ts.filter.regex.orSplit.test( data.filter ) ) {
var indx, filterMatched, txt, query, regex,
var indx, filterMatched, query, regex,
// duplicate data but split filter
data2 = $.extend( {}, data ),
index = data.index,
@ -507,7 +508,7 @@
// Look for an AND or && operator ( logical and )
and : function( c, data, vars ) {
if ( ts.filter.regex.andTest.test( data.filter ) ) {
var indx, filterMatched, result, txt, query, regex,
var indx, filterMatched, result, query, regex,
// duplicate data but split filter
data2 = $.extend( {}, data ),
index = data.index,

View File

@ -2,4 +2,4 @@
!function(a){"use strict";var b,c,d=a.tablesorter;/*! IPv6 Address parser (WIP) */
a.extend(d.regex,{},{ipv4Validate:/((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})/,ipv4Extract:/([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})/,ipv6Validate:/^\s*((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$/i}),d.addParser({id:"ipv6Address",is:function(a){return d.regex.ipv6Validate.test(a)},format:function(a,b){var c,e,f,g,h,i=b?"boolean"==typeof b?b:b&&b.config.ipv6HexFormat||!1:!1,j="",k="",l=8;if(a=a.replace(/\s*/g,""),d.regex.ipv4Validate.test(a)){for(g=a.match(d.regex.ipv4Extract),e="",c=1;c<g.length;c++)e+=("00"+parseInt(g[c],10).toString(16)).slice(-2)+(2===c?":":"");a=a.replace(d.regex.ipv4Extract,e)}if(-1==a.indexOf("::"))j=a;else{for(f=a.split("::"),h=0,c=0;c<f.length;c++)h+=f[c].split(":").length;for(j+=f[0]+":",c=0;l-h>c;c++)j+="0000:";j+=f[1]}for(g=j.split(":"),c=0;l>c;c++)g[c]=i?("0000"+g[c]).slice(-4):("00000"+(parseInt(g[c],16)||0)).slice(-5),k+=c!=l-1?g[c]+":":g[c];return i?k:k.replace(/:/g,"")},type:"numeric"}),c=function(a){return/^\d{1,3}[\.]\d{1,3}[\.]\d{1,3}[\.]\d{1,3}$/.test(a)},b=function(a,b){var c,e=a?a.split("."):"",f="",g=e.length;for(c=0;g>c;c++)f+=("000"+e[c]).slice(-3);return a?d.formatFloat(f,b):a},/*! Parser: ipv4Address (a.k.a. ipAddress) */
d.addParser({id:"ipAddress",is:c,format:b,type:"numeric"}),d.addParser({id:"ipv4Address",is:c,format:b,type:"numeric"}),/*! Parser: MAC address */
d.addParser({id:"MAC",is:function(a){return!1},format:function(a){var b,c,d="",e=(a||"").replace(/[:.-]/g,"").match(/\w{2}/g);if(e){for(c=e.length,b=0;c>b;b++)d+=("000"+parseInt(e[b],16)).slice(-3);return d}return a},type:"numeric"})}(jQuery);
d.addParser({id:"MAC",is:function(){return!1},format:function(a){var b,c,d="",e=(a||"").replace(/[:.-]/g,"").match(/\w{2}/g);if(e){for(c=e.length,b=0;c>b;b++)d+=("000"+parseInt(e[b],16)).slice(-3);return d}return a},type:"numeric"})}(jQuery);

View File

@ -1,9 +1,9 @@
/*! Widget: math - updated 7/28/2015 (v2.22.4) */
!function(a){"use strict";var b=a.tablesorter,c={error:{0:"Infinity result: Divide by zero",1:"Need more than one element to make this calculation",undef:"No elements found"},invalid:function(a,b){return console.log(a,c.error[b]),"none"},events:"tablesorter-initialized update updateAll updateRows addRows updateCell filterReset filterEnd ".split(" ").join(".tsmath "),processText:function(a,c){var d=c.attr(a.textAttribute);return"undefined"==typeof d&&(d=c[0].textContent||c.text()),d=b.formatFloat(d.replace(/[^\w,. \-()]/g,""),a.table)||0,isNaN(d)?0:d},getRow:function(b,d){var e=b.widgetOptions,f=[],g=d.closest("tr"),h=g.children().not("["+e.math_dataAttrib+"=ignore]");return g.hasClass(e.filter_filteredRow||"filtered")||(e.math_ignore.length&&(h=h.not("[data-column="+e.math_ignore.join("],[data-column=")+"]")),f=h.not(d).map(function(){return c.processText(b,a(this))}).get()),f},getColumn:function(a,b,d){var e,f,g,h,i,j=[],k=a.widgetOptions,l=k.filter_filteredRow||"filtered",m=parseInt(b.attr("data-column"),10),n=a.$table.children("tbody").children(),o=b.closest("tr");if("above"===d)for(g=n.index(o),e=g;e>=0;)f=n.eq(e).children().filter("[data-column="+m+"]"),i=f.filter("["+k.math_dataAttrib+"^=above]").length,(!n.eq(e).hasClass(l)&&n.eq(e).not("["+k.math_dataAttrib+"=ignore]").length&&e!==g||i&&e!==g)&&(i?e=0:f.length&&j.push(c.processText(a,f))),e--;else for(h=n.not("["+k.math_dataAttrib+"=ignore]"),g=h.length,e=0;g>e;e++)f=h.eq(e).children().filter("[data-column="+m+"]"),h.eq(e).hasClass(l)||!f.not("["+k.math_dataAttrib+"^=above],["+k.math_dataAttrib+"^=col]").length||f.is(b)||j.push(c.processText(a,f));return j},getAll:function(b){var d,e,f,g,h,i,j,k,l=[],m=b.widgetOptions,n=m.filter_filteredRow||"filtered",o=b.$table.children("tbody").children().not("["+m.math_dataAttrib+"=ignore]");for(h=o.length,g=0;h>g;g++)if(f=o.eq(g),!f.hasClass(n))for(i=f.children().not("["+m.math_dataAttrib+"=ignore]"),k=i.length,j=0;k>j;j++)d=i.eq(j),e=parseInt(d.attr("data-column"),10),!d.filter("["+m.math_dataAttrib+"]").length&&a.inArray(e,m.math_ignore)<0&&l.push(c.processText(b,d));return l},recalculate:function(a,d,e,f){if(d&&(!e.math_isUpdating||f)){f&&b.computeColumnIndex(d.$table.children("tbody").children()),e.math_dataAttrib="data-"+(e.math_data||"math");var g=d.$tbodies.find("["+e.math_dataAttrib+"]");c.mathType(d,g,e.math_priority),g=d.$table.children("."+d.cssInfoBlock+", tfoot").find("["+e.math_dataAttrib+"]"),c.mathType(d,g,e.math_priority),g=d.$table.find("["+e.math_dataAttrib+"^=all]"),c.mathType(d,g,["all"]),e.math_isUpdating=!0,d.debug&&console[console.group?"group":"log"]("Math widget triggering an update after recalculation"),d.$table.trigger("update")}},mathType:function(d,e,f){if(e.length){var g,h,i,j,k,l,m,n,o=d.widgetOptions,p=b.equations;"all"===f[0]&&(k=c.getAll(d)),d.debug&&console[console.group?"group":"log"]("Tablesorter Math widget recalculation"),a.each(f,function(a,b){if(l=e.filter("["+o.math_dataAttrib+"^="+b+"]"),n=l.length){for(d.debug&&console[console.group?"group":"log"](b),m=0;n>m;m++)i=l.eq(m),g=(i.attr(o.math_dataAttrib)||"").replace(b+"-",""),j="row"===b?c.getRow(d,i):"all"===b?k:c.getColumn(d,i,b),p[g]&&(j.length?(h=p[g](j),d.debug&&console.log(i.attr(o.math_dataAttrib),j,"=",h)):h=c.invalid(g,"mean"===g?0:"undef"),c.output(i,o,h,j));d.debug&&console.groupEnd&&console.groupEnd()}}),d.debug&&console.groupEnd&&console.groupEnd()}},output:function(a,c,d,e){var f=a.attr("data-"+c.math_data+"-mask")||c.math_mask,g=b.formatMask(f,d,c.math_wrapPrefix,c.math_wrapSuffix);"function"==typeof c.math_complete&&(g=c.math_complete(a,c,g,d,e)),g!==!1&&a.html(g)}};/**
!function(a){"use strict";var b=a.tablesorter,c={error:{0:"Infinity result: Divide by zero",1:"Need more than one element to make this calculation",undef:"No elements found"},invalid:function(a,b){return console.log(a,c.error[b]),"none"},events:"tablesorter-initialized update updateAll updateRows addRows updateCell filterReset filterEnd ".split(" ").join(".tsmath "),processText:function(a,c){var d=c.attr(a.textAttribute);return"undefined"==typeof d&&(d=c[0].textContent||c.text()),d=b.formatFloat(d.replace(/[^\w,. \-()]/g,""),a.table)||0,isNaN(d)?0:d},getRow:function(b,d){var e=b.widgetOptions,f=[],g=d.closest("tr"),h=g.children().not("["+e.math_dataAttrib+"=ignore]");return g.hasClass(e.filter_filteredRow||"filtered")||(e.math_ignore.length&&(h=h.not("[data-column="+e.math_ignore.join("],[data-column=")+"]")),f=h.not(d).map(function(){return c.processText(b,a(this))}).get()),f},getColumn:function(a,b,d){var e,f,g,h,i,j=[],k=a.widgetOptions,l=k.filter_filteredRow||"filtered",m=parseInt(b.attr("data-column"),10),n=a.$table.children("tbody").children(),o=b.closest("tr");if("above"===d)for(g=n.index(o),e=g;e>=0;)f=n.eq(e).children().filter("[data-column="+m+"]"),i=f.filter("["+k.math_dataAttrib+"^=above]").length,(!n.eq(e).hasClass(l)&&n.eq(e).not("["+k.math_dataAttrib+"=ignore]").length&&e!==g||i&&e!==g)&&(i?e=0:f.length&&j.push(c.processText(a,f))),e--;else for(h=n.not("["+k.math_dataAttrib+"=ignore]"),g=h.length,e=0;g>e;e++)f=h.eq(e).children().filter("[data-column="+m+"]"),h.eq(e).hasClass(l)||!f.not("["+k.math_dataAttrib+"^=above],["+k.math_dataAttrib+"^=col]").length||f.is(b)||j.push(c.processText(a,f));return j},getAll:function(b){var d,e,f,g,h,i,j,k,l=[],m=b.widgetOptions,n=m.filter_filteredRow||"filtered",o=b.$table.children("tbody").children().not("["+m.math_dataAttrib+"=ignore]");for(h=o.length,g=0;h>g;g++)if(f=o.eq(g),!f.hasClass(n))for(i=f.children().not("["+m.math_dataAttrib+"=ignore]"),k=i.length,j=0;k>j;j++)d=i.eq(j),e=parseInt(d.attr("data-column"),10),!d.filter("["+m.math_dataAttrib+"]").length&&a.inArray(e,m.math_ignore)<0&&l.push(c.processText(b,d));return l},recalculate:function(a,d,e){if(a&&(!d.math_isUpdating||e)){e&&b.computeColumnIndex(a.$table.children("tbody").children()),d.math_dataAttrib="data-"+(d.math_data||"math");var f=a.$tbodies.find("["+d.math_dataAttrib+"]");c.mathType(a,f,d.math_priority),f=a.$table.children("."+a.cssInfoBlock+", tfoot").find("["+d.math_dataAttrib+"]"),c.mathType(a,f,d.math_priority),f=a.$table.find("["+d.math_dataAttrib+"^=all]"),c.mathType(a,f,["all"]),d.math_isUpdating=!0,a.debug&&console[console.group?"group":"log"]("Math widget triggering an update after recalculation"),a.$table.trigger("update")}},mathType:function(d,e,f){if(e.length){var g,h,i,j,k,l,m,n,o=d.widgetOptions,p=b.equations;"all"===f[0]&&(k=c.getAll(d)),d.debug&&console[console.group?"group":"log"]("Tablesorter Math widget recalculation"),a.each(f,function(a,b){if(l=e.filter("["+o.math_dataAttrib+"^="+b+"]"),n=l.length){for(d.debug&&console[console.group?"group":"log"](b),m=0;n>m;m++)i=l.eq(m),g=(i.attr(o.math_dataAttrib)||"").replace(b+"-",""),j="row"===b?c.getRow(d,i):"all"===b?k:c.getColumn(d,i,b),p[g]&&(j.length?(h=p[g](j),d.debug&&console.log(i.attr(o.math_dataAttrib),j,"=",h)):h=c.invalid(g,"mean"===g?0:"undef"),c.output(i,o,h,j));d.debug&&console.groupEnd&&console.groupEnd()}}),d.debug&&console.groupEnd&&console.groupEnd()}},output:function(a,c,d,e){var f=a.attr("data-"+c.math_data+"-mask")||c.math_mask,g=b.formatMask(f,d,c.math_wrapPrefix,c.math_wrapSuffix);"function"==typeof c.math_complete&&(g=c.math_complete(a,c,g,d,e)),g!==!1&&a.html(g)}};/**
* @preserve IntegraXor Web SCADA - JavaScript Number Formatter
* http:// www.integraxor.com/
* author: KPL, KHL
* (c)2011 ecava
* Dual licensed under the MIT or GPL Version 2 licenses.
*/
b.formatMask=function(a,b,c,d){if(!a||isNaN(+b))return b;var e,f,g,h,i,j,k,m,n,o,p,q,r,s,t,u="",v=a.length,w=a.search(/[0-9\-\+#]/),x=w>0?a.substring(0,w):"",y=x;if(w>0&&c&&(y=/\{content\}/.test(c||"")?(c||"").replace(/\{content\}/g,x||""):(c||"")+x),t=a.split("").reverse().join(""),s=t.search(/[0-9\-\+#]/),r=v-s,r+="."===a.substring(r,r+1)?1:0,x=s>0?a.substring(r,v):"",u=x,""!==x&&d&&(u=/\{content\}/.test(d||"")?(d||"").replace(/\{content\}/g,x||""):x+(d||"")),a=a.substring(w,r),b="-"==a.charAt(0)?-b:+b,e=0>b?b=-b:0,f=a.match(/[^\d\-\+#]/g),g=f&&f[f.length-1]||".",h=f&&f[1]&&f[0]||",",a=a.split(g),b=b.toFixed(a[1]&&a[1].length),b=+b+"",j=a[1]&&a[1].lastIndexOf("0"),m=b.split("."),(!m[1]||m[1]&&m[1].length<=j)&&(b=(+b).toFixed(j+1)),n=a[0].split(h),a[0]=n.join(""),i=a[0]&&a[0].indexOf("0"),i>-1)for(;m[0].length<a[0].length-i;)m[0]="0"+m[0];else 0===+m[0]&&(m[0]="");if(b=b.split("."),b[0]=m[0],k=n[1]&&n[n.length-1].length){for(o=b[0],p="",q=o.length%k,v=o.length,r=0;v>r;r++)p+=o.charAt(r),!((r-q+1)%k)&&r<l-k&&(p+=h);b[0]=p}return b[1]=a[1]&&b[1]?g+b[1]:"",y+((e?"-":"")+b[0]+b[1])+u},b.equations={count:function(a){return a.length},sum:function(a){var b,c=a.length,d=0;for(b=0;c>b;b++)d+=a[b];return d},mean:function(a){var c=b.equations.sum(a);return c/a.length},median:function(a){var b,d=a.length;return d>1?(a.sort(function(a,b){return a-b}),b=Math.floor(d/2),d%2?a[b]:(a[b-1]+a[b])/2):c.invalid("median",1)},mode:function(a){var b,c,d,e={},f=1,g=[a[0]];for(b=0;b<a.length;b++)c=a[b],e[c]=e[c]?e[c]+1:1,d=e[c],d>f?(g=[c],f=d):d===f&&(g.push(c),f=d);return g.sort(function(a,b){return a-b})},max:function(a){return Math.max.apply(Math,a)},min:function(a){return Math.min.apply(Math,a)},range:function(a){var b=a.sort(function(a,b){return a-b});return b[a.length-1]-b[0]},variance:function(a,d){for(var e,f=b.equations.mean(a),g=0,h=a.length;h--;)g+=Math.pow(a[h]-f,2);return e=a.length-(d?0:1),0===e?c.invalid("variance",0):g/=e},varp:function(a){return b.equations.variance(a,!0)},vars:function(a){return b.equations.variance(a)},stdevs:function(a){var c=b.equations.variance(a);return Math.sqrt(c)},stdevp:function(a){var c=b.equations.variance(a,!0);return Math.sqrt(c)}},b.addWidget({id:"math",priority:100,options:{math_data:"math",math_ignore:[],math_mask:"#,##0.00",math_complete:null,math_priority:["row","above","col"],math_prefix:"",math_suffix:"",math_event:"recalculate"},init:function(a,d,e,f){var g=b.hasWidget(a,"filter")?"filterEnd":"updateComplete";e.$table.off((c.events+" updateComplete.tsmath "+f.math_event).replace(/\s+/g," ")).on(c.events+" "+f.math_event,function(d){var g="tablesorter-initialized"===d.type;(!f.math_isUpdating||g)&&(/filter/.test(d.type)||b.computeColumnIndex(e.$table.children("tbody").children()),c.recalculate(a,e,f,g))}).on(g+".tsmath",function(){setTimeout(function(){f.math_isUpdating&&e.debug&&console.groupEnd&&console.groupEnd(),f.math_isUpdating=!1},40)}),f.math_isUpdating=!1},remove:function(a,b,d,e){e||b.$table.off((c.events+" updateComplete.tsmath "+d.math_event).replace(/\s+/g," ")).find("[data-"+d.math_data+"]").empty()}})}(jQuery);
b.formatMask=function(a,b,c,d){if(!a||isNaN(+b))return b;var e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t="",u=a.length,v=a.search(/[0-9\-\+#]/),w=v>0?a.substring(0,v):"",x=w;if(v>0&&c&&(x=/\{content\}/.test(c||"")?(c||"").replace(/\{content\}/g,w||""):(c||"")+w),s=a.split("").reverse().join(""),r=s.search(/[0-9\-\+#]/),q=u-r,q+="."===a.substring(q,q+1)?1:0,w=r>0?a.substring(q,u):"",t=w,""!==w&&d&&(t=/\{content\}/.test(d||"")?(d||"").replace(/\{content\}/g,w||""):w+(d||"")),a=a.substring(v,q),b="-"==a.charAt(0)?-b:+b,e=0>b?b=-b:0,f=a.match(/[^\d\-\+#]/g),g=f&&f[f.length-1]||".",h=f&&f[1]&&f[0]||",",a=a.split(g),b=b.toFixed(a[1]&&a[1].length),b=+b+"",j=a[1]&&a[1].lastIndexOf("0"),l=b.split("."),(!l[1]||l[1]&&l[1].length<=j)&&(b=(+b).toFixed(j+1)),m=a[0].split(h),a[0]=m.join(""),i=a[0]&&a[0].indexOf("0"),i>-1)for(;l[0].length<a[0].length-i;)l[0]="0"+l[0];else 0===+l[0]&&(l[0]="");if(b=b.split("."),b[0]=l[0],k=m[1]&&m[m.length-1].length){for(n=b[0],o="",p=n.length%k,u=n.length,q=0;u>q;q++)o+=n.charAt(q),!((q-p+1)%k)&&u-k>q&&(o+=h);b[0]=o}return b[1]=a[1]&&b[1]?g+b[1]:"",x+((e?"-":"")+b[0]+b[1])+t},b.equations={count:function(a){return a.length},sum:function(a){var b,c=a.length,d=0;for(b=0;c>b;b++)d+=a[b];return d},mean:function(a){var c=b.equations.sum(a);return c/a.length},median:function(a){var b,d=a.length;return d>1?(a.sort(function(a,b){return a-b}),b=Math.floor(d/2),d%2?a[b]:(a[b-1]+a[b])/2):c.invalid("median",1)},mode:function(a){var b,c,d,e={},f=1,g=[a[0]];for(b=0;b<a.length;b++)c=a[b],e[c]=e[c]?e[c]+1:1,d=e[c],d>f?(g=[c],f=d):d===f&&(g.push(c),f=d);return g.sort(function(a,b){return a-b})},max:function(a){return Math.max.apply(Math,a)},min:function(a){return Math.min.apply(Math,a)},range:function(a){var b=a.sort(function(a,b){return a-b});return b[a.length-1]-b[0]},variance:function(a,d){for(var e,f=b.equations.mean(a),g=0,h=a.length;h--;)g+=Math.pow(a[h]-f,2);return e=a.length-(d?0:1),0===e?c.invalid("variance",0):g/=e},varp:function(a){return b.equations.variance(a,!0)},vars:function(a){return b.equations.variance(a)},stdevs:function(a){var c=b.equations.variance(a);return Math.sqrt(c)},stdevp:function(a){var c=b.equations.variance(a,!0);return Math.sqrt(c)}},b.addWidget({id:"math",priority:100,options:{math_data:"math",math_ignore:[],math_mask:"#,##0.00",math_complete:null,math_priority:["row","above","col"],math_prefix:"",math_suffix:"",math_event:"recalculate"},init:function(a,d,e,f){var g=b.hasWidget(a,"filter")?"filterEnd":"updateComplete";e.$table.off((c.events+" updateComplete.tsmath "+f.math_event).replace(/\s+/g," ")).on(c.events+" "+f.math_event,function(a){var d="tablesorter-initialized"===a.type;(!f.math_isUpdating||d)&&(/filter/.test(a.type)||b.computeColumnIndex(e.$table.children("tbody").children()),c.recalculate(e,f,d))}).on(g+".tsmath",function(){setTimeout(function(){f.math_isUpdating&&e.debug&&console.groupEnd&&console.groupEnd(),f.math_isUpdating=!1},40)}),f.math_isUpdating=!1},remove:function(a,b,d,e){e||b.$table.off((c.events+" updateComplete.tsmath "+d.math_event).replace(/\s+/g," ")).find("[data-"+d.math_data+"]").empty()}})}(jQuery);

View File

@ -1,2 +1,2 @@
/*! Widget: sort2Hash - updated 7/28/2015 (v2.22.4) */
!function(a){"use strict";var b=a.tablesorter||{},c={init:function(a,d){var e=b.hasWidget(a.table,"saveSort"),f=c.getSort(a,d);(f&&!e||f&&e&&d.sort2Hash_overrideSaveSort)&&c.processHash(a,d,f),a.$table.on("sortEnd.sort2hash",function(){c.setHash(a,d)})},getTableId:function(b,c){return c.sort2Hash_tableId||b.table.id||"table"+a("table").index(b.$table)},getSort:function(a,b,d){var e,f=c.getTableId(a,b).replace(/[\[]/,"\\[").replace(/[\]]/,"\\]"),g=new RegExp("[\\#&]"+f+"=([^&]*)").exec(window.location.hash);return null===g?"":(e=c.processSort(a,b,g[1]),d?(window.location.hash=window.location.hash.replace("&"+f+"="+g[1],""),e):g[1])},processHash:function(a,b,c){for(var d,e,f,g,h=decodeURI(c||"").split(b.sort2Hash_separator),i=0,j=h.length,k=[];j>i;)e=h[i++],g=parseInt(e,10),(isNaN(g)||g>a.columns)&&(d=new RegExp("("+e+")","i"),e=a.$headers.filter(function(b,c){return d.test(a.$headers[b].textContent||"")}).attr("data-column")),f=h[i++],"undefined"!=typeof f&&(isNaN(f)&&(f=f.indexOf(b.sort2Hash_directionText[1])>-1?1:0),k.push([e,f]));k.length&&(a.sortList=k)},processSort:function(b,c){var d,e,f,g,h=[],i=b.sortList||[],j=i.length;for(d=0;j>d;d++)f=i[d][0],c.sort2Hash_useHeaderText&&(e=a.trim(b.$headerIndexed[f].text()),"function"==typeof c.sort2Hash_processHeaderText&&(e=c.sort2Hash_processHeaderText(e,b,f)),f=e),h.push(f),g=c.sort2Hash_directionText[i[d][1]],h.push(g);return h.join(c.sort2Hash_separator)},setHash:function(a,b){var d=c.processSort(a,b);d.length&&(c.getSort(a,b,!0),window.location.hash+=(window.location.hash.length?"":b.sort2Hash_hash)+"&"+c.getTableId(a,b)+"="+encodeURI(d))}};b.addWidget({id:"sort2Hash",priority:30,options:{sort2Hash_hash:"#",sort2Hash_separator:"-",sort2Hash_tableId:null,sort2Hash_useHeaderText:!1,sort2Hash_processHeaderText:null,sort2Hash_directionText:[0,1],sort2Hash_overrideSaveSort:!1},init:function(a,b,d,e){c.init(d,e)},remove:function(a,b){b.$table.off("sortEnd.sort2hash")}})}(jQuery);
!function(a){"use strict";var b=a.tablesorter||{},c={init:function(a,d){var e=b.hasWidget(a.table,"saveSort"),f=c.getSort(a,d);(f&&!e||f&&e&&d.sort2Hash_overrideSaveSort)&&c.processHash(a,d,f),a.$table.on("sortEnd.sort2hash",function(){c.setHash(a,d)})},getTableId:function(b,c){return c.sort2Hash_tableId||b.table.id||"table"+a("table").index(b.$table)},getSort:function(a,b,d){var e,f=c.getTableId(a,b).replace(/[\[]/,"\\[").replace(/[\]]/,"\\]"),g=new RegExp("[\\#&]"+f+"=([^&]*)").exec(window.location.hash);return null===g?"":(e=c.processSort(a,b,g[1]),d?(window.location.hash=window.location.hash.replace("&"+f+"="+g[1],""),e):g[1])},processHash:function(a,b,c){for(var d,e,f,g,h=decodeURI(c||"").split(b.sort2Hash_separator),i=0,j=h.length,k=[];j>i;)e=h[i++],g=parseInt(e,10),(isNaN(g)||g>a.columns)&&(d=new RegExp("("+e+")","i"),e=a.$headers.filter(function(b){return d.test(a.$headers[b].textContent||"")}).attr("data-column")),f=h[i++],"undefined"!=typeof f&&(isNaN(f)&&(f=f.indexOf(b.sort2Hash_directionText[1])>-1?1:0),k.push([e,f]));k.length&&(a.sortList=k)},processSort:function(b,c){var d,e,f,g,h=[],i=b.sortList||[],j=i.length;for(d=0;j>d;d++)f=i[d][0],c.sort2Hash_useHeaderText&&(e=a.trim(b.$headerIndexed[f].text()),"function"==typeof c.sort2Hash_processHeaderText&&(e=c.sort2Hash_processHeaderText(e,b,f)),f=e),h.push(f),g=c.sort2Hash_directionText[i[d][1]],h.push(g);return h.join(c.sort2Hash_separator)},setHash:function(a,b){var d=c.processSort(a,b);d.length&&(c.getSort(a,b,!0),window.location.hash+=(window.location.hash.length?"":b.sort2Hash_hash)+"&"+c.getTableId(a,b)+"="+encodeURI(d))}};b.addWidget({id:"sort2Hash",priority:30,options:{sort2Hash_hash:"#",sort2Hash_separator:"-",sort2Hash_tableId:null,sort2Hash_useHeaderText:!1,sort2Hash_processHeaderText:null,sort2Hash_directionText:[0,1],sort2Hash_overrideSaveSort:!1},init:function(a,b,d,e){c.init(d,e)},remove:function(a,b){b.$table.off("sortEnd.sort2hash")}})}(jQuery);

View File

@ -35,7 +35,7 @@
* @contributor Rob Garrison - https://github.com/Mottie/tablesorter
*/
/*jshint browser:true, jquery:true, unused:false, expr: true */
/*global console:false, alert:false, require:false, define:false, module:false */
/*global console:false */
;(function($){
'use strict';
$.extend({
@ -2250,6 +2250,7 @@
})(jQuery);
/*! Widget: storage - updated 3/26/2015 (v2.21.3) */
/*global JSON:false */
;(function ($, window, document) {
'use strict';
@ -2711,7 +2712,7 @@
types: {
or : function( c, data, vars ) {
if ( /\|/.test( data.iFilter ) || ts.filter.regex.orSplit.test( data.filter ) ) {
var indx, filterMatched, txt, query, regex,
var indx, filterMatched, query, regex,
// duplicate data but split filter
data2 = $.extend( {}, data ),
index = data.index,
@ -2746,7 +2747,7 @@
// Look for an AND or && operator ( logical and )
and : function( c, data, vars ) {
if ( ts.filter.regex.andTest.test( data.filter ) ) {
var indx, filterMatched, result, txt, query, regex,
var indx, filterMatched, result, query, regex,
// duplicate data but split filter
data2 = $.extend( {}, data ),
index = data.index,

View File

@ -17,7 +17,7 @@
* @contributor Rob Garrison - https://github.com/Mottie/tablesorter
*/
/*jshint browser:true, jquery:true, unused:false, expr: true */
/*global console:false, alert:false, require:false, define:false, module:false */
/*global console:false */
;(function($){
'use strict';
$.extend({

View File

@ -17,6 +17,7 @@
}(function($) {
/*! Widget: storage - updated 3/26/2015 (v2.21.3) */
/*global JSON:false */
;(function ($, window, document) {
'use strict';
@ -478,7 +479,7 @@
types: {
or : function( c, data, vars ) {
if ( /\|/.test( data.iFilter ) || ts.filter.regex.orSplit.test( data.filter ) ) {
var indx, filterMatched, txt, query, regex,
var indx, filterMatched, query, regex,
// duplicate data but split filter
data2 = $.extend( {}, data ),
index = data.index,
@ -513,7 +514,7 @@
// Look for an AND or && operator ( logical and )
and : function( c, data, vars ) {
if ( ts.filter.regex.andTest.test( data.filter ) ) {
var indx, filterMatched, result, txt, query, regex,
var indx, filterMatched, result, query, regex,
// duplicate data but split filter
data2 = $.extend( {}, data ),
index = data.index,

View File

@ -2,6 +2,7 @@
/* Extract localized data using jQuery's Globalize parsers; set
Globalize.locale( 'xx' ) prior to initializing tablesorter! */
/*jshint jquery:true */
/*global Globalize:false */
;( function( $ ) {
'use strict';

View File

@ -29,13 +29,14 @@
return ts.regex.ipv6Validate.test(s);
},
format: function(address, table) {
// code modified from http://forrst.com/posts/JS_Expand_Abbreviated_IPv6_Addresses-1OR
// code modified from http://zurb.com/forrst/posts/JS_Expand_Abbreviated_IPv6_Addresses-1OR
// Saved to https://gist.github.com/Mottie/7018157
var i, t, sides, groups, groupsPresent,
hex = table ? (typeof table === 'boolean' ? table : table && table.config.ipv6HexFormat || false) : false,
fullAddress = '',
expandedAddress = '',
validGroupCount = 8,
validGroupSize = 4;
validGroupCount = 8;
// validGroupSize = 4; <- removed while loop
// remove any extra spaces
address = address.replace(/\s*/g, '');
// look for embedded ipv4
@ -112,7 +113,7 @@
*/
ts.addParser({
id : 'MAC',
is : function( str ) {
is : function() {
return false;
},
format : function( str ) {

View File

@ -105,7 +105,7 @@
types: {
or : function( c, data, vars ) {
if ( /\|/.test( data.iFilter ) || ts.filter.regex.orSplit.test( data.filter ) ) {
var indx, filterMatched, txt, query, regex,
var indx, filterMatched, query, regex,
// duplicate data but split filter
data2 = $.extend( {}, data ),
index = data.index,
@ -140,7 +140,7 @@
// Look for an AND or && operator ( logical and )
and : function( c, data, vars ) {
if ( ts.filter.regex.andTest.test( data.filter ) ) {
var indx, filterMatched, result, txt, query, regex,
var indx, filterMatched, result, query, regex,
// duplicate data but split filter
data2 = $.extend( {}, data ),
index = data.index,

View File

@ -40,8 +40,7 @@
// get all of the row numerical values in an arry
getRow : function( c, $el ) {
var $t, txt,
wo = c.widgetOptions,
var wo = c.widgetOptions,
arry = [],
$row = $el.closest( 'tr' ),
$cells = $row.children().not( '[' + wo.math_dataAttrib + '=ignore]' );
@ -58,7 +57,7 @@
// get all of the column numerical values in an arry
getColumn : function( c, $el, type ) {
var index, txt, $t, len, $mathRows, mathAbove,
var index, $t, len, $mathRows, mathAbove,
arry = [],
wo = c.widgetOptions,
filtered = wo.filter_filteredRow || 'filtered',
@ -104,7 +103,7 @@
// get all of the column numerical values in an arry
getAll : function( c ) {
var txt, $t, col, $row, rowIndex, rowLen, $cells, cellIndex, cellLen,
var $t, col, $row, rowIndex, rowLen, $cells, cellIndex, cellLen,
arry = [],
wo = c.widgetOptions,
filtered = wo.filter_filteredRow || 'filtered',
@ -128,7 +127,7 @@
return arry;
},
recalculate : function(table, c, wo, init) {
recalculate : function(c, wo, init) {
if ( c && ( !wo.math_isUpdating || init ) ) {
// add data-column attributes to all table cells
@ -315,7 +314,7 @@
str += integer.charAt( index ); // ie6 only support charAt for sz.
// -posSeparator so that won't trail separator on full length
/*jshint -W018 */
if ( !( ( index - offset + 1 ) % posSeparator ) && index < l - posSeparator ) {
if ( !( ( index - offset + 1 ) % posSeparator ) && index < len - posSeparator ) {
str += group;
}
}
@ -456,7 +455,7 @@
// redo data-column indexes on update
ts.computeColumnIndex( c.$table.children('tbody').children() );
}
math.recalculate( table, c, wo, init );
math.recalculate( c, wo, init );
}
})
.on( update + '.tsmath', function() {

View File

@ -5,7 +5,7 @@
* Download-File-JS: https://github.com/PixelsCommander/Download-File-JS (http://www.apache.org/licenses/LICENSE-2.0)
*/
/*jshint browser:true, jquery:true, unused:false */
/*global jQuery: false */
/*global jQuery:false, alert:false */
;(function($){
'use strict';

View File

@ -50,7 +50,7 @@
// just see if column contains a number
if ( isNaN( temp ) || temp > c.columns ) {
regex = new RegExp( '(' + column + ')', 'i' );
column = c.$headers.filter( function( index, cell ) {
column = c.$headers.filter( function( index ) {
return regex.test( c.$headers[ index ].textContent || '' );
}).attr( 'data-column' );
}
@ -94,8 +94,7 @@
return sort.join( wo.sort2Hash_separator );
},
setHash : function( c, wo ) {
var arry = [],
sort = s2h.processSort( c, wo );
var sort = s2h.processSort( c, wo );
if ( sort.length ) {
// remove old hash
s2h.getSort( c, wo, true );

View File

@ -1,4 +1,5 @@
/*! Widget: storage - updated 3/26/2015 (v2.21.3) */
/*global JSON:false */
;(function ($, window, document) {
'use strict';