From b41acc62b26cef681fcd6054906fe06d075612c8 Mon Sep 17 00:00:00 2001 From: Adam Schwartz Date: Mon, 2 Dec 2013 23:08:43 -0500 Subject: [PATCH] v0.5.0 --- bower.json | 2 +- component.json | 2 +- js/sortable.min.js | 2 +- package.json | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/bower.json b/bower.json index ec410b9..4207428 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "sortable", - "version": "0.4.1", + "version": "0.5.0", "homepage": "http://adamschwartz.co/sortable", "authors": [ "Adam Schwartz " diff --git a/component.json b/component.json index 296372c..4777889 100644 --- a/component.json +++ b/component.json @@ -2,7 +2,7 @@ "name": "sortable", "repo": "adamschwartz/sortable", "description": "The simplest, most elegant way to sort a table.", - "version": "0.4.1", + "version": "0.5.0", "homepage": "http://adamschwartz.co/sortable", "license": "MIT", "keywords": [ diff --git a/js/sortable.min.js b/js/sortable.min.js index e64f552..242074c 100644 --- a/js/sortable.min.js +++ b/js/sortable.min.js @@ -1,2 +1,2 @@ -/*! sortable.js 0.4.1 */ +/*! sortable.js 0.5.0 */ (function(){var a,b,c,d,e,f;a="table[data-sortable]",c=/^-?[£$¤]?[\d,.]+%?$/,f=/^\s+|\s+$/g,e="ontouchstart"in document.documentElement,b=e?"touchstart":"click",d={init:function(){var b,c,e,f,g;for(c=document.querySelectorAll(a),g=[],e=0,f=c.length;f>e;e++)b=c[e],g.push(d.initTable(b));return g},initTable:function(a){var b,c,e,f,g;if(1===a.tHead.rows.length&&"true"!==a.getAttribute("data-sortable-initialized")){for(a.setAttribute("data-sortable-initialized","true"),e=a.querySelectorAll("th"),b=f=0,g=e.length;g>f;b=++f)c=e[b],"false"!==c.getAttribute("data-sortable")&&d.setupClickableTH(a,c,b);return a}},setupClickableTH:function(a,c,e){var f;return f=d.getColumnType(a,e),c.addEventListener(b,function(){var b,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u;for(j="true"===this.getAttribute("data-sorted"),k=this.getAttribute("data-sorted-direction"),b=j?"ascending"===k?"descending":"ascending":f.defaultSortDirection,m=this.parentNode.querySelectorAll("th"),n=0,q=m.length;q>n;n++)c=m[n],c.setAttribute("data-sorted","false"),c.removeAttribute("data-sorted-direction");for(this.setAttribute("data-sorted","true"),this.setAttribute("data-sorted-direction",b),l=a.tBodies[0],h=[],t=l.rows,o=0,r=t.length;r>o;o++)g=t[o],h.push([d.getNodeValue(g.cells[e]),g]);for(j?h.reverse():h.sort(f.compare),u=[],p=0,s=h.length;s>p;p++)i=h[p],u.push(l.appendChild(i[1]));return u})},getColumnType:function(a,b){var e,f,g,h,i;for(i=a.tBodies[0].rows,g=0,h=i.length;h>g;g++)if(e=i[g],f=d.getNodeValue(e.cells[b]),""!==f&&f.match(c))return d.types.numeric;return d.types.alpha},getNodeValue:function(a){return a?null!==a.getAttribute("data-value")?a.getAttribute("data-value"):"undefined"!=typeof a.innerText?a.innerText.replace(f,""):a.textContent.replace(f,""):""},types:{numeric:{defaultSortDirection:"descending",compare:function(a,b){var c,d;return c=parseFloat(a[0].replace(/[^0-9.-]/g,"")),d=parseFloat(b[0].replace(/[^0-9.-]/g,"")),isNaN(c)&&(c=0),isNaN(d)&&(d=0),d-c}},alpha:{defaultSortDirection:"ascending",compare:function(a,b){var c,d;return c=a[0].toLowerCase(),d=b[0].toLowerCase(),c===d?0:d>c?-1:1}}}},setTimeout(d.init,0),window.Sortable=d}).call(this); \ No newline at end of file diff --git a/package.json b/package.json index 4c97561..e99c7b1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "sortable", - "version": "0.4.1", + "version": "0.5.0", "description": "The simplest, most elegant way to sort a table.", "author": "Adam Schwartz ", "license": "MIT", @@ -9,7 +9,7 @@ "coffee-script": "~1.6.3", "grunt-contrib-uglify": "~0.2.4", "grunt-cli": "~0.1.9", - "grunt": "~0.4.1", + "grunt": "~0.5.0", "grunt-contrib-watch": "~0.5.3", "grunt-contrib-compass": "~0.5.0" }