Plugin Directory

Changeset 1604010


Ignore:
Timestamp:
02/26/2017 08:10:21 PM (9 years ago)
Author:
honza.skypala
Message:

Release 1.3

  • fix: sorting did not work when clicking in table footer
Location:
tags-page/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • tags-page/trunk/js/webtoolkit.sortabletable.js

    r964339 r1604010  
    8585    // define variables
    8686    var thisObject = this;
    87     var sortSection = this.thead;
    8887 
    8988    // constructor actions
    9089    if (!(this.tbody && this.tbody[0].rows && this.tbody[0].rows.length > 0)) return;
    9190 
    92     if (sortSection && sortSection[0].rows && sortSection[0].rows.length > 0) {
    93         var sortRow = sortSection[0].rows[0];
    94     } else {
    95         return;
    96     }
    97  
    98     for (var i=0; i<sortRow.cells.length; i++) {
    99         sortRow.cells[i].sTable = this;
    100         sortRow.cells[i].onclick = function () {
    101             this.sTable.sort(this);
    102             return false;
     91    function initSorting(sortSection) {
     92        if (sortSection && sortSection[0].rows && sortSection[0].rows.length > 0) {
     93            var sortRow = sortSection[0].rows[0];
     94        } else {
     95            return;
     96        }
     97   
     98        for (var i=0; i<sortRow.cells.length; i++) {
     99            sortRow.cells[i].sTable = this;
     100            sortRow.cells[i].onclick = function () {
     101                this.sTable.sort(this);
     102                return false;
     103            }
    103104        }
    104105    }
    105  
     106
     107    initSorting(this.thead);
     108    initSorting(this.tfoot);
    106109}
  • tags-page/trunk/js/webtoolkit.sortabletable.min.js

    r964339 r1604010  
    1 function SortableTable(d){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,d=this.getInnerText(this.tbody[0].rows[1].cells[b]),c=this.sortCaseInsensitive;d.match(/\d\d[-]+\d\d[-]+\d\d\d\d/)&&(c=this.sortDate);d.replace(/^\s+|\s+$/g,"").match(/^[\d\.]+$/)&&(c=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(c);"down"==a.getAttribute("sortdir")?(b.reverse(),a.setAttribute("sortdir","up")):a.setAttribute("sortdir","down");for(e=0;e<b.length;e++)this.tbody[0].appendChild(b[e])};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;d=this.thead;if(this.tbody&&this.tbody[0].rows&&0<this.tbody[0].rows.length&&d&&d[0].rows&&0<d[0].rows.length){d=d[0].rows[0];for(var e=0;e<d.cells.length;e++)d.cells[e].sTable=this,d.cells[e].onclick=function(){this.sTable.sort(this);return!1}}};
     1function 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))};
  • tags-page/trunk/readme.txt

    r1225516 r1604010  
    44Tags: tag-cloud, tags, page, widget, taxonomy
    55Requires at least: 3.0
    6 Tested up to: 4.3
    7 Stable tag: 1.2
     6Tested up to: 4.7
     7Stable tag: 1.3
    88License: WTFPL
    99
     
    4949== Changelog ==
    5050
     51= 1.3 =
     52* fix: sorting did not work when clicking in table footer
    5153= 1.2 =
    5254* fix: virtual page not working for permalinks set to /%category%/%postname%/
  • tags-page/trunk/tags-page.php

    r1225516 r1604010  
    44Plugin URI: http://wordpress.org/plugins/tags-page/
    55Description: Adds a table listing all tags registered on your website.
    6 Version: 1.2
     6Version: 1.3
    77Author: Honza Skypala
    88Author URI: http://www.honza.info
     
    1313
    1414class TagsPage {
    15   const version = "1.2";
     15  const version = "1.3";
    1616  private static $init_table = false;
    1717
Note: See TracChangeset for help on using the changeset viewer.