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.

0 lines
5.9 KiB

  1. !function(b,p,v,h){b.site=b.fn.site=function(e){var a,i=(new Date).getTime(),t=[],n=e,o="string"==typeof n,c=[].slice.call(arguments,1),l=b.isPlainObject(e)?b.extend(!0,{},b.site.settings,e):b.extend({},b.site.settings),s=l.namespace,u=l.error,r="module-"+s,m=b(v),d=this,g=m.data(r),f={initialize:function(){f.instantiate()},instantiate:function(){f.verbose("Storing instance of site",f),g=f,m.data(r,f)},normalize:function(){f.fix.console(),f.fix.requestAnimationFrame()},fix:{console:function(){f.debug("Normalizing window.console"),console!==h&&console.log!==h||(f.verbose("Console not available, normalizing events"),f.disable.console()),void 0!==console.group&&void 0!==console.groupEnd&&void 0!==console.groupCollapsed||(f.verbose("Console group not available, normalizing events"),p.console.group=function(){},p.console.groupEnd=function(){},p.console.groupCollapsed=function(){}),void 0===console.markTimeline&&(f.verbose("Mark timeline not available, normalizing events"),p.console.markTimeline=function(){})},consoleClear:function(){f.debug("Disabling programmatic console clearing"),p.console.clear=function(){}},requestAnimationFrame:function(){f.debug("Normalizing requestAnimationFrame"),p.requestAnimationFrame===h&&(f.debug("RequestAnimationFrame not available, normalizing event"),p.requestAnimationFrame=p.requestAnimationFrame||p.mozRequestAnimationFrame||p.webkitRequestAnimationFrame||p.msRequestAnimationFrame||function(e){setTimeout(e,0)})}},moduleExists:function(e){return b.fn[e]!==h&&b.fn[e].settings!==h},enabled:{modules:function(e){var o=[];return e=e||l.modules,b.each(e,function(e,n){f.moduleExists(n)&&o.push(n)}),o}},disabled:{modules:function(e){var o=[];return e=e||l.modules,b.each(e,function(e,n){f.moduleExists(n)||o.push(n)}),o}},change:{setting:function(t,s,e,r){e="string"==typeof e?"all"===e?l.modules:[e]:e||l.modules,r=r===h||r,b.each(e,function(e,n){var o,i=!f.moduleExists(n)||(b.fn[n].settings.namespace||!1);f.moduleExists(n)&&(f.verbose("Changing default setting",t,s,n),b.fn[n].settings[t]=s,r&&i&&0<(o=b(":data(module-"+i+")")).length&&(f.verbose("Modifying existing settings",o),o[n]("setting",t,s)))})},settings:function(i,e,t){e="string"==typeof e?[e]:e||l.modules,t=t===h||t,b.each(e,function(e,n){var o;f.moduleExists(n)&&(f.verbose("Changing default setting",i,n),b.extend(!0,b.fn[n].settings,i),t&&s&&0<(o=b(":data(module-"+s+")")).length&&(f.verbose("Modifying existing settings",o),o[n]("setting",i)))})}},enable:{console:function(){f.console(!0)},debug:function(e,n){e=e||l.modules,f.debug("Enabling debug for modules",e),f.change.setting("debug",!0,e,n)},verbose:function(e,n){e=e||l.modules,f.debug("Enabling verbose debug for modules",e),f.change.setting("verbose",!0,e,n)}},disable:{console:function(){f.console(!1)},debug:function(e,n){e=e||l.modules,f.debug("Disabling debug for modules",e),f.change.setting("debug",!1,e,n)},verbose:function(e,n){e=e||l.modules,f.debug("Disabling verbose debug for modules",e),f.change.setting("verbose",!1,e,n)}},console:function(e){if(e){if(g.cache.console===h)return void f.error(u.console);f.debug("Restoring console function"),p.console=g.cache.console}else f.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(){},markTimeline:function(){},warn:function(){}}},destroy:function(){f.verbose("Destroying previous site for",m),m.removeData(r)},cache:{},setting:function(e,n){if(b.isPlainObject(e))b.extend(!0,l,e);else{if(n===h)return l[e];l[e]=n}},internal:function(e,n){if(b.isPlainObject(e))b.extend(!0,f,e);else{if(n===h)return f[e];f[e]=n}},debug:function(){l.debug&&(l.performance?f.performance.log(arguments):(f.debug=Function.prototype.bind.call(console.info,console,l.name+":"),f.debug.apply(console,arguments)))},verbose:function(){l.verbose&&l.debug&&(l.performance?f.performance.log(arguments):(f.verbose=Function.prototype.bind.call(console.info,console,l.name+":"),f.verbose.apply(console,arguments)))},error:function