mirror of
https://github.com/Mottie/tablesorter.git
synced 2024-12-05 05:04:20 +00:00
2 lines
1.0 KiB
JavaScript
2 lines
1.0 KiB
JavaScript
/*! Widget: saveSort - updated 10/31/2015 (v2.24.0) */
|
|
!function(t){"use strict";var s=t.tablesorter||{};s.addWidget({id:"saveSort",priority:20,options:{saveSort:!0},init:function(t,s,o,e){s.format(t,o,e,!0)},format:function(o,e,r,a){var i,n,l=e.$table,g=!1!==r.saveSort,v={sortList:e.sortList};e.debug&&(n=new Date),l.hasClass("hasSaveSort")?g&&o.hasInitialized&&s.storage&&(s.storage(o,"tablesorter-savesort",v),e.debug&&console.log("saveSort widget: Saving last sort: "+e.sortList+s.benchmark(n))):(l.addClass("hasSaveSort"),v="",s.storage&&(v=(i=s.storage(o,"tablesorter-savesort"))&&i.hasOwnProperty("sortList")&&t.isArray(i.sortList)?i.sortList:"",e.debug&&console.log('saveSort: Last sort loaded: "'+v+'"'+s.benchmark(n)),l.bind("saveSortReset",function(t){t.stopPropagation(),s.storage(o,"tablesorter-savesort","")})),a&&v&&v.length>0?e.sortList=v:o.hasInitialized&&v&&v.length>0&&s.sortOn(e,v))},remove:function(t,o){o.$table.removeClass("hasSaveSort"),s.storage&&s.storage(t,"tablesorter-savesort","")}})}(jQuery); |