Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

tablesort

Package Overview
Dependencies
Maintainers
1
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tablesort - npm Package Compare versions

Comparing version 2.2.2 to 2.2.3

2

bower.json
{
"name": "tablesort",
"description": "A sorting component for HTML tables",
"version": "2.2.2",
"version": "2.2.3",
"license": "MIT",

@@ -6,0 +6,0 @@ "main": "tablesort.min.js",

{
"name": "tablesort",
"description": "A sorting component for HTML tables",
"version": "2.2.2",
"version": "2.2.3",
"author": "tristen <@fallsemo>",

@@ -10,3 +10,3 @@ "ender": "./ender.js",

"scripts": {
"test": "tape test/test.client.js"
"test": "tape test/test.client.js | tap-spec"
},

@@ -28,4 +28,5 @@ "repository": {

"serve-static": "1.6.x",
"tap-spec": "^2.2.0",
"tape": "^3.0.0"
}
}

@@ -327,3 +327,7 @@ ;(function() {

// ELEMENT_NODE
str += that.getInnerText(cs[i]);
if (cs[i].tagName === 'IMG') {
str += (cs[i].alt || cs[i].title || "");
} else {
str += that.getInnerText(cs[i]);
}
break;

@@ -330,0 +334,0 @@ case 3:

/*!
* tablesort v2.2.2 (2015-02-01)
* tablesort v2.2.3 (2015-02-01)
* http://tristen.ca/tablesort/demo
* Copyright (c) 2015 ; Licensed MIT
*/!function(){function a(a,b){if(!a)throw new Error("Element not found");if("TABLE"!==a.tagName)throw new Error("Element must be a table");this.init(a,b||{})}a.prototype={init:function(a,d){var e,f=this;if(this.thead=!1,this.options=d,a.rows&&a.rows.length>0&&(a.tHead&&a.tHead.rows.length>0?(e=a.tHead.rows[a.tHead.rows.length-1],f.thead=!0):e=a.rows[0]),e){for(var g,h=function(){f.current&&f.current!==this&&(f.current.classList.contains(b)?f.current.classList.remove(b):f.current.classList.contains(c)&&f.current.classList.remove(c)),f.current=this,f.sortTable(this)},i=0;i<e.cells.length;i++){var j=e.cells[i];j.classList.contains("no-sort")||(j.classList.add("sort-header"),j.addEventListener("click",h,!1),j.classList.contains("sort-default")&&(g=j))}g&&(f.current=g,f.sortTable(g,!0))}},getFirstDataRowIndex:function(){return this.thead?0:1},sortTable:function(a,d){var e,f=this,p=a.cellIndex,q=l(a,"table"),r="",s=[],t=f.getFirstDataRowIndex();if(!(q.rows.length<=1)){for(;s.length<3&&t<q.tBodies[0].rows.length;)r=m(q.tBodies[0].rows[t].cells[p]),r=r.trim(),"<!--"!==r.substr(0,4)&&0!==r.length&&s.push(r),t++;if(s){var u=function(a,b){var c=m(a.cells[f.col]).toLowerCase(),d=m(b.cells[f.col]).toLowerCase();return c===d?0:d>c?1:-1},v=function(a,b){var c=m(a.cells[f.col]),d=m(b.cells[f.col]);return c=o(c),d=o(d),n(d,c)},w=function(a,b){var c=m(a.cells[f.col]).toLowerCase(),d=m(b.cells[f.col]).toLowerCase();return k(d)-k(c)},x=function(a,b){for(var c=m(a.cells[f.col]).split("."),d=m(b.cells[f.col]).split("."),e=0,g=c.length;g>e;e++){var h=parseInt(c[e]),i=parseInt(d[e]);if(h!=i){if(h>i)return-1;if(i>h)return 1}}return 0},y=function(a,b){var c=filesize2num(m(a.cells[f.col]));return bb=filesize2num(m(b.cells[f.col])),n(bb,c)};e=s.every(g)?x:s.every(h)?y:s.every(i)?v:s.every(j)?w:u,this.col=p;var z,A=[],B={},C=0;for(t=0;t<q.tBodies.length;t++)for(z=0;z<q.tBodies[t].rows.length;z++){var D=q.tBodies[t].rows[z];D.classList.contains("no-sort")?B[C]=D:A.push({tr:D,index:C}),C++}var E=f.options.descending?c:b,F=f.options.descending?b:c;d?a.classList.contains(E)||a.classList.contains(F)||a.classList.add(E):a.classList.contains(E)?(a.classList.remove(E),a.classList.add(F)):(a.classList.remove(F),a.classList.add(E));var G=function(a){return function(b,c){var d=a(b.tr,c.tr);return 0===d?b.index-c.index:d}},H=function(a){return function(b,c){var d=a(b.tr,c.tr);return 0===d?c.index-b.index:d}};a.classList.contains(c)?(A.sort(H(e)),A.reverse()):A.sort(G(e));var I=0;for(t=0;C>t;t++){var J;B[t]?(J=B[t],I++):J=A[t-I].tr,q.tBodies[0].appendChild(J)}f.options.callback&&"function"==typeof f.options.callback&&f.options.callback(a)}}},refresh:function(){void 0!==this.current&&this.sortTable(this.current,!0)}};var b="sort-up",c="sort-down",d=/(Mon|Tue|Wed|Thu|Fri|Sat|Sun)\.?\,?\s*/i,e=/\d{1,2}[\/\-]\d{1,2}[\/\-]\d{2,4}/,f=/(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)/i,g=function(a){return/^(\d+\.)+\d+$/.test(a)},h=function(a){return/^\d+(\.\d+)? ?(k|M|G|T|P|E|Z|Y)?i?B?$/i.test(a)},i=function(a){return a.match(/^-?[£\x24Û¢´€]?\d+\s*([,\.]\d{0,2})/)||a.match(/^-?\d+\s*([,\.]\d{0,2})?[£\x24Û¢´€]/)||a.match(/^-?(\d)*-?([,\.]){0,1}-?(\d)+([E,e][\-+][\d]+)?%?$/)},j=function(a){return-1!==(-1!==a.search(d)||-1!==a.search(e)||a.search(-1!==f))&&!isNaN(k(a))},k=function(a){return a=a.replace(/\-/g,"/"),a=a.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{2})/,"$1/$2/$3"),new Date(a).getTime()},l=function(a,b){return null===a?null:1===a.nodeType&&a.tagName.toLowerCase()===b.toLowerCase()?a:l(a.parentNode,b)},m=function(a){var b=this;if("string"==typeof a||"undefined"==typeof a)return a;var c=a.getAttribute("data-sort")||"";if(c)return c;if(a.textContent)return a.textContent;if(a.innerText)return a.innerText;for(var d=a.childNodes,e=d.length,f=0;e>f;f++)switch(d[f].nodeType){case 1:c+=b.getInnerText(d[f]);break;case 3:c+=d[f].nodeValue}return c},n=function(a,b){var c=parseFloat(a),d=parseFloat(b);return a=isNaN(c)?0:c,b=isNaN(d)?0:d,a-b},o=function(a){return a.replace(/[^\-?0-9.]/g,"")};filesize2num=function(a){var b=a.match(/^(\d+(\.\d+)?) ?((k|M|G|T|P|E|Z|Y)?i?B?)$/i),c=parseFloat(o(b[1])),d=b[3];return c*suffix2num(d)},suffix2num=function(a){a=a.toLowerCase();var b="i"===a[1]?1024:1e3;switch(a[0]){case"k":return Math.pow(b,2);case"m":return Math.pow(b,3);case"g":return Math.pow(b,4);case"t":return Math.pow(b,5);case"p":return Math.pow(b,6);case"e":return Math.pow(b,7);case"z":return Math.pow(b,8);case"y":return Math.pow(b,9);default:return b}},"undefined"!=typeof module&&module.exports?module.exports=a:window.Tablesort=a}();
*/!function(){function a(a,b){if(!a)throw new Error("Element not found");if("TABLE"!==a.tagName)throw new Error("Element must be a table");this.init(a,b||{})}a.prototype={init:function(a,d){var e,f=this;if(this.thead=!1,this.options=d,a.rows&&a.rows.length>0&&(a.tHead&&a.tHead.rows.length>0?(e=a.tHead.rows[a.tHead.rows.length-1],f.thead=!0):e=a.rows[0]),e){for(var g,h=function(){f.current&&f.current!==this&&(f.current.classList.contains(b)?f.current.classList.remove(b):f.current.classList.contains(c)&&f.current.classList.remove(c)),f.current=this,f.sortTable(this)},i=0;i<e.cells.length;i++){var j=e.cells[i];j.classList.contains("no-sort")||(j.classList.add("sort-header"),j.addEventListener("click",h,!1),j.classList.contains("sort-default")&&(g=j))}g&&(f.current=g,f.sortTable(g,!0))}},getFirstDataRowIndex:function(){return this.thead?0:1},sortTable:function(a,d){var e,f=this,p=a.cellIndex,q=l(a,"table"),r="",s=[],t=f.getFirstDataRowIndex();if(!(q.rows.length<=1)){for(;s.length<3&&t<q.tBodies[0].rows.length;)r=m(q.tBodies[0].rows[t].cells[p]),r=r.trim(),"<!--"!==r.substr(0,4)&&0!==r.length&&s.push(r),t++;if(s){var u=function(a,b){var c=m(a.cells[f.col]).toLowerCase(),d=m(b.cells[f.col]).toLowerCase();return c===d?0:d>c?1:-1},v=function(a,b){var c=m(a.cells[f.col]),d=m(b.cells[f.col]);return c=o(c),d=o(d),n(d,c)},w=function(a,b){var c=m(a.cells[f.col]).toLowerCase(),d=m(b.cells[f.col]).toLowerCase();return k(d)-k(c)},x=function(a,b){for(var c=m(a.cells[f.col]).split("."),d=m(b.cells[f.col]).split("."),e=0,g=c.length;g>e;e++){var h=parseInt(c[e]),i=parseInt(d[e]);if(h!=i){if(h>i)return-1;if(i>h)return 1}}return 0},y=function(a,b){var c=filesize2num(m(a.cells[f.col]));return bb=filesize2num(m(b.cells[f.col])),n(bb,c)};e=s.every(g)?x:s.every(h)?y:s.every(i)?v:s.every(j)?w:u,this.col=p;var z,A=[],B={},C=0;for(t=0;t<q.tBodies.length;t++)for(z=0;z<q.tBodies[t].rows.length;z++){var D=q.tBodies[t].rows[z];D.classList.contains("no-sort")?B[C]=D:A.push({tr:D,index:C}),C++}var E=f.options.descending?c:b,F=f.options.descending?b:c;d?a.classList.contains(E)||a.classList.contains(F)||a.classList.add(E):a.classList.contains(E)?(a.classList.remove(E),a.classList.add(F)):(a.classList.remove(F),a.classList.add(E));var G=function(a){return function(b,c){var d=a(b.tr,c.tr);return 0===d?b.index-c.index:d}},H=function(a){return function(b,c){var d=a(b.tr,c.tr);return 0===d?c.index-b.index:d}};a.classList.contains(c)?(A.sort(H(e)),A.reverse()):A.sort(G(e));var I=0;for(t=0;C>t;t++){var J;B[t]?(J=B[t],I++):J=A[t-I].tr,q.tBodies[0].appendChild(J)}f.options.callback&&"function"==typeof f.options.callback&&f.options.callback(a)}}},refresh:function(){void 0!==this.current&&this.sortTable(this.current,!0)}};var b="sort-up",c="sort-down",d=/(Mon|Tue|Wed|Thu|Fri|Sat|Sun)\.?\,?\s*/i,e=/\d{1,2}[\/\-]\d{1,2}[\/\-]\d{2,4}/,f=/(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)/i,g=function(a){return/^(\d+\.)+\d+$/.test(a)},h=function(a){return/^\d+(\.\d+)? ?(k|M|G|T|P|E|Z|Y)?i?B?$/i.test(a)},i=function(a){return a.match(/^-?[£\x24Û¢´€]?\d+\s*([,\.]\d{0,2})/)||a.match(/^-?\d+\s*([,\.]\d{0,2})?[£\x24Û¢´€]/)||a.match(/^-?(\d)*-?([,\.]){0,1}-?(\d)+([E,e][\-+][\d]+)?%?$/)},j=function(a){return-1!==(-1!==a.search(d)||-1!==a.search(e)||a.search(-1!==f))&&!isNaN(k(a))},k=function(a){return a=a.replace(/\-/g,"/"),a=a.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{2})/,"$1/$2/$3"),new Date(a).getTime()},l=function(a,b){return null===a?null:1===a.nodeType&&a.tagName.toLowerCase()===b.toLowerCase()?a:l(a.parentNode,b)},m=function(a){var b=this;if("string"==typeof a||"undefined"==typeof a)return a;var c=a.getAttribute("data-sort")||"";if(c)return c;if(a.textContent)return a.textContent;if(a.innerText)return a.innerText;for(var d=a.childNodes,e=d.length,f=0;e>f;f++)switch(d[f].nodeType){case 1:c+="IMG"===d[f].tagName?d[f].alt||d[f].title||"":b.getInnerText(d[f]);break;case 3:c+=d[f].nodeValue}return c},n=function(a,b){var c=parseFloat(a),d=parseFloat(b);return a=isNaN(c)?0:c,b=isNaN(d)?0:d,a-b},o=function(a){return a.replace(/[^\-?0-9.]/g,"")};filesize2num=function(a){var b=a.match(/^(\d+(\.\d+)?) ?((k|M|G|T|P|E|Z|Y)?i?B?)$/i),c=parseFloat(o(b[1])),d=b[3];return c*suffix2num(d)},suffix2num=function(a){a=a.toLowerCase();var b="i"===a[1]?1024:1e3;switch(a[0]){case"k":return Math.pow(b,2);case"m":return Math.pow(b,3);case"g":return Math.pow(b,4);case"t":return Math.pow(b,5);case"p":return Math.pow(b,6);case"e":return Math.pow(b,7);case"z":return Math.pow(b,8);case"y":return Math.pow(b,9);default:return b}},"undefined"!=typeof module&&module.exports?module.exports=a:window.Tablesort=a}();
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc