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