You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

1 lines
6.0 KiB

!function(a,b,c,d){a.site=a.fn.site=function(e){var f,g,h=(new Date).getTime(),i=[],j=arguments[0],k="string"==typeof j,l=[].slice.call(arguments,1),m=a.isPlainObject(e)?a.extend(!0,{},a.site.settings,e):a.extend({},a.site.settings),n=m.namespace,o=m.error,p="module-"+n,q=a(c),r=q,s=this,t=r.data(p);return f={initialize:function(){f.instantiate()},instantiate:function(){f.verbose("Storing instance of site",f),t=f,r.data(p,f)},normalize:function(){f.fix.console(),f.fix.requestAnimationFrame()},fix:{console:function(){f.debug("Normalizing window.console"),(console===d||console.log===d)&&(f.verbose("Console not available, normalizing events"),f.disable.console()),("undefined"==typeof console.group||"undefined"==typeof console.groupEnd||"undefined"==typeof console.groupCollapsed)&&(f.verbose("Console group not available, normalizing events"),b.console.group=function(){},b.console.groupEnd=function(){},b.console.groupCollapsed=function(){}),"undefined"==typeof console.markTimeline&&(f.verbose("Mark timeline not available, normalizing events"),b.console.markTimeline=function(){})},consoleClear:function(){f.debug("Disabling programmatic console clearing"),b.console.clear=function(){}},requestAnimationFrame:function(){f.debug("Normalizing requestAnimationFrame"),b.requestAnimationFrame===d&&(f.debug("RequestAnimationFrame not available, normailizing event"),b.requestAnimationFrame=b.requestAnimationFrame||b.mozRequestAnimationFrame||b.webkitRequestAnimationFrame||b.msRequestAnimationFrame||function(a){setTimeout(a,0)})}},moduleExists:function(b){return a.fn[b]!==d&&a.fn[b].settings!==d},enabled:{modules:function(b){var c=[];return b=b||m.modules,a.each(b,function(a,b){f.moduleExists(b)&&c.push(b)}),c}},disabled:{modules:function(b){var c=[];return b=b||m.modules,a.each(b,function(a,b){f.moduleExists(b)||c.push(b)}),c}},change:{setting:function(b,c,e,g){e="string"==typeof e?"all"===e?m.modules:[e]:e||m.modules,g=g!==d?g:!0,a.each(e,function(d,e){var h,i=f.moduleExists(e)?a.fn[e].settings.namespace||!1:!0;f.moduleExists(e)&&(f.verbose("Changing default setting",b,c,e),a.fn[e].settings[b]=c,g&&i&&(h=a(":data(module-"+i+")"),h.size()>0&&(f.verbose("Modifying existing settings",h),h[e]("setting",b,c))))})},settings:function(b,c,e){c="string"==typeof c?[c]:c||m.modules,e=e!==d?e:!0,a.each(c,function(c,d){var g;f.moduleExists(d)&&(f.verbose("Changing default setting",b,d),a.extend(!0,a.fn[d].settings,b),e&&n&&(g=a(":data(module-"+n+")"),g.size()>0&&(f.verbose("Modifying existing settings",g),g[d]("setting",b))))})}},enable:{console:function(){f.console(!0)},debug:function(a,b){a=a||m.modules,f.debug("Enabling debug for modules",a),f.change.setting("debug",!0,a,b)},verbose:function(a,b){a=a||m.modules,f.debug("Enabling verbose debug for modules",a),f.change.setting("verbose",!0,a,b)}},disable:{console:function(){f.console(!1)},debug:function(a,b){a=a||m.modules,f.debug("Disabling debug for modules",a),f.change.setting("debug",!1,a,b)},verbose:function(a,b){a=a||m.modules,f.debug("Disabling verbose debug for modules",a),f.change.setting("verbose",!1,a,b)}},console:function(a){if(a){if(t.cache.console===d)return void f.error(o.console);f.debug("Restoring console function"),b.console=t.cache.console}else f.debug("Disabling console function"),t.cache.console=b.console,b.console={clear:function(){},error:function(){},group:function(){},groupCollapsed:function(){},groupEnd:function(){},info:function(){},log:function(){},markTimeline:function(){},warn:function(){}}},destroy:function(){f.verbose("Destroying previous site for",r),r.removeData(p)},cache:{},setting:function(b,c){if(a.isPlainObject(b))a.extend(!0,m,b);else{if(c===d)return m[b];m[b]=c}},internal:function(b,c){if(a.isPlainObject(b))a.extend(!0,f,b);else{if(c===d)return f[b];f[b]=c}},debug:function(){m.debug&&(m.performance?f.performance.log(arguments):(f.debug=Function.prototype.bind.call(console.info,console,m.name+":"),f.debug.apply(console,arguments)))},verbose:function(){m.verbose&&m.debug&&(m.performance?f.performance.log(arguments):(f.verbose=Function.prototype.bind.call(console.info,console,m.name+":"),f.verbose.apply(console,arguments)))},error:function(){f.error=Function.prototype.bind.call(console.error,console,m.name+":"),f.error.apply(console,arguments)},performance:{log:function(a){var b,c,d;m.performance&&(b=(new Date).getTime(),d=h||b,c=b-d,h=b,i.push({Element:s,Name:a[0],Arguments:[].slice.call(a,1)||"","Execution Time":c})),clearTimeout(f.performance.timer),f.performance.timer=setTimeout(f.performance.display,100)},display:function(){var b=m.name+":",c=0;h=!1,clearTimeout(f.performance.timer),a.each(i,function(a,b){c+=b["Execution Time"]}),b+=" "+c+"ms",(console.group!==d||console.table!==d)&&i.length>0&&(console.groupCollapsed(b),console.table?console.table(i):a.each(i,function(a,b){console.log(b.Name+": "+b["Execution Time"]+"ms")}),console.groupEnd()),i=[]}},invoke:function(b,c,e){var h,i,j,k=t;return c=c||l,e=s||e,"string"==typeof b&&k!==d&&(b=b.split(/[\. ]/),h=b.length-1,a.each(b,function(c,e){var g=c!=h?e+b[c+1].charAt(0).toUpperCase()+b[c+1].slice(1):b;if(a.isPlainObject(k[g])&&c!=h)k=k[g];else{if(k[g]!==d)return i=k[g],!1;if(!a.isPlainObject(k[e])||c==h)return k[e]!==d?(i=k[e],!1):(f.error(o.method,b),!1);k=k[e]}})),a.isFunction(i)?j=i.apply(e,c):i!==d&&(j=i),a.isArray(g)?g.push(j):g!==d?g=[g,j]:j!==d&&(g=j),i}},k?(t===d&&f.initialize(),f.invoke(j)):(t!==d&&f.destroy(),f.initialize()),g!==d?g:this},a.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:!0,performance:!0,modules:["accordion","api","checkbox","dimmer","dropdown","form","modal","nag","popup","rating","shape","sidebar","state","sticky","tab","transition","video","visit","visibility"],siteNamespace:"site",namespaceStub:{cache:{},config:{},sections:{},section:{},utilities:{}}},a.extend(a.expr[":"],{data:a.expr.createPseudo?a.expr.createPseudo(function(b){return function(c){return!!a.data(c,b)}}):function(b,c,d){return!!a.data(b,d[3])}})}(jQuery,window,document);