mirror of
https://github.com/Mottie/tablesorter.git
synced 2024-11-15 23:54:22 +00:00
Storage: Add options early to prevent validator message
This commit is contained in:
parent
caf9445899
commit
fb07b98f08
2
dist/js/widgets/widget-storage.min.js
vendored
2
dist/js/widgets/widget-storage.min.js
vendored
@ -1,2 +1,2 @@
|
||||
/*! Widget: storage - updated 11/26/2016 (v2.28.0) */
|
||||
!function(a,b,c){"use strict";var d=a.tablesorter||{};d.storage=function(e,f,g,h){e=a(e)[0];var i,j,k,l=!1,m={},n=e.config,o=n&&n.widgetOptions,p=h&&h.useSessionStorage||o&&o.storage_useSessionStorage?"sessionStorage":"localStorage",q=a(e),r=h&&h.id||q.attr(h&&h.group||o&&o.storage_group||"data-table-group")||o&&o.storage_tableId||e.id||a(".tablesorter").index(q),s=h&&h.url||q.attr(h&&h.page||o&&o.storage_page||"data-table-page")||o&&o.storage_fixedUrl||n&&n.fixedUrl||b.location.pathname;if(a.extend(!0,d.defaults,{fixedUrl:"",widgetOptions:{storage_fixedUrl:"",storage_group:"",storage_page:"",storage_tableId:"",storage_useSessionStorage:""}}),p in b)try{b[p].setItem("_tmptest","temp"),l=!0,b[p].removeItem("_tmptest")}catch(a){n&&n.debug&&console.warn(p+" is not supported in this browser")}if(a.parseJSON&&(l?m=a.parseJSON(b[p][f]||"null")||{}:(j=c.cookie.split(/[;\s|=]/),i=a.inArray(f,j)+1,m=0!==i?a.parseJSON(j[i]||"null")||{}:{})),void 0===g||!b.JSON||!JSON.hasOwnProperty("stringify"))return m&&m[s]?m[s][r]:"";m[s]||(m[s]={}),m[s][r]=g,l?b[p][f]=JSON.stringify(m):(k=new Date,k.setTime(k.getTime()+31536e6),c.cookie=f+"="+JSON.stringify(m).replace(/\"/g,'"')+"; expires="+k.toGMTString()+"; path=/")}}(jQuery,window,document);
|
||||
!function(a,b,c){"use strict";var d=a.tablesorter||{};a.extend(!0,d.defaults,{fixedUrl:"",widgetOptions:{storage_fixedUrl:"",storage_group:"",storage_page:"",storage_tableId:"",storage_useSessionStorage:""}}),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(a){m&&m.debug&&console.warn(o+" is not supported in this browser")}if(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")||{}:{})),void 0===f||!b.JSON||!JSON.hasOwnProperty("stringify"))return l&&l[r]?l[r][q]:"";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=/")}}(jQuery,window,document);
|
@ -4,6 +4,19 @@
|
||||
'use strict';
|
||||
|
||||
var ts = $.tablesorter || {};
|
||||
|
||||
// update defaults for validator; these values must be falsy!
|
||||
$.extend(true, ts.defaults, {
|
||||
fixedUrl: '',
|
||||
widgetOptions: {
|
||||
storage_fixedUrl: '',
|
||||
storage_group: '',
|
||||
storage_page: '',
|
||||
storage_tableId: '',
|
||||
storage_useSessionStorage: ''
|
||||
}
|
||||
});
|
||||
|
||||
// *** Store data in local storage, with a cookie fallback ***
|
||||
/* IE7 needs JSON library for JSON.stringify - (http://caniuse.com/#search=json)
|
||||
if you need it, then include https://github.com/douglascrockford/JSON-js
|
||||
@ -43,17 +56,6 @@
|
||||
url = options && options.url ||
|
||||
$table.attr(options && options.page || wo && wo.storage_page || 'data-table-page') ||
|
||||
wo && wo.storage_fixedUrl || c && c.fixedUrl || window.location.pathname;
|
||||
// update defaults for validator; these values must be falsy!
|
||||
$.extend(true, ts.defaults, {
|
||||
fixedUrl: '',
|
||||
widgetOptions: {
|
||||
storage_fixedUrl: '',
|
||||
storage_group: '',
|
||||
storage_page: '',
|
||||
storage_tableId: '',
|
||||
storage_useSessionStorage: ''
|
||||
}
|
||||
});
|
||||
// https://gist.github.com/paulirish/5558557
|
||||
if (storageType in window) {
|
||||
try {
|
||||
|
Loading…
Reference in New Issue
Block a user