generator-beez
Version:
A beez project generator for Yeoman
1 lines • 4.31 kB
JavaScript
!function(){define("beez-utils/browser",["require","exports","module","beez.core","backbone","beez.ua"],function(e){var t=e("beez.core"),n=t.global||n;t.vendor._;var i=t.vendor.$,r=e("backbone"),o=t.Bucks.extend("beez.utils.BrowserAsync",{initialize:function(e){this.browser=e},dispose:function(){delete this.browser},hideAddress:function(e){return e=e||100,this.delay(e).then(function(){window.scroll(0,0)})}}),a={_prevOrientation:n.orientation,_initOrientation:n.orientation,initialize:function(){this.startHandleOrientation()},startHandleOrientation:function(){var e="onorientationchange"in window?"orientationchange":"resize",t=this;i(n).on(e,function(){var e=n.orientation;t._prevOrientation!==e&&(t.trigger("change:orientation",{prev:t._prevOrientation,current:e,init:t._initOrientation===e?!0:!1}),t._prevOrientation=e)})},getComputedStyle:function(e){return document.defaultView.getComputedStyle(e,"")},async:function(){return new o(this)},hideAddress:function(e){return new o(this).hideAddress(e)},getWindowSize:function(){return{width:window.innerWidth,height:window.innerHeight}},ua:{},getLanguage:function(){var e=navigator.language||navigator.browserLanguage||navigator.systemLanguage||navigator.userLanguage;return this.ua.android23&&c.browser.lang?c.browser.lang:e?e.substr(0,2):void 0}},c=e("beez.ua");c.setup(),a.ua=c;var u=t.extend("beez.utils.Browser",function(){},r.Events,a);return u})}(this),function(){define("beez-utils/uid",["require","exports","module"],function(){var e,t=function(){return e?e:e=this};return t.prototype.create=function(){var e=Math.floor(1e3*Math.random()),t=Date.now();return e+"_"+t.toString()},t})}(this),function(){define("beez-utils/timer",["require","exports","module","beez.core","beez-utils/uid"],function(e){var t=e("beez.core"),n=t.vendor._;t.getLogger("timer");var i=e("beez-utils/uid"),r=new i,o="beez_utils_timer_id",a=function(){this.running=!1,this._callbacks={},this._timerId=0};return a.prototype={addTimeout:function(e,t,i){var a=r.create();e[o]=a;var c={timer_id:a,callback:e,interval:t,time:Date.now()+t,context:i,type:"timeout",canceller:function(){this.type="canceled"}};return n.bindAll.apply(this,[c].concat(n.methods(c))),this._callbacks[a]=c,this.start(),a},addInterval:function(e,t,i){var a=r.create();e[o]=a;var c={timer_id:a,callback:e,interval:t,time:Date.now()+t,context:i,type:"interval",canceller:function(){this.type="canceled"}};return n.bindAll.apply(this,[c].concat(n.methods(c))),this._callbacks[a]=c,this.start(),a},clearInterval:function(e){var t;t="function"==typeof e&&e[o]?e[o]:e;var n=this._callbacks[t];if(!n)throw new Error("no callback to clear");n.canceller()},clearTimeout:function(e){var t;t="function"==typeof e&&e[o]?e[o]:e;var n=this._callbacks[t];n&&n.canceller()},_tick:function(){var e=Date.now(),t=this;n.each(this._callbacks,function(n){return n.time<e&&("canceled"!==n.type&&(n.context?n.callback.call(null,n.context):n.callback.call()),"interval"!==n.type&&delete t._callbacks[n.timer_id],n.time=e+n.interval),!0}),n.keys(this._callbacks).length||this.stop()},start:function(){if(!this.running){this.running=!0;var e=this,t=function n(){e.running&&(e._tick(),e._timerId=setTimeout(n,100))};t()}},stop:function(){this.running=!1,clearTimeout(this._timerId)}},a})}(this),function(e){define("beez.utils",["require","exports","module","beez.core","beez-utils/browser","beez-utils/timer"],function(t){var n=t("beez.core"),i=n.vendor._,r=n.getLogger("beez.utils");if(n.utils)return r.warn("beez.utils already defined."),n.utils;var o={initialize:function(){var i=t("beez-utils/browser"),r=t("beez-utils/timer");this.browser=new i,this.Timers=r,this.none=n.none,this.pixelRatio=e.devicePixelRatio||1},copyr:function c(e,t){for(var n in t){var r=e[n],o=t[n];i.isObject(r)&&!i.isArray(o)?c(e[n],t[n]):e[n]=t[n]}return e},is:function(e,t){var n=Object.prototype.toString.call(t).slice(8,-1);return void 0!==t&&null!==t&&n===e}},a=n.extend("beez.Utils",function(){return this.initialize()},o);return i.each(["Equal","Empty","Element","Arguments","Function","String","Number","Finite","Boolean","Date","RegExp","NaN","Null","Undefined"],function(e){a.prototype["is"+e]=i["is"+e]}),i.each(["Object","Array"],function(e){a.prototype["is"+e]=function(t){return this.is.apply(this,[e,t])}}),n.utils=new a,n.utils})}(this);