artabro/wire/modules/Jquery/JqueryTableSorter/widgets.min.js

1 line
69 KiB
JavaScript
Raw Normal View History

2024-08-27 11:35:37 +02:00
(function(factory){if(typeof define==="function"&&define.amd){define(["jquery"],factory)}else if(typeof module==="object"&&typeof module.exports==="object"){module.exports=factory(require("jquery"))}else{factory(jQuery)}})(function(jQuery){(function($,window,document){"use strict";var ts=$.tablesorter||{};$.extend(true,ts.defaults,{fixedUrl:"",widgetOptions:{storage_fixedUrl:"",storage_group:"",storage_page:"",storage_storageType:"",storage_tableId:"",storage_useSessionStorage:""}});ts.storage=function(table,key,value,options){table=$(table)[0];var cookieIndex,cookies,date,hasStorage=false,values={},c=table.config,wo=c&&c.widgetOptions,debug=ts.debug(c,"storage"),storageType=(options&&options.storageType||wo&&wo.storage_storageType).toString().charAt(0).toLowerCase(),session=storageType?"":options&&options.useSessionStorage||wo&&wo.storage_useSessionStorage,$table=$(table),id=options&&options.id||$table.attr(options&&options.group||wo&&wo.storage_group||"data-table-group")||wo&&wo.storage_tableId||table.id||$(".tablesorter").index($table),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;if(storageType!=="c"){storageType=storageType==="s"||session?"sessionStorage":"localStorage";if(storageType in window){try{window[storageType].setItem("_tmptest","temp");hasStorage=true;window[storageType].removeItem("_tmptest")}catch(error){console.warn(storageType+" is not supported in this browser")}}}if(debug){console.log("Storage >> Using",hasStorage?storageType:"cookies")}if(hasStorage){values=JSON.parse(window[storageType][key]||"null")||{}}else{cookies=document.cookie.split(/[;\s|=]/);cookieIndex=$.inArray(key,cookies)+1;values=cookieIndex!==0?JSON.parse(cookies[cookieIndex]||"null")||{}:{}}if(typeof value!=="undefined"&&window.JSON&&JSON.hasOwnProperty("stringify")){if(!values[url]){values[url]={}}values[url][id]=value;if(hasStorage){window[storageType][key]=JSON.stringify(values)}else{date=new Date;date.setTime(date.getTime()+31536e6);document.cookie=key+"="+JSON.stringify(values).replace(/\"/g,'"')+"; expires="+date.toGMTString()+"; path=/"}}else{return values&&values[url]?values[url][id]:""}}})(jQuery,window,document);(function($){"use strict";var ts=$.tablesorter||{};ts.themes={bootstrap:{table:"table table-bordered table-striped",caption:"caption",header:"bootstrap-header",sortNone:"",sortAsc:"",sortDesc:"",active:"",hover:"",icons:"",iconSortNone:"bootstrap-icon-unsorted",iconSortAsc:"glyphicon glyphicon-chevron-up",iconSortDesc:"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 ui-icon-caret-2-n-s",iconSortAsc:"ui-icon-carat-1-n ui-icon-caret-1-n",iconSortDesc:"ui-icon-carat-1-s ui-icon-caret-1-s",filterRow:"",footerRow:"",footerCells:"",even:"ui-widget-content",odd:"ui-state-default"}};$.extend(ts.css,{wrapper:"tablesorter-wrapper"});ts.addWidget({id:"uitheme",priority:10,format:function(table,c,wo){var i,tmp,hdr,icon,time,$header,$icon,$tfoot,$h,oldtheme,oldremove,oldIconRmv,hasOldTheme,themesAll=ts.themes,$table=c.$table.add($(c.namespace+"_extra_table")),$headers=c.$headers.add($(c.namespace+"_extra_headers")),theme=c.theme||"jui",themes=themesAll[theme]||{},remove=[themes.sortNone,themes.sortDesc,themes.sortAsc,themes.active].join(" ").trim(),iconRmv=[themes.iconSortNone,themes.iconSortDesc,themes.iconSortAsc].join(" ").trim(),debug=ts.debug(c,"uitheme");if(debug){time=new Date}if(!$table.hasClass("tablesorter-"+theme)||c.theme!==c.appliedTheme||!wo.uitheme_applied){wo.uitheme_applied=true;oldtheme=themesAll[c.appliedTheme]||{};hasOldTheme=!$.isEmptyObject(oldtheme);oldremove=hasOldTheme?[oldtheme.sortNone,oldtheme.sortDesc,oldtheme.sortAsc,oldtheme.active].join(" "):"";oldIconRmv=hasOldTheme?