11 lines
No EOL
5.3 KiB
JavaScript
11 lines
No EOL
5.3 KiB
JavaScript
/*
|
|
* # Fomantic UI - 2.9.3
|
|
* https://github.com/fomantic/Fomantic-UI
|
|
* https://fomantic-ui.com/
|
|
*
|
|
* Copyright 2023 Contributors
|
|
* Released under the MIT license
|
|
* https://opensource.org/licenses/MIT
|
|
*
|
|
*/
|
|
!function(b,p,v){"use strict";p=void 0!==p&&p.Math===Math?p:globalThis,b.fn.site=function(e){var a,t=Date.now(),i=[],n=e,o="string"==typeof n,u=[].slice.call(arguments,1),r=b.isPlainObject(e)?b.extend(!0,{},b.site.settings,e):b.extend({},b.site.settings),s=r.namespace,l=r.error,c="module-"+s,d=b(v),f=this,g=d.data(c),m={initialize:function(){m.instantiate()},instantiate:function(){m.verbose("Storing instance of site",m),g=m,d.data(c,m)},normalize:function(){},fix:{consoleClear:function(){m.debug("Disabling programmatic console clearing"),p.console.clear=function(){}}},moduleExists:function(e){return void 0!==b.fn[e]&&void 0!==b.fn[e].settings},enabled:{modules:function(e){var o=[];return e=e||r.modules,b.each(e,function(e,n){m.moduleExists(n)&&o.push(n)}),o}},disabled:{modules:function(e){var o=[];return e=e||r.modules,b.each(e,function(e,n){m.moduleExists(n)||o.push(n)}),o}},change:{setting:function(t,i,e,s){e="string"==typeof e?"all"===e?r.modules:[e]:e||r.modules,s=void 0===s||s,b.each(e,function(e,n){var o=!m.moduleExists(n)||(b.fn[n].settings.namespace||!1);m.moduleExists(n)&&(m.verbose("Changing default setting",t,i,n),b.fn[n].settings[t]=i,s&&o&&0<(o=b(":data(module-"+o+")")).length&&(m.verbose("Modifying existing settings",o),o[n]("setting",t,i)))})},settings:function(t,e,i){e="string"==typeof e?[e]:e||r.modules,i=void 0===i||i,b.each(e,function(e,n){var o;m.moduleExists(n)&&(m.verbose("Changing default setting",t,n),b.extend(!0,b.fn[n].settings,t),i&&s&&0<(o=b(":data(module-"+s+")")).length&&(m.verbose("Modifying existing settings",o),o[n]("setting",t)))})}},enable:{console:function(){m.console(!0)},debug:function(e,n){e=e||r.modules,m.debug("Enabling debug for modules",e),m.change.setting("debug",!0,e,n)},verbose:function(e,n){e=e||r.modules,m.debug("Enabling verbose debug for modules",e),m.change.setting("verbose",!0,e,n)}},disable:{console:function(){m.console(!1)},debug:function(e,n){e=e||r.modules,m.debug("Disabling debug for modules",e),m.change.setting("debug",!1,e,n)},verbose:function(e,n){e=e||r.modules,m.debug("Disabling verbose debug for modules",e),m.change.setting("verbose",!1,e,n)}},console:function(e){e?void 0===g.cache.console?m.error(l.console):(m.debug("Restoring console function"),p.console=g.cache.console):(m.debug("Disabling console function"),g.cache.console=p.console,p.console={clear:function(){},error:function(){},group:function(){},groupCollapsed:function(){},groupEnd:function(){},info:function(){},log:function(){},table:function(){},warn:function(){}})},destroy:function(){m.verbose("Destroying previous site for",d),d.removeData(c)},cache:{},setting:function(e,n){if(b.isPlainObject(e))b.extend(!0,r,e);else{if(void 0===n)return r[e];r[e]=n}},internal:function(e,n){if(b.isPlainObject(e))b.extend(!0,m,e);else{if(void 0===n)return m[e];m[e]=n}},debug:function(){r.debug&&(r.performance?m.performance.log(arguments):(m.debug=Function.prototype.bind.call(console.info,console,r.name+":"),m.debug.apply(console,arguments)))},verbose:function(){r.verbose&&r.debug&&(r.performance?m.performance.log(arguments):(m.verbose=Function.prototype.bind.call(console.info,console,r.name+":"),m.verbose.apply(console,arguments)))},error:function(){m.error=Function.prototype.bind.call(console.error,console,r.name+":"),m.error.apply(console,arguments)},performance:{log:function(e){var n,o;r.performance&&(o=(n=Date.now())-(t||n),t=n,i.push({Element:f,Name:e[0],Arguments:[].slice.call(e,1)||"","Execution Time":o})),clearTimeout(m.performance.timer),m.performance.timer=setTimeout(function(){m.performance.display()},500)},display:function(){var e=r.name+":",o=0;t=!1,clearTimeout(m.performance.timer),b.each(i,function(e,n){o+=n["Execution Time"]}),e+=" "+o+"ms",0<i.length&&(console.groupCollapsed(e),console.table?console.table(i):b.each(i,function(e,n){console.log(n.Name+": "+n["Execution Time"]+"ms")}),console.groupEnd()),i=[]}},invoke:function(t,e,n){var i,s,o,r,c=g;return e=e||u,n=n||f,"string"==typeof t&&void 0!==c&&(t=t.split(/[ .]/),i=t.length-1,b.each(t,function(e,n){var o=e!==i?n+t[e+1].charAt(0).toUpperCase()+t[e+1].slice(1):t;if(b.isPlainObject(c[o])&&e!==i)c=c[o];else{if(void 0!==c[o])return s=c[o],!1;{if(!b.isPlainObject(c[n])||e===i)return void 0!==c[n]?s=c[n]:m.error(l.method,t),!1;c=c[n]}}})),"function"==typeof(r=s)&&"number"!=typeof r.nodeType?o=s.apply(n,e):void 0!==s&&(o=s),Array.isArray(a)?a.push(o):void 0!==a?a=[a,o]:void 0!==o&&(a=o),s}};return o?(void 0===g&&m.initialize(),m.invoke(n)):(void 0!==g&&m.destroy(),m.initialize()),void 0!==a?a:this},b.site=b.fn.site,b.site.settings={name:"Site",namespace:"site",error:{console:"Console cannot be restored, most likely it was overwritten outside of module",method:"The method you called is not defined."},debug:!1,verbose:!1,performance:!0,modules:["accordion","api","calendar","checkbox","dimmer","dropdown","embed","flyout","form","modal","nag","popup","progress","rating","search","shape","sidebar","slider","state","sticky","tab","toast","transition","visibility"],siteNamespace:"site",namespaceStub:{cache:{},config:{},sections:{},section:{},utilities:{}}},b.extend(b.expr.pseudos,{data:b.expr.createPseudo(function(n){return function(e){return!!b.data(e,n)}})})}(jQuery,window,document); |