Changeset 1610851
- Timestamp:
- 03/08/2017 07:46:48 PM (9 years ago)
- Location:
- tags-page/trunk
- Files:
-
- 4 edited
-
js/webtoolkit.sortabletable.js (modified) (1 diff)
-
js/webtoolkit.sortabletable.min.js (modified) (1 diff)
-
readme.txt (modified) (2 diffs)
-
tags-page.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
tags-page/trunk/js/webtoolkit.sortabletable.js
r1604010 r1610851 106 106 107 107 initSorting(this.thead); 108 initSorting(this.tfoot); 108 if (this.tfoot.length > 0) 109 initSorting(this.tfoot); 109 110 } -
tags-page/trunk/js/webtoolkit.sortabletable.min.js
r1604010 r1610851 1 function SortableTable(d){function e(a){if(a&&a[0].rows&&0<a[0].rows.length){a=a[0].rows[0];for(var b=0;b<a.cells.length;b++)a.cells[b].sTable=this,a.cells[b].onclick=function(){this.sTable.sort(this);return!1}}}this.tbody=d.getElementsByTagName("tbody");this.thead=d.getElementsByTagName("thead");this.tfoot=d.getElementsByTagName("tfoot");this.getInnerText=function(a){if("undefined"!=typeof a.textContent)return a.textContent;if("undefined"!=typeof a.innerText)return a.innerText;if("string"==typeof a.innerHTML)return a.innerHTML.replace(/<[^<>]+>/g,"")};this.getParent=function(a,b){return null==a?null:1==a.nodeType&&a.tagName.toLowerCase()==b.toLowerCase()?a:this.getParent(a.parentNode,b)};this.sort=function(a){var b=a.cellIndex,c=this.getInnerText(this.tbody[0].rows[1].cells[b]),d=this.sortCaseInsensitive;c.match(/\d\d[-]+\d\d[-]+\d\d\d\d/)&&(d=this.sortDate);c.replace(/^\s+|\s+$/g,"").match(/^[\d\.]+$/)&&(d=this.sortNumeric);this.sortColumnIndex=b;b=[];for(j=0;j<this.tbody[0].rows.length;j++)b[j]=this.tbody[0].rows[j];b.sort(d);"down"==a.getAttribute("sortdir")?(b.reverse(),a.setAttribute("sortdir","up")):a.setAttribute("sortdir","down");for(i=0;i<b.length;i++)this.tbody[0].appendChild(b[i])};this.sortCaseInsensitive=function(a,b){aa=c.getInnerText(a.cells[c.sortColumnIndex]).toLowerCase();bb=c.getInnerText(b.cells[c.sortColumnIndex]).toLowerCase();return aa==bb?0:aa<bb?-1:1};this.sortDate=function(a,b){aa=c.getInnerText(a.cells[c.sortColumnIndex]);bb=c.getInnerText(b.cells[c.sortColumnIndex]);date1=aa.substr(6,4)+aa.substr(3,2)+aa.substr(0,2);date2=bb.substr(6,4)+bb.substr(3,2)+bb.substr(0,2);return date1==date2?0:date1<date2?-1:1};this.sortNumeric=function(a,b){aa=parseFloat(c.getInnerText(a.cells[c.sortColumnIndex]));isNaN(aa)&&(aa=0);bb=parseFloat(c.getInnerText(b.cells[c.sortColumnIndex]));isNaN(bb)&&(bb=0);return aa-bb};var c=this;this.tbody&&this.tbody[0].rows&&0<this.tbody[0].rows.length&&(e(this.thead), e(this.tfoot))};1 function SortableTable(d){function e(a){if(a&&a[0].rows&&0<a[0].rows.length){a=a[0].rows[0];for(var b=0;b<a.cells.length;b++)a.cells[b].sTable=this,a.cells[b].onclick=function(){this.sTable.sort(this);return!1}}}this.tbody=d.getElementsByTagName("tbody");this.thead=d.getElementsByTagName("thead");this.tfoot=d.getElementsByTagName("tfoot");this.getInnerText=function(a){if("undefined"!=typeof a.textContent)return a.textContent;if("undefined"!=typeof a.innerText)return a.innerText;if("string"==typeof a.innerHTML)return a.innerHTML.replace(/<[^<>]+>/g,"")};this.getParent=function(a,b){return null==a?null:1==a.nodeType&&a.tagName.toLowerCase()==b.toLowerCase()?a:this.getParent(a.parentNode,b)};this.sort=function(a){var b=a.cellIndex,c=this.getInnerText(this.tbody[0].rows[1].cells[b]),d=this.sortCaseInsensitive;c.match(/\d\d[-]+\d\d[-]+\d\d\d\d/)&&(d=this.sortDate);c.replace(/^\s+|\s+$/g,"").match(/^[\d\.]+$/)&&(d=this.sortNumeric);this.sortColumnIndex=b;b=[];for(j=0;j<this.tbody[0].rows.length;j++)b[j]=this.tbody[0].rows[j];b.sort(d);"down"==a.getAttribute("sortdir")?(b.reverse(),a.setAttribute("sortdir","up")):a.setAttribute("sortdir","down");for(i=0;i<b.length;i++)this.tbody[0].appendChild(b[i])};this.sortCaseInsensitive=function(a,b){aa=c.getInnerText(a.cells[c.sortColumnIndex]).toLowerCase();bb=c.getInnerText(b.cells[c.sortColumnIndex]).toLowerCase();return aa==bb?0:aa<bb?-1:1};this.sortDate=function(a,b){aa=c.getInnerText(a.cells[c.sortColumnIndex]);bb=c.getInnerText(b.cells[c.sortColumnIndex]);date1=aa.substr(6,4)+aa.substr(3,2)+aa.substr(0,2);date2=bb.substr(6,4)+bb.substr(3,2)+bb.substr(0,2);return date1==date2?0:date1<date2?-1:1};this.sortNumeric=function(a,b){aa=parseFloat(c.getInnerText(a.cells[c.sortColumnIndex]));isNaN(aa)&&(aa=0);bb=parseFloat(c.getInnerText(b.cells[c.sortColumnIndex]));isNaN(bb)&&(bb=0);return aa-bb};var c=this;this.tbody&&this.tbody[0].rows&&0<this.tbody[0].rows.length&&(e(this.thead),0<this.tfoot.length&&e(this.tfoot))}; -
tags-page/trunk/readme.txt
r1604010 r1610851 5 5 Requires at least: 3.0 6 6 Tested up to: 4.7 7 Stable tag: 1.3 7 Stable tag: 1.3.1 8 8 License: WTFPL 9 9 … … 49 49 == Changelog == 50 50 51 = 1.3.1 = 52 * fix: failed on tables without footer 51 53 = 1.3 = 52 54 * fix: sorting did not work when clicking in table footer -
tags-page/trunk/tags-page.php
r1604010 r1610851 4 4 Plugin URI: http://wordpress.org/plugins/tags-page/ 5 5 Description: Adds a table listing all tags registered on your website. 6 Version: 1.3 6 Version: 1.3.1 7 7 Author: Honza Skypala 8 8 Author URI: http://www.honza.info … … 13 13 14 14 class TagsPage { 15 const version = "1.3 ";15 const version = "1.3.1"; 16 16 private static $init_table = false; 17 17
Note: See TracChangeset
for help on using the changeset viewer.