tablesorter/dist/js/widgets/widget-storage.min.js

2 lines
1.1 KiB
JavaScript

/*! Widget: storage - updated 3/26/2015 (v2.21.3) */
!function(a,b,c){"use strict";var d=a.tablesorter||{};d.storage=function(d,e,f,g){d=a(d)[0];var h,i,j,k=!1,l={},m=d.config,n=m&&m.widgetOptions,o=g&&g.useSessionStorage||n&&n.storage_useSessionStorage?"sessionStorage":"localStorage",p=a(d),q=g&&g.id||p.attr(g&&g.group||n&&n.storage_group||"data-table-group")||n&&n.storage_tableId||d.id||a(".tablesorter").index(p),r=g&&g.url||p.attr(g&&g.page||n&&n.storage_page||"data-table-page")||n&&n.storage_fixedUrl||m&&m.fixedUrl||b.location.pathname;if(o in b)try{b[o].setItem("_tmptest","temp"),k=!0,b[o].removeItem("_tmptest")}catch(s){m&&m.debug&&console.warn(o+" is not supported in this browser")}return a.parseJSON&&(k?l=a.parseJSON(b[o][e]||"null")||{}:(i=c.cookie.split(/[;\s|=]/),h=a.inArray(e,i)+1,l=0!==h?a.parseJSON(i[h]||"null")||{}:{})),(f||""===f)&&b.JSON&&JSON.hasOwnProperty("stringify")?(l[r]||(l[r]={}),l[r][q]=f,k?b[o][e]=JSON.stringify(l):(j=new Date,j.setTime(j.getTime()+31536e6),c.cookie=e+"="+JSON.stringify(l).replace(/\"/g,'"')+"; expires="+j.toGMTString()+"; path=/"),void 0):l&&l[r]?l[r][q]:""}}(jQuery,window,document);