tablesorter/js/jquery.tablesorter.widgets.min.js

3 lines
38 KiB
JavaScript
Raw Normal View History

2015-02-10 00:44:47 +00:00
/*! tableSorter (FORK) 2.16+ widgets - updated 2/9/2015 (v2.19.1) */
;(function(h,A){var e=h.tablesorter=h.tablesorter||{};e.themes={bootstrap:{table:"table table-bordered table-striped",caption:"caption",header:"bootstrap-header",sortNone:"",sortAsc:"",sortDesc:"",active:"",hover:"",icons:"",iconSortNone:"bootstrap-icon-unsorted",iconSortAsc:"icon-chevron-up glyphicon glyphicon-chevron-up",iconSortDesc:"icon-chevron-down glyphicon glyphicon-chevron-down",filterRow:"",footerRow:"",footerCells:"",even:"",odd:""},jui:{table:"ui-widget ui-widget-content ui-corner-all", caption:"ui-widget-content",header:"ui-widget-header ui-corner-all ui-state-default",sortNone:"",sortAsc:"",sortDesc:"",active:"ui-state-active",hover:"ui-state-hover",icons:"ui-icon",iconSortNone:"ui-icon-carat-2-n-s",iconSortAsc:"ui-icon-carat-1-n",iconSortDesc:"ui-icon-carat-1-s",filterRow:"",footerRow:"",footerCells:"",even:"ui-widget-content",odd:"ui-state-default"}};h.extend(e.css,{filterRow:"tablesorter-filter-row",filter:"tablesorter-filter",wrapper:"tablesorter-wrapper",resizer:"tablesorter-resizer", sticky:"tablesorter-stickyHeader",stickyVis:"tablesorter-sticky-visible",stickyWrap:"tablesorter-sticky-wrapper"});e.storage=function(d,a,b,c){d=h(d)[0];var f,e,g=!1;f={};e=d.config;var m=h(d);d=c&&c.id||m.attr(c&&c.group||"data-table-group")||d.id||h(".tablesorter").index(m);c=c&&c.url||m.attr(c&&c.page||"data-table-page")||e&&e.fixedUrl||A.location.pathname;if("localStorage"in A)try{A.localStorage.setItem("_tmptest","temp"),g=!0,A.localStorage.removeItem("_tmptest")}catch(n){}h.parseJSON&&(g?f= h.parseJSON(localStorage[a]||"null")||{}:(e=document.cookie.split(/[;\s|=]/),f=h.inArray(a,e)+1,f=0!==f?h.parseJSON(e[f]||"null")||{}:{}));if((b||""===b)&&A.JSON&&JSON.hasOwnProperty("stringify"))f[c]||(f[c]={}),f[c][d]=b,g?localStorage[a]=JSON.stringify(f):(b=new Date,b.setTime(b.getTime()+31536E6),document.cookie=a+"="+JSON.stringify(f).replace(/\"/g,'"')+"; expires="+b.toGMTString()+"; path=/");else return f&&f[c]?f[c][d]:""};e.addHeaderResizeEvent=function(d,a,b){d=h(d)[0];var c;b=h.extend({}, {timer:250},b);var e=d.config,k=e.widgetOptions,g=function(a){k.resize_flag=!0;c=[];e.$headers.each(function(){var a=h(this),b=a.data("savedSizes")||[0,0],d=this.offsetWidth,e=this.offsetHeight;if(d!==b[0]||e!==b[1])a.data("savedSizes",[d,e]),c.push(this)});c.length&&!1!==a&&e.$table.trigger("resize",[c]);k.resize_flag=!1};g(!1);clearInterval(k.resize_timer);if(a)return k.resize_flag=!1;k.resize_timer=setInterval(function(){k.resize_flag||g()},b.timer)};e.addWidget({id:"uitheme",priority:10,format:function(d, a,b){var c,f,k,g,m,n;c=e.themes;g=a.$table.add(a.$extraTables);d=a.$headers.add(a.$extraHeaders);var r=a.theme||"jui",p=c[r]||{},w=h.trim([p.sortNone,p.sortDesc,p.sortAsc,p.active].join(" ")),x=h.trim([p.iconSortNone,p.iconSortDesc,p.iconSortAsc].join(" "));a.debug&&(k=new Date);g.hasClass("tablesorter-"+r)&&a.theme===a.appliedTheme&&b.uitheme_applied||(b.uitheme_applied=!0,c=c[a.appliedTheme]||{},f=(n=!h.isEmptyObject(c))?[c.sortNone,c.sortDesc,c.sortAsc,c.active].join(" "):"",m=n?[c.iconSortNone, c.iconSortDesc,c.iconSortAsc].join(" "):"",n&&(b.zebra[0]=h.trim(" "+b.zebra[0].replace(" "+c.even,"")),b.zebra[1]=h.trim(" "+b.zebra[1].replace(" "+c.odd,"")),a.$tbodies.children().removeClass([c.even,c.odd].join(" "))),p.even&&(b.zebra[0]+=" "+p.even),p.odd&&(b.zebra[1]+=" "+p.odd),g.children("caption").removeClass(c.caption||"").addClass(p.caption),b=g.removeClass((a.appliedTheme?"tablesorter-"+(a.appliedTheme||""):"")+" "+(c.table||"")).addClass("tablesorter-"+r+" "+(p.table||"")).children("tfoot"), a.appliedTheme=a.theme,b.length&&b.children("tr").removeClass(c.footerRow||"").addClass(p.footerRow).children("th, td").removeClass(c.footerCells||"").addClass(p.footerCells),d.removeClass((n?[c.header,c.hover,f].join(" "):"")||"").addClass(p.header).not(".sorter-false").unbind("mouseenter.tsuitheme mouseleave.tsuitheme").bind("mouseenter.tsuitheme mouseleave.tsuitheme",function(a){h(this)["mouseenter"===a.type?"addClass":"removeClass"](p.hover||"")}),d.each(function(){var a=h(this);a.find("."+e.css.wrapper).length|| a.wrapInner('<div cl