2023-08-17 09:47:40 +00:00
|
|
|
!function(p,h,v){"use strict";h=void 0!==h&&h.Math===Math?h:globalThis,p.fn.site=function(e){var l,i=Date.now(),o=[],t=e,n="string"==typeof t,c=[].slice.call(arguments,1),r=p.isPlainObject(e)?p.extend(!0,{},p.site.settings,e):p.extend({},p.site.settings),a=r.namespace,d=r.error,s="module-"+a,u=p(v),f=this,m=u.data(s),g={initialize:function(){g.instantiate()},instantiate:function(){g.verbose("Storing instance of site",g),m=g,u.data(s,g)},normalize:function(){},fix:{consoleClear:function(){g.debug("Disabling programmatic console clearing"),h.console.clear=function(){}}},moduleExists:function(e){return void 0!==p.fn[e]&&void 0!==p.fn[e].settings},enabled:{modules:function(e){var n=[];return e=e||r.modules,p.each(e,function(e,t){g.moduleExists(t)&&n.push(t)}),n}},disabled:{modules:function(e){var n=[];return e=e||r.modules,p.each(e,function(e,t){g.moduleExists(t)||n.push(t)}),n}},change:{setting:function(i,o,e,a){e="string"==typeof e?"all"===e?r.modules:[e]:e||r.modules,a=void 0===a||a,p.each(e,function(e,t){var n=!g.moduleExists(t)||(p.fn[t].settings.namespace||!1);g.moduleExists(t)&&(g.verbose("Changing default setting",i,o,t),p.fn[t].settings[i]=o,a&&n&&0<(n=p(":data(module-"+n+")")).length&&(g.verbose("Modifying existing settings",n),n[t]("setting",i,o)))})},settings:function(i,e,o){e="string"==typeof e?[e]:e||r.modules,o=void 0===o||o,p.each(e,function(e,t){var n;g.moduleExists(t)&&(g.verbose("Changing default setting",i,t),p.extend(!0,p.fn[t].settings,i),o&&a&&0<(n=p(":data(module-"+a+")")).length&&(g.verbose("Modifying existing settings",n),n[t]("setting",i)))})}},enable:{console:function(){g.console(!0)},debug:function(e,t){e=e||r.modules,g.debug("Enabling debug for modules",e),g.change.setting("debug",!0,e,t)},verbose:function(e,t){e=e||r.modules,g.debug("Enabling verbose debug for modules",e),g.change.setting("verbose",!0,e,t)}},disable:{console:function(){g.console(!1)},debug:function(e,t){e=e||r.modules,g.debug("Disabling debug for modules",e),g.change.setting("debug",!1,e,t)},verbose:function(e,t){e=e||r.modules,g.debug("Disabling verbose debug for modules",e),g.change.setting("verbose",!1,e,t)}},console:function(e){e?void 0===m.cache.console?g.error(d.console):(g.debug("Restoring console function"),h.console=m.cache.console):(g.debug("Disabling console function"),m.cache.console=h.console,h.console={clear:function(){},error:function(){},group:function(){},groupCollapsed:function(){},groupEnd:function(){},info:function(){},log:function(){},table:function(){},warn:function(){}})},destroy:function(){g.verbose("Destroying previous site for",u),u.removeData(s)},cache:{},setting:function(e,t){if(p.isPlainObject(e))p.extend(!0,r,e);else{if(void 0===t)return r[e];r[e]=t}},internal:function(e,t){if(p.isPlainObject(e))p.extend(!0,g,e);else{if(void 0===t)return g[e];g[e]=t}},debug:function(){r.debug&&(r.performance?g.performance.log(arguments):(g.debug=Function.prototype.bind.call(console.info,console,r.name+":"),g.debug.apply(console,arguments)))},verbose:function(){r.verbose&&r.debug&&(r.performance?g.performance.log(arguments):(g.verbose=Function.prototype.bind.call(console.info,console,r.name+":"),g.verbose.apply(console,arguments)))},error:function(){g.error=Function.prototype.bind.call(console.error,console,r.name+":"),g.error.apply(console,arguments)},performance:{log:function(e){var t,n;r.performance&&(n=(t=Date.now())-(i||t),i=t,o.push({Element:f,Name:e[0],Arguments:[].slice.call(e,1)||"","Execution Time":n})),clearTimeout(g.performance.timer),g.performance.timer=setTimeout(g.performance.display,500)},display:function(){var e=r.name+":",n=0;i=!1,clearTimeout(g.performance.timer),p.each(o,function(e,t){n+=t["Execution Time"]}),e+=" "+n+"ms",0<o.length&&(console.groupCollapsed(e),console.table?console.table(o):p.each(o,function(e,t){console.log(t.Name+": "+t["Execution Time"]+"ms")}),console.groupEnd()),o=[]}},invoke:function(i,e,t){var o,a,n,r,s=m;return e=e||c,t=t||f,"string"==typeof i&&void 0!==s&&(i=i.split(/[ .]/),o=i.length-1,p.each(i,function(e,t){var n=e!==o?t+i[e+1].charAt(0).toUpperCase()+i[e+1].slice(1)
|