10 lines
11 KiB
JavaScript
10 lines
11 KiB
JavaScript
|
/**
|
||
|
* bootstrap-table - An extended Bootstrap table with radio, checkbox, sort, pagination, and other added features. (supports twitter bootstrap v2 and v3).
|
||
|
*
|
||
|
* @version v1.14.2
|
||
|
* @homepage https://bootstrap-table.com
|
||
|
* @author wenzhixin <wenzhixin2010@gmail.com> (http://wenzhixin.net.cn/)
|
||
|
* @license MIT
|
||
|
*/
|
||
|
|
||
|
(function(a,b){if('function'==typeof define&&define.amd)define([],b);else if('undefined'!=typeof exports)b();else{b(),a.bootstrapTableCookie={exports:{}}.exports}})(this,function(){'use strict';function a(a,b){if(!(a instanceof b))throw new TypeError('Cannot call a class as a function')}function b(a,b){if(!a)throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');return b&&('object'==typeof b||'function'==typeof b)?b:a}function c(a,b){if('function'!=typeof b&&null!==b)throw new TypeError('Super expression must either be null or a function, not '+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}var d=function(){function a(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,'value'in c&&(c.writable=!0),Object.defineProperty(a,c.key,c)}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}(),e=function a(b,c,d){null===b&&(b=Function.prototype);var e=Object.getOwnPropertyDescriptor(b,c);if(e===void 0){var f=Object.getPrototypeOf(b);return null===f?void 0:a(f,c,d)}if('value'in e)return e.value;var g=e.get;return void 0===g?void 0:g.call(d)};(function(f){var g={cookieIds:{sortOrder:'bs.table.sortOrder',sortName:'bs.table.sortName',pageNumber:'bs.table.pageNumber',pageList:'bs.table.pageList',columns:'bs.table.columns',searchText:'bs.table.searchText',filterControl:'bs.table.filterControl',filterBy:'bs.table.filterBy'},getCurrentHeader:function(a){var b=a.$header;return a.options.height&&(b=a.$tableHeader),b},getCurrentSearchControls:function(a){var b='select, input';return a.options.height&&(b='table select, table input'),b},cookieEnabled:function(){return!!navigator.cookieEnabled},inArrayCookiesEnabled:function(a,b){for(var c=-1,d=0;d<b.length;d++)if(a.toLowerCase()===b[d].toLowerCase()){c=d;break}return c},setCookie:function(a,b,c){if(a.options.cookie&&g.cookieEnabled()&&''!==a.options.cookieIdTable&&-1!==g.inArrayCookiesEnabled(b,a.options.cookiesEnabled)){switch(b=a.options.cookieIdTable+'.'+b,a.options.cookieStorage){case'cookieStorage':document.cookie=[b,'=',encodeURIComponent(c),'; expires='+g.calculateExpiration(a.options.cookieExpire),a.options.cookiePath?'; path='+a.options.cookiePath:'',a.options.cookieDomain?'; domain='+a.options.cookieDomain:'',a.options.cookieSecure?'; secure':''].join('');break;case'localStorage':localStorage.setItem(b,c);break;case'sessionStorage':sessionStorage.setItem(b,c);break;default:return!1;}return!0}},getCookie:function(a,b,c){if(!c)return null;if(-1===g.inArrayCookiesEnabled(c,a.options.cookiesEnabled))return null;switch(c=b+'.'+c,a.options.cookieStorage){case'cookieStorage':var d='; '+document.cookie,e=d.split('; '+c+'=');return 2===e.length?decodeURIComponent(e.pop().split(';').shift()):null;case'localStorage':return localStorage.getItem(c);case'sessionStorage':return sessionStorage.getItem(c);default:return null;}},deleteCookie:function(a,b,c){switch(c=b+'.'+c,a.options.cookieStorage){case'cookieStorage':document.cookie=[encodeURIComponent(c),'=','; expires=Thu, 01 Jan 1970 00:00:00 GMT',a.options.cookiePath?'; path='+a.options.cookiePath:'',a.options.cookieDomain?'; domain='+a.options.cookieDomain:''].join('');break;case'localStorage':localStorage.removeItem(c);break;case'sessionStorage':sessionStorage.removeItem(c);break;default:return!1;}return!0},calculateExpiration:function(a){var b=a.replace(/[0-9]*/,'');switch(a=a.replace(/[A-Za-z]{1,2}/,''),b.toLowerCase()){case's':a=+a;break;case'mi':a*=60;break;case'h':a=60*(60*a);break;case'd':a=60*(60*(24*a));break;case'm':a=60*(60*(24*(30*a)));break;case'y':a=60*(60*(24*(365*a)));break;default:a=void 0;}if(!a)return'';var c=new Date;return c.setTime(c.getTime()+1e3*a),c.toGMTString()},initCookieFilters:function(a){setTimeout(function(){var b=JSON.parse(g.getCookie(a,a.options.cookieIdTable,g.cookieIds.filterControl));if(!a.options.filterControlValuesLoaded&&b){var c={},d=g.getCurrentHeader(a),e=g.getCurrentSearchControls(a),
|