-
Notifications
You must be signed in to change notification settings - Fork 3
/
app-skeleton.min.20120906.js
11 lines (11 loc) · 2.2 KB
/
app-skeleton.min.20120906.js
1
2
3
4
5
6
7
8
9
10
11
/*
Application skeleton
@version 1.1.3
@author Vladimir Kuznetsov
@see <a href="https://github.com/mistakster/app-skeleton">Application skeleton</a>
*/
(function(f,j){function l(a){return"undefined"===typeof a||null===a}function i(a){return"[object Array]"===g.apply(a)?a:[a]}function n(a,b){for(var c in b)!l(b[c])&&l(a[c])&&(a[c]=b[c]);return a}var h=f[j]=f[j]||{},o=Array.prototype.push,p=Array.prototype.unshift,g=Object.prototype.toString,m=function(a,b,c){var d,e;if(a){a=a.split(".");for(d=a[0]===j?1:0;d<a.length;d+=1)e=c[a[d]]||{},c=c[a[d]]=d===a.length-1&&b?n(b,e):e}return c},q={};h.namespace=function(a,b){return m(a,b,f[j])};h.defaults=function(a,
b,c){if(b&&"[object Object]"===g.apply(b))c=m(a,b,q);else{var a=m(a,{},q),d;if(!l(b)){d=(""+b).split(".");for(b=0;b<d.length;b+=1)if(a&&"[object Object]"===g.apply(a)&&a.hasOwnProperty(d[b]))a=a[d[b]];else{a=c;break}}c=a}return c};var r=function(a){var b=k[a],c=[];if(a&&b&&(b.path&&!b.skip&&c.push(a),0<b.requires.length))for(a=b.requires.length-1;0<=a;a-=1)p.apply(c,r(b.requires[a]));return c},k={};h.register=function(a,b){var c,d,e;if("[object String]"===g.apply(b))var f=b,b=function(a){var b;if(a.path){"[object String]"===
g.apply(a.path)&&(a.path=[a.path]);for(b=a.path.length-1;0<=b;b--)a.path[b]=0===a.path[b].indexOf("!")?a.path[b].substr(1):a.path[b].replace(/(\.\w+)$/,"."+f+"$1")}return a};if(a){a=i(a);for(c=a.length-1;0<=c;c-=1)d=a[c],d.name&&(e={path:d.path||"",requires:d.requires||[],skip:d.skip||!1},k[d.name]="[object Function]"===g.apply(b)?b.call(e,e,d.name,c)||e:e)}return k};h.calculate=function(a,b){var c,d=[],a=i(a);for(c=0;c<a.length;c+=1)o.apply(d,r(a[c]));c=!b;var e,f,g=[],h={};for(f=0;f<d.length;f+=
1)if((e=d[f])&&!h[e])h[e]=!0,e=k[e],o.apply(g,i(e.path)),e.skip=e.skip||c;return g};var t=function(a,b){return b?n(b||{},s):s},s={queue:[],bootstraped:!1,loader:f.Modernizr&&f.Modernizr.load||f.yepnope};h.bootstrap=function(a){var b=t.apply(this,arguments);p.apply(b.queue,i(a));b.loader&&(b.loader.call(f,b.queue),b.queue=[],b.bootstraped=!0)};h.load=function(a){var b=t.apply(this,arguments);"[object Function]"===g.apply(a)&&(a={load:[],complete:a});b.bootstraped&&b.loader?b.loader.call(f,a):Array.prototype.push.apply(b.queue,
i(a))}})(this,"App");