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
6.0 KiB

10 years ago
  1. !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(conso