From 7700d1d34c5c3b94eb6e155a8ee7a8564388a445 Mon Sep 17 00:00:00 2001 From: Markus Kohlhase Date: Thu, 1 Aug 2013 19:10:29 +0200 Subject: [PATCH] added scaleapp --- ajax/libs/scaleapp/0.4.0/scaleapp.full.min.js | 6 +++++ ajax/libs/scaleapp/0.4.0/scaleapp.min.js | 6 +++++ ajax/libs/scaleapp/package.json | 24 +++++++++++++++++++ 3 files changed, 36 insertions(+) create mode 100644 ajax/libs/scaleapp/0.4.0/scaleapp.full.min.js create mode 100644 ajax/libs/scaleapp/0.4.0/scaleapp.min.js create mode 100644 ajax/libs/scaleapp/package.json diff --git a/ajax/libs/scaleapp/0.4.0/scaleapp.full.min.js b/ajax/libs/scaleapp/0.4.0/scaleapp.full.min.js new file mode 100644 index 000000000..a3d473df4 --- /dev/null +++ b/ajax/libs/scaleapp/0.4.0/scaleapp.full.min.js @@ -0,0 +1,6 @@ +/*! +scaleapp - v0.4.0 - 2013-08-01 +This program is distributed under the terms of the MIT license. +Copyright (c) 2011-2013 Markus Kohlhase +*/ +!function(){var a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z=[].slice,A={}.hasOwnProperty,B=function(a,b){function c(){this.constructor=a}for(var d in b)A.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a},C=[].indexOf||function(a){for(var b=0,c=this.length;c>b;b++)if(b in this&&this[b]===a)return b;return-1},D=function(a,b){return function(){return a.apply(b,arguments)}};null==String.prototype.trim&&(String.prototype.trim=function(){return this.replace(/^\s\s*/,"").replace(/\s\s*$/,"")}),m=function(a){var b,c,d,e,f;if(null==a&&(a=function(){}),c=a.toString().match(/function[^(]*\(([^)]*)\)/),null==c||c.length<2)return[];for(c=c[1],c=c.split(/\s*,\s*/),f=[],d=0,e=c.length;e>d;d++)b=c[d],""!==b.trim()&&f.push(b);return f},s=function(a,b,c){var d,e,f,g,h,i,j,k;if(null==a&&(a=[]),null==b&&(b=function(){}),d=a.length,g=[],0===d)return b(null,g);for(e=[],k=[],f=i=0,j=a.length;j>i;f=++i)h=a[f],k.push(function(a,f){var h,i;i=function(){var a,h,i;if(h=arguments[0],i=2<=arguments.length?z.call(arguments,1):[],h){if(e[f]=h,!c)return b(e,g)}else g[f]=i.length<2?i[0]:i;return 0===--d?function(){var b,c,d;for(d=[],b=0,c=e.length;c>b;b++)a=e[b],null!=a&&d.push(a);return d}().length>0?b(e,g):b(null,g):void 0};try{return a(i)}catch(j){return h=j,i(h)}}(h,f));return k},t=function(a,b,c){var d,e,f,g,h;return null==a&&(a=[]),null==b&&(b=function(){}),f=-1,d=a.length,h=[],0===d?b(null,h):(e=[],g=function(){var i,j,k;if(j=arguments[0],k=2<=arguments.length?z.call(arguments,1):[],j){if(e[f]=j,!c)return b(e,h)}else h[f]=k.length<2?k[0]:k;if(++f===d)return function(){var a,b,c;for(c=[],a=0,b=e.length;b>a;a++)i=e[a],null!=i&&c.push(i);return c}().length>0?b(e,h):b(null,h);try{return a[f](g)}catch(l){return i=l,g(i)}},g())},u=function(a,b){var c,d;return c=-1,0===a.length?b():(d=function(){var e,f;return e=arguments[0],f=2<=arguments.length?z.call(arguments,1):[],null!=e?b(e):++c===a.length?b.apply(null,[null].concat(z.call(f))):a[c].apply(a,z.call(f).concat([d]))},d())},l=function(a,b,c,d){var e,f;return null==a&&(a=[]),f=function(){var c,d,f;for(f=[],c=0,d=a.length;d>c;c++)e=a[c],f.push(function(a){return function(c){return b(a,c)}}(e));return f}(),x.runParallel(f,c,d)},x={doForAll:l,runParallel:s,runSeries:t,runWaterfall:u,getArgumentNames:m,hasArgument:function(a,b){return null==b&&(b=1),x.getArgumentNames(a).length>=b}},f=function(){function a(a,b){this.cascadeChannels=null!=b?b:!1,this.channels={},a instanceof Object?this.installTo(a):a===!0&&(this.cascadeChannels=!0)}return a.prototype.on=function(b,c,d){var e,f,g,h,i,j,k,l,m,n;if(null==d&&(d=this),null==(j=this.channels)[b]&&(j[b]=[]),h=this,b instanceof Array){for(m=[],k=0,l=b.length;l>k;k++)e=b[k],m.push(this.on(e,c,d));return m}if("object"==typeof b){n=[];for(f in b)i=b[f],n.push(this.on(f,i,c));return n}return"function"!=typeof c?!1:"string"!=typeof b?!1:(g={context:d,callback:c},{attach:function(){return h.channels[b].push(g),this},detach:function(){return a._rm(h,b,g.callback),this}}.attach())},a.prototype.off=function(b,c){var d;switch(typeof b){case"string":"function"==typeof c&&a._rm(this,b,c),"undefined"==typeof c&&a._rm(this,b);break;case"function":for(d in this.channels)a._rm(this,d,b);break;case"undefined":for(d in this.channels)a._rm(this,d);break;case"object":for(d in this.channels)a._rm(this,d,null,b)}return this},a.prototype.emit=function(a,b,c){var d,e,f,g;return null==c&&(c=function(){}),"function"==typeof b&&(c=b,b=void 0),"string"!=typeof a?!1:(f=this.channels[a]||[],g=function(){var c,d,g;for(g=[],c=0,d=f.length;d>c;c++)e=f[c],g.push(function(c){return function(d){var e;try{return x.hasArgument(c.callback,3)?c.callback.apply(c.context,[b,a,d]):d(null,c.callback.apply(c.context,[b,a]))}catch(f){return e=f,d(e)}}}(e));return g}(),x.runSeries(g,function(a){var b,d;return a&&(b=new Error(function(){var b,c,e;for(e=[],b=0,c=a.length;c>b;b++)d=a[b],null!=d&&e.push(d.message);return e}().join("; "))),c(b)},!0),this.cascadeChannels&&(d=a.split("/")).length>1&&this.emit(d.slice(0,-1).join("/"),b,c),this)},a.prototype.installTo=function(a){var b,c;if("object"==typeof a)for(b in this)c=this[b],null==a[b]&&(a[b]=c);return this},a._rm=function(a,b,c,d){var e;if(null!=a.channels[b])return a.channels[b]=function(){var f,g,h,i;for(h=a.channels[b],i=[],f=0,g=h.length;g>f;f++)e=h[f],(null!=c?e.callback!==c:null!=d?e.context!==d:e.context!==a)&&i.push(e);return i}()},a}(),g=function(){function a(a,b,c){this.core=a,this.instanceId=b,this.options=null!=c?c:{},this.core._mediator.installTo(this)}return a}(),i=function(a,b,c){return typeof b!==a?""+c+" has to be a "+a:void 0},b=function(){function a(a){null==a&&(a=g),this._modules={},this._plugins=[],this._instances={},this._sandboxes={},this._mediator=new f,this.Sandbox=a,this.Mediator=f}return a.prototype.log={error:function(){},log:function(){},info:function(){},warn:function(){},enable:function(){}},a.prototype.register=function(a,b,c){var d;return null==c&&(c={}),(d=i("string",a,"module ID")||i("function",b,"creator")||i("object",c,"option parameter"))?(this.log.error("could not register module '"+a+"': "+d),this):null!=this._modules[a]?(this.log.warn("module "+a+" was already registered"),this):(this._modules[a]={creator:b,options:c,id:a},this)},a.prototype.start=function(a,b,c){var d,e,f,g,h,j=this;return null==b&&(b={}),null==c&&(c=function(){}),0===arguments.length?this._startAll():a instanceof Array?this._startAll(a,b):"function"==typeof a?this._startAll(null,a):("function"==typeof b&&(c=b,b={}),e=function(a){return j.log.error(a),c(new Error("could not start module: "+a.message)),j},(d=i("string",a,"module ID")||i("object",b,"second parameter")||(null==this._modules[a]?"module doesn't exist":void 0))?e(d):(f=b.instanceId||a,(null!=(h=this._instances[f])?h.running:void 0)===!0?e(new Error("module was already started")):(g=function(a,b){if(a)return j.log.error(a),c(a);try{return x.hasArgument(b.init,2)?b.init(b.options,function(a){return a||(b.running=!0),c(a)}):(b.init(b.options),b.running=!0,c(null))}catch(f){if(d=f)return e(d)}},this.boot(function(){return j._createInstance(a,b.instanceId,b.options,g)}))))},a.prototype._createInstance=function(a,b,c,d){var e,f,g,h,i,j,k,l,m,n=this;if(null==b&&(b=a),g=this._modules[a],null!=this._instances[b])return d(this._instances[b]);for(e={},m=[g.options,c],k=0,l=m.length;l>k;k++)if(h=m[k])for(f in h)j=h[f],null==e[f]&&(e[f]=j);return i=new this.Sandbox(this,b,e),i.moduleId=a,this._runSandboxPlugins("init",i,function(){var a;return a=new g.creator(i),"function"!=typeof a.init?d(new Error("module has no 'init' method")):(a.options=e,a.id=b,n._instances[b]=a,n._sandboxes[b]=i,d(null,a))})},a.prototype._runSandboxPlugins=function(a,b,c){var d,e;return e=function(){var c,e,f,g,h;for(f=this._plugins,h=[],c=0,e=f.length;e>c;c++)d=f[c],"function"==typeof(null!=(g=d.plugin)?g[a]:void 0)&&h.push(function(c){var d;return d=c.plugin[a],function(a){return x.hasArgument(d,3)?d(b,c.options,a):(d(b,c.options),a())}}(d));return h}.call(this),x.runSeries(e,c,!0)},a.prototype._startAll=function(a,b){var c,d,e,f=this;return null==a&&(a=function(){var a;a=[];for(d in this._modules)a.push(d);return a}.call(this)),e=function(a,b){return f.start(a,f._modules[a].options,b)},c=function(c){var d,e,f,g;return(null!=c?c.length:void 0)>0&&(f=function(){var b,d,f;for(f=[],e=b=0,d=c.length;d>b;e=++b)g=c[e],null!=g&&f.push("'"+a[e]+"'");return f}(),d=new Error("errors occoured in the following modules: "+f)),"function"==typeof b?b(d):void 0},x.doForAll(a,e,c,!0),this},a.prototype.stop=function(a,b){var c,d,e=this;return 0===arguments.length||"function"==typeof a?x.doForAll(function(){var a;a=[];for(d in this._instances)a.push(d);return a}.call(this),function(){return e.stop.apply(e,arguments)},a,!0):(c=this._instances[a])&&(delete this._instances[a],this._mediator.off(c),this._runSandboxPlugins("destroy",this._sandboxes[a],function(){return null==c.destroy&&(c.destroy=function(){}),x.hasArgument(c.destroy)?c.destroy(function(d){return d&&(this._instances[a]=c),"function"==typeof b?b(d):void 0}):(c.destroy(),"function"==typeof b?b(null):void 0)})),this},a.prototype.use=function(a,b){var c,d,e;if(a instanceof Array)for(d=0,e=a.length;e>d;d++)c=a[d],"function"==typeof c&&this.use(c),"object"==typeof c&&this.use(c.plugin,c.options);else{if("function"!=typeof a)return this;this._plugins.push({creator:a,options:b})}return this},a.prototype.boot=function(a){var b,c,d;return b=this,d=function(){var a,d,e,f;for(e=this._plugins,f=[],a=0,d=e.length;d>a;a++)c=e[a],c.booted!==!0&&f.push(function(a){return x.hasArgument(a.creator,3)?function(c){var d;return d=a.creator(b,a.options,function(b){return b||(a.booted=!0,a.plugin=d),c()})}:function(c){return a.plugin=a.creator(b,a.options),a.booted=!0,c()}}(c));return f}.call(this),x.runSeries(d,a,!0),this},a.prototype.on=function(){return this._mediator.on.apply(this._mediator,arguments)},a.prototype.off=function(){return this._mediator.off.apply(this._mediator,arguments)},a.prototype.emit=function(){return this._mediator.emit.apply(this._mediator,arguments)},a}(),h={VERSION:"0.4.0",util:x,Mediator:f,Sandbox:g,Core:b,plugins:{},modules:{}},null!=("undefined"!=typeof define&&null!==define?define.amd:void 0)?define(function(){return h}):"undefined"!=typeof window&&null!==window?null==window.scaleApp&&(window.scaleApp=h):null!=("undefined"!=typeof module&&null!==module?module.exports:void 0)&&(module.exports=h),q=function(a){var b,c;return b=function(a){return a.replace(/\n/g,"").replace(/[\t ]+\[\t ]+\<").replace(/\>[\t ]+$/g,">")},a.html=c={clean:b},{init:function(a){return a.getContainer=function(){switch(typeof a.options.container){case"string":return document.getElementById(a.options.container);case"object":return a.options.container;default:return document.getElementById(a.instanceId)}},{html:c}}}},null!=("undefined"!=typeof define&&null!==define?define.amd:void 0)?define(function(){return q}):null!=("undefined"!=typeof window&&null!==window?window.scaleApp:void 0)?window.scaleApp.plugins.dom=q:null!=("undefined"!=typeof module&&null!==module?module.exports:void 0)&&(module.exports=q),q=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p;return c="en",f=function(){return(("undefined"!=typeof navigator&&null!==navigator?navigator.language:void 0)||("undefined"!=typeof navigator&&null!==navigator?navigator.browserLanguage:void 0)||c).split("-")[0]},d="i18n",h=function(a,b,c,d){var e,f;return(null!=(e=b[c])?e[a]:void 0)||(null!=(f=d[c])?f[a]:void 0)},e=function(a,b,d,e){return null==b&&(b={}),null==d&&(d=""),h(a,b,d,e)||h(a,b,d.substring(0,2),e)||h(a,b,c,e)||a},b=function(a,b){var c,d,e,f,g;if("object"!=typeof a)return!1;g=[];for(d in a)e=a[d],null==b[d]&&(b[d]={}),g.push(function(){var a,g;g=[];for(c in e)f=e[c],g.push(null!=(a=b[d])[c]?(a=b[d])[c]:a[c]=f);return g}());return g},k=new a.Mediator,j=f(),i={},a.getBrowserLanguage=f,a.baseLanguage=c,g=function(){return j},o=function(){return k.off.apply(k,[d].concat(z.call(arguments)))},l=function(){return k.on.apply(k,[d].concat(z.call(arguments)))},n=function(a){return"string"==typeof a?(j=a,k.emit(d,j)):void 0},m=function(a){return"object"==typeof a?(i=a,!0):!1},p=function(a,b){return e(a,b,j,i)},a.i18n={setLanguage:n,getLanguage:g,setGlobal:m,onChange:l,_:p,unsubscribe:o},a.Sandbox.prototype.i18n={onChange:l,unsubscribe:o,getLanguage:g},{id:"i18n",init:function(a){return a.i18n.addLocal=function(c){var d;return null==(d=a.options).i18n&&(d.i18n={}),b(c,a.options.i18n)},a._=function(b){return p(b,a.options.localDict||a.options.i18n)}}}},null!=("undefined"!=typeof define&&null!==define?define.amd:void 0)?define(function(){return q}):null!=("undefined"!=typeof window&&null!==window?window.scaleApp:void 0)?window.scaleApp.plugins.i18n=q:null!=("undefined"!=typeof module&&null!==module?module.exports:void 0)&&(module.exports=q),q=function(a){var b;return b=function(a){var b,c,d;d=[];for(b in a)c=a[b],d.push(b);return d},a.lsInstances=function(){return b(a._instances)},a.lsModules=function(){return b(a._modules)},a.lsPlugins=function(){var b,c,d,e,f,g;for(e=a._plugins,g=[],c=0,d=e.length;d>c;c++)b=e[c],null!=(null!=(f=b.plugin)?f.id:void 0)&&g.push(b.plugin.id);return g}},null!=("undefined"!=typeof define&&null!==define?define.amd:void 0)?define(function(){return q}):null!=("undefined"!=typeof window&&null!==window?window.scaleApp:void 0)?window.scaleApp.plugins.ls=q:null!=("undefined"!=typeof module&&null!==module?module.exports:void 0)&&(module.exports=q),q=function(a){var b;return a.state=b=new a.Mediator(!0),{init:function(a){return b.emit("init/"+a.moduleId+"/"+a.instanceId,{instanceId:a.instanceId,moduleId:a.moduleId})},destroy:function(a){return b.emit("destroy/"+a.moduleId+"/"+a.instanceId,{instanceId:a.instanceId,moduleId:a.moduleId})}}},null!=("undefined"!=typeof define&&null!==define?define.amd:void 0)?define(function(){return q}):null!=("undefined"!=typeof window&&null!==window?window.scaleApp:void 0)?window.scaleApp.plugins.modulestate=q:null!=("undefined"!=typeof module&&null!==module?module.exports:void 0)&&(module.exports=q),q=function(a){var b,c,d;return c=function(a){function b(a){var c,d;b.__super__.constructor.call(this);for(c in a)d=a[c],null==this[c]&&(this[c]=d)}return B(b,a),b.prototype.set=function(a,c,d){var e,f;switch(null==d&&(d=!1),typeof a){case"object":for(e in a)f=a[e],this.set(e,f,!0);d||this.emit(b.CHANGED,function(){var b;b=[];for(e in a)f=a[e],b.push(e);return b}());break;case"string":"set"!==a&&"get"!==a&&this[a]!==c&&(this[a]=c,d||this.emit(b.CHANGED,[a]));break;default:"undefined"!=typeof console&&null!==console&&"function"==typeof console.error&&console.error("key is not a string")}return this},b.prototype.change=function(a,c){return"function"==typeof a?this.on(b.CHANGED,a,c):0===arguments.length?this.emit(b.CHANGED):void 0},b.prototype.notify=function(){return this.change()},b.prototype.get=function(a){return this[a]},b.prototype.toJSON=function(){var a,b,c;a={};for(b in this)A.call(this,b)&&(c=this[b],a[b]=c);return a},b.CHANGED="changed",b}(a.Mediator),d=function(){function a(a){a&&this.setModel(a)}return a.prototype.setModel=function(a){return this.model=a,this.model.change(function(){return this.render()},this)},a.prototype.render=function(){},a}(),b=function(){function a(a,b){this.model=a,this.view=b}return a}(),a.Model=c,a.View=d,a.Controller=b},null!=("undefined"!=typeof define&&null!==define?define.amd:void 0)?define(function(){return q}):null!=("undefined"!=typeof window&&null!==window?window.scaleApp:void 0)?window.scaleApp.plugins.mvc=q:null!=("undefined"!=typeof module&&null!==module?module.exports:void 0)&&(module.exports=q),q=function(a){var b,c,d,e,f,g,h;return f={},c=["on","emit","off"],b=function(a,d,e){var g,h,i,j,k,l,m,n,o,p,q;if("object"==typeof a)return o=!0,C.call(function(){var c;c=[];for(j in a)l=a[j],c.push(b(j,l));return c}(),o)>=0;if("object"==typeof d)return p=!0,C.call(function(){var c;c=[];for(j in d)l=d[j],c.push(b(a,j,l));return c}(),p)>=0;if(null!=e){if(k=null!=f[a]?f[a]:f[a]={},"string"==typeof e&&(e="*"===e?["__all__"]:[e]),"string"==typeof d){if("*"===d)return q=!0,C.call(function(){var d,f,g;for(g=[],d=0,f=c.length;f>d;d++)h=c[d],g.push(b(a,h,e));return g}(),q)>=0;for(g=null!=k[d]?k[d]:k[d]={},m=0,n=e.length;n>m;m++)i=e[m],g[i]=!0;return!0}return!1}return!1},g=function(a,b,c){var d,e;return d=f[a],null==c?(delete d[b],!0):(null!=d?null!=(e=d[b])?e[c]:void 0:void 0)?(delete d[b][c],!0):!1},e=function(a,b,c){var d,e;return d=(null!=(e=f[a])?e[b]:void 0)||{},null!=c&&(d[c]||d.__all__)?!0:(console.warn("'"+a+"' has no permissions for '"+b+"' with '"+c+"'"),!1)},d=function(a,b,c,d){var f,g,h;return(null!=d?d.length:void 0)>0&&(g=d[0]),h=g instanceof Array?0===function(){var c,d,h;for(h=[],c=0,d=g.length;d>c;c++)f=g[c],e(a.instanceId,b,f)||h.push(f);return h}().length:e(a.instanceId,b,g),h===!0?c.apply(a,d):!1},h=function(a,b){var c;return c=a[b],"function"==typeof c?a[b]=function(){return d(a,b,c,arguments)}:void 0},a.permission={add:b,remove:g},{init:function(a){var b,d,e,f;for(f=[],d=0,e=c.length;e>d;d++)b=c[d],f.push(h(a,b));return f}}},null!=("undefined"!=typeof define&&null!==define?define.amd:void 0)?define(function(){return q}):null!=("undefined"!=typeof window&&null!==window?window.scaleApp:void 0)?window.scaleApp.plugins.permission=q:null!=("undefined"!=typeof module&&null!==module?module.exports:void 0)&&(module.exports=q),q=function(a){var b,c,d;return d=function(a){return""+a+"/leave"},c=function(a){return""+a+"/enter"},b=function(a){function b(a){var d,e,f;if(null==a&&(a={}),this.fire=D(this.fire,this),b.__super__.constructor.call(this),this.states=[],this.transitions={},null!=a.states&&this.addState(a.states),null!=a.start&&(this.addState(a.start),this.start=a.start,this.current=a.start,this.emit(c(this.start))),null!=a.transitions){f=a.transitions;for(d in f)e=f[d],this.addTransition(d,e)}}return B(b,a),b.prototype.start=null,b.prototype.current=null,b.prototype.exit=null,b.prototype.addState=function(a,b){var e,f,g,h;return null==b&&(b={}),a instanceof Array?!(C.call(function(){var b,c,d;for(d=[],b=0,c=a.length;c>b;b++)f=a[b],d.push(this.addState(f));return d}.call(this),!1)>=0):"object"==typeof a?!(C.call(function(){var b;b=[];for(e in a)h=a[e],b.push(this.addState(e,h));return b}.call(this),!1)>=0):"string"!=typeof a?!1:C.call(this.states,a)>=0?!1:(this.states.push(a),g=[],null!=b.enter&&g.push(this.on(c(a),b.enter)),null!=b.leave&&g.push(this.on(d(a),b.leave)),!(C.call(g,!1)>=0))},b.prototype.addTransition=function(a,b){var c,d,e;if(!("string"==typeof a&&"string"==typeof b.to&&null==this.transitions[a]&&(e=b.to,C.call(this.states,e)>=0)))return!1;if(b.from instanceof Array){if(c=C.call(function(){var a,c,e,f;for(e=b.from,f=[],a=0,c=e.length;c>a;a++)d=e[a],f.push(C.call(this.states,d)>=0);return f}.call(this),!1)>=0,c!==!1)return!1}else if("string"!=typeof b.from)return!1;return this.transitions[a]={from:b.from,to:b.to},!0},b.prototype.onEnter=function(a,b){var d;return d=!a,C.call(this.states,d)>=0?!1:this.on(c(a),b)},b.prototype.onLeave=function(a,b){var c;return c=!a,C.call(this.states,c)>=0?!1:this.on(d(a),b)},b.prototype.fire=function(a,b){var e,f=this;return null==b&&(b=function(){}),e=this.transitions[a],null!=e&&this.can(a)?(this.emit(d(this.current),e,function(a){return null!=a?b(a):f.emit(c(e.to),e,function(a){return null==a&&(f.current=e.to),b(a)})}),!0):!1},b.prototype.can=function(a){var b,c;return b=this.transitions[a],(null!=b?b.from:void 0)===this.current||(c=this.current,C.call(b.from,c)>=0)||"*"===b.from},b}(a.Mediator),a.StateMachine=b},null!=("undefined"!=typeof define&&null!==define?define.amd:void 0)?define(function(){return q}):null!=("undefined"!=typeof window&&null!==window?window.scaleApp:void 0)?null==(y=window.scaleApp.plugins).state&&(y.state=q):null!=("undefined"!=typeof module&&null!==module?module.exports:void 0)&&(module.exports=q),c="http-bind/",e="http",d=5280,a="scaleApp.xmpp.cache.",n=function(a){var b;if(b=document.domain,"object"==typeof a){if(a.port&&(a.port=1*a.port,isNaN(a.port)&&(console.warn("the defined port "+a.port+" is not a number."),a.port=null)),a.host&&a.port&&a.path)return""+a.protocol+"://"+a.host+":"+a.port+"/"+a.path;if(a.host&&a.port&&!a.path)return""+a.protocol+"://"+a.host+":"+a.port+"/"+c;if(a.host&&!a.port&&a.path)return""+a.protocol+"://"+a.host+"/"+a.path;if(a.host&&!a.port&&!a.path)return""+a.protocol+"://"+a.host+"/"+c;if(!a.host&&a.port&&a.path)return""+a.protocol+"://"+b+":"+a.port+"/"+a.path;if(!a.host&&a.port&&!a.path)return""+a.protocol+"://"+b+":"+a.port+"/"+c;if(!a.host&&!a.port&&a.path)return""+a.protocol+"://"+b+"/"+a.path;if(!a.host&&!a.port&&!a.path)return""+a.protocol+"://"+b+"/"+c}return"http://"+b+"/"+c},k=function(a){return new Strophe.Connection(n({path:a.path,host:a.host,port:a.port,protocol:a.protocol}))},p=function(b){return""+a+b},v=function(a,b){var c,d,e,f,g,h,i,j;if("undefined"!=typeof sessionStorage&&null!==sessionStorage){for(h=["jid","sid","rid"],d=0,f=h.length;f>d;d++)c=h[d],null!=a[c]&&(sessionStorage[p(c)]=a[c]);for(i=["host","port","path","protocol"],j=[],e=0,g=i.length;g>e;e++)c=i[e],null!=b[c]&&j.push(sessionStorage[p(c)]=b[c]);return j}},j=function(){var a,b,c,d,e;if("undefined"!=typeof sessionStorage&&null!==sessionStorage){for(d=["jid","sid","rid","host","port","path","protocol"],e=[],b=0,c=d.length;c>b;b++)a=d[b],e.push(sessionStorage.removeItem(p(a)));return e}},r=function(){var a,b,c,d,e,f,g;if("undefined"!=typeof sessionStorage&&null!==sessionStorage){for(c={},f=["jid","sid","rid","host","port","path","protocol"],g=[],d=0,e=f.length;e>d;d++)b=f[d],a=p(b),sessionStorage[a]?g.push(c[b]=sessionStorage[a]):g.push(void 0);return g}},o=function(a){var b,c,d,e;for(e=["jid","sid","rid"],c=0,d=e.length;d>c;c++)if(b=e[c],!a[b]||"null"===a[b]||"undefined"===a[b])return!1;return!0},w=function(a){switch(a){case 0:return"Error";case 1:return"Connecting";case 2:return"Connection failed";case 3:return"Authenticating";case 4:return"Authentication failed";case 5:return"Connected";case 6:return"Disconnected";case 7:return"Disconnecting";case 8:return"Reconnected"}},q=function(a){var b,f,g,h,i,l,m,n,p,q;if("undefined"==typeof window||null===window)throw new Error("This plugin only can be used in the browser");return null==window.Strophe&&console.warn("This plugin requires strophe.js"),l=new a.Mediator,f=null,p=function(){return a.xmpp.connection=null,a.xmpp.jid=""},q=function(b){return a.xmpp.connection=b,a.xmpp.jid=b.jid},m=function(){var a,b,c,d,e,h,i,k,l;if(b=function(a){return 27===a.keyCode?"function"==typeof a.preventDefault?a.preventDefault():void 0:void 0},c=function(){return f?v(f,g):j()},null!=document.addEventListener){for(k=["keydown","keypress","keyup"],d=0,h=k.length;h>d;d++)a=k[d],document.addEventListener(a,b,!1);window.addEventListener("unload",c,!1)}else if(null!=document.attachEvent){for(l=["onkeydown","onkeypress","onkeyup"],e=0,i=l.length;i>e;e++)a=l[e],document.attachEvent(a,b);document.attachEvent("onunload",c)}return f.send($pres())},n=function(a){var b;switch(console.info("xmpp status changed: "+w(a)),b=Strophe.Status,a){case b.ERROR:return p(),l.emit("error","an error occoured");case b.CONNECTING:return p(),l.emit("connecting");case b.CONFAIL:return p(),l.emit("error","could not connect to xmpp server");case b.AUTHENTICATING:return p(),l.emit("authenticating");case b.AUTHFAIL:return p(),l.emit("authfail");case b.CONNECTED:return q(f),m(),l.emit("connected");case b.DISCONNECTED:return j(),p(),l.emit("disconnected");case b.DISCONNECTING:return p(),l.emit("disconnecting");case b.ATTACHED:return q(f),m(),l.emit("attached")}},b=function(a){return f=k(a),f.attach(a.jid,a.sid,a.rid,n,60)},g=r(),g&&o(g)?b(g):(l.emit("disconnected"),g={host:document.domain,port:d,path:c,protocol:e,jid:null,sid:null,rid:null}),i=function(a,b,c){return null!=c&&(c.path&&(g.path=c.path),c.port&&(g.port=c.port),c.host&&(g.host=c.host),c.protocol&&(g.protocol=c.protocol)),f=k(g),f.connect(a,b,n)},h=function(){var a;if(console.debug("try to disconnect"),(null!=f?f.connected:void 0)===!0)try{f.send($pres({type:"unavailable"})),f.pause(),f.disconnect()}catch(b){a=b}return j()},a.xmpp={jid:"",connection:null,login:i,logout:h,on:function(){return l.on.apply(l,arguments)},off:function(){return l.off.apply(l,arguments)}},null},null!=("undefined"!=typeof define&&null!==define?define.amd:void 0)?define(function(){return q}):null!=("undefined"!=typeof window&&null!==window?window.scaleApp:void 0)?window.scaleApp.plugins.xmpp=q:null!=("undefined"!=typeof module&&null!==module?module.exports:void 0)&&(module.exports=q),q=function(a,b){var c,d;return null==b&&(b={}),d=["register","start","stop","on","off","emit"],c=function(a,b){var c,e,f,g;for(a.sub={},e=function(c){return a.sub[c]=function(){return b[c].apply(b,arguments),a}},f=0,g=d.length;g>f;f++)c=d[f],e(c);return null!=b.permission?a.sub.permission={add:b.permission.add,remove:b.permission.remove}:void 0},{init:function(d,e,f){var g,h,i,j,k,l,m,n,o,p,q;if(d._subCore=j=new a.constructor,j.Sandbox=g=function(a){function b(){return o=b.__super__.constructor.apply(this,arguments)}return B(b,a),b}(a.Sandbox),i=[],b.inherit)for(p=a._plugins,k=0,m=p.length;m>k;k++)h=p[k],i.push({plugin:h.creator,options:h.options});if(b.use instanceof Array)for(q=b.use,l=0,n=q.length;n>l;l++)h=q[l],i.push(h);else"function"==typeof b.use&&i.push(b.use);return j.use(i).boot(function(a){return a?f(a):(c(d,j),f())})},destroy:function(a){return a._subCore.stop()}}},null!=("undefined"!=typeof define&&null!==define?define.amd:void 0)?define(function(){return q}):null!=("undefined"!=typeof window&&null!==window?window.scaleApp:void 0)?window.scaleApp.plugins.submodule=q:null!=("undefined"!=typeof module&&null!==module?module.exports:void 0)&&(module.exports=q),q=function(a){var b;return b=function(a,b,c){var d,e,f,g;if(c===!0){f=[];for(d in a)e=a[d],f.push(b[d]=e);return f}g=[];for(d in a)e=a[d],b.hasOwnProperty(d)||g.push(b[d]=e);return g},a.uniqueId=function(a){var b;for(null==a&&(a=8),b="";b.lengthb;b++)d=a[b],e.push(d);return e}();else{b={};for(c in a)d=a[c],b[c]=d}return b},a.countObjectKeys=function(a){var b,c;return"object"==typeof a?function(){var d;d=[];for(b in a)c=a[b],d.push(b);return d}().length:void 0},a.mixin=function(a,c,d){switch(null==d&&(d=!1),""+typeof c+"-"+typeof a){case"function-function":return b(c.prototype,a.prototype,d);case"function-object":return b(c.prototype,a,d);case"object-object":return b(c,a,d);case"object-function":return b(c,a.prototype,d)}}},null!=("undefined"!=typeof define&&null!==define?define.amd:void 0)?define(function(){return q}):null!=("undefined"!=typeof window&&null!==window?window.scaleApp:void 0)?window.scaleApp.plugins.util=q:null!=("undefined"!=typeof module&&null!==module?module.exports:void 0)&&(module.exports=q)}.call(this); \ No newline at end of file diff --git a/ajax/libs/scaleapp/0.4.0/scaleapp.min.js b/ajax/libs/scaleapp/0.4.0/scaleapp.min.js new file mode 100644 index 000000000..d6be72faf --- /dev/null +++ b/ajax/libs/scaleapp/0.4.0/scaleapp.min.js @@ -0,0 +1,6 @@ +/*! +scaleapp - v0.4.0 - 2013-08-01 +This program is distributed under the terms of the MIT license. +Copyright (c) 2011-2013 Markus Kohlhase +*/ +!function(){var a,b,c,d,e,f,g,h,i,j,k,l=[].slice;null==String.prototype.trim&&(String.prototype.trim=function(){return this.replace(/^\s\s*/,"").replace(/\s\s*$/,"")}),g=function(a){var b,c,d,e,f;if(null==a&&(a=function(){}),c=a.toString().match(/function[^(]*\(([^)]*)\)/),null==c||c.length<2)return[];for(c=c[1],c=c.split(/\s*,\s*/),f=[],d=0,e=c.length;e>d;d++)b=c[d],""!==b.trim()&&f.push(b);return f},h=function(a,b,c){var d,e,f,g,h,i,j,k;if(null==a&&(a=[]),null==b&&(b=function(){}),d=a.length,g=[],0===d)return b(null,g);for(e=[],k=[],f=i=0,j=a.length;j>i;f=++i)h=a[f],k.push(function(a,f){var h,i;i=function(){var a,h,i;if(h=arguments[0],i=2<=arguments.length?l.call(arguments,1):[],h){if(e[f]=h,!c)return b(e,g)}else g[f]=i.length<2?i[0]:i;return 0===--d?function(){var b,c,d;for(d=[],b=0,c=e.length;c>b;b++)a=e[b],null!=a&&d.push(a);return d}().length>0?b(e,g):b(null,g):void 0};try{return a(i)}catch(j){return h=j,i(h)}}(h,f));return k},i=function(a,b,c){var d,e,f,g,h;return null==a&&(a=[]),null==b&&(b=function(){}),f=-1,d=a.length,h=[],0===d?b(null,h):(e=[],g=function(){var i,j,k;if(j=arguments[0],k=2<=arguments.length?l.call(arguments,1):[],j){if(e[f]=j,!c)return b(e,h)}else h[f]=k.length<2?k[0]:k;if(++f===d)return function(){var a,b,c;for(c=[],a=0,b=e.length;b>a;a++)i=e[a],null!=i&&c.push(i);return c}().length>0?b(e,h):b(null,h);try{return a[f](g)}catch(m){return i=m,g(i)}},g())},j=function(a,b){var c,d;return c=-1,0===a.length?b():(d=function(){var e,f;return e=arguments[0],f=2<=arguments.length?l.call(arguments,1):[],null!=e?b(e):++c===a.length?b.apply(null,[null].concat(l.call(f))):a[c].apply(a,l.call(f).concat([d]))},d())},f=function(a,b,c,d){var e,f;return null==a&&(a=[]),f=function(){var c,d,f;for(f=[],c=0,d=a.length;d>c;c++)e=a[c],f.push(function(a){return function(c){return b(a,c)}}(e));return f}(),k.runParallel(f,c,d)},k={doForAll:f,runParallel:h,runSeries:i,runWaterfall:j,getArgumentNames:g,hasArgument:function(a,b){return null==b&&(b=1),k.getArgumentNames(a).length>=b}},b=function(){function a(a,b){this.cascadeChannels=null!=b?b:!1,this.channels={},a instanceof Object?this.installTo(a):a===!0&&(this.cascadeChannels=!0)}return a.prototype.on=function(b,c,d){var e,f,g,h,i,j,k,l,m,n;if(null==d&&(d=this),null==(j=this.channels)[b]&&(j[b]=[]),h=this,b instanceof Array){for(m=[],k=0,l=b.length;l>k;k++)e=b[k],m.push(this.on(e,c,d));return m}if("object"==typeof b){n=[];for(f in b)i=b[f],n.push(this.on(f,i,c));return n}return"function"!=typeof c?!1:"string"!=typeof b?!1:(g={context:d,callback:c},{attach:function(){return h.channels[b].push(g),this},detach:function(){return a._rm(h,b,g.callback),this}}.attach())},a.prototype.off=function(b,c){var d;switch(typeof b){case"string":"function"==typeof c&&a._rm(this,b,c),"undefined"==typeof c&&a._rm(this,b);break;case"function":for(d in this.channels)a._rm(this,d,b);break;case"undefined":for(d in this.channels)a._rm(this,d);break;case"object":for(d in this.channels)a._rm(this,d,null,b)}return this},a.prototype.emit=function(a,b,c){var d,e,f,g;return null==c&&(c=function(){}),"function"==typeof b&&(c=b,b=void 0),"string"!=typeof a?!1:(f=this.channels[a]||[],g=function(){var c,d,g;for(g=[],c=0,d=f.length;d>c;c++)e=f[c],g.push(function(c){return function(d){var e;try{return k.hasArgument(c.callback,3)?c.callback.apply(c.context,[b,a,d]):d(null,c.callback.apply(c.context,[b,a]))}catch(f){return e=f,d(e)}}}(e));return g}(),k.runSeries(g,function(a){var b,d;return a&&(b=new Error(function(){var b,c,e;for(e=[],b=0,c=a.length;c>b;b++)d=a[b],null!=d&&e.push(d.message);return e}().join("; "))),c(b)},!0),this.cascadeChannels&&(d=a.split("/")).length>1&&this.emit(d.slice(0,-1).join("/"),b,c),this)},a.prototype.installTo=function(a){var b,c;if("object"==typeof a)for(b in this)c=this[b],null==a[b]&&(a[b]=c);return this},a._rm=function(a,b,c,d){var e;if(null!=a.channels[b])return a.channels[b]=function(){var f,g,h,i;for(h=a.channels[b],i=[],f=0,g=h.length;g>f;f++)e=h[f],(null!=c?e.callback!==c:null!=d?e.context!==d:e.context!==a)&&i.push(e);return i}()},a}(),c=function(){function a(a,b,c){this.core=a,this.instanceId=b,this.options=null!=c?c:{},this.core._mediator.installTo(this)}return a}(),e=function(a,b,c){return typeof b!==a?""+c+" has to be a "+a:void 0},a=function(){function a(a){null==a&&(a=c),this._modules={},this._plugins=[],this._instances={},this._sandboxes={},this._mediator=new b,this.Sandbox=a,this.Mediator=b}return a.prototype.log={error:function(){},log:function(){},info:function(){},warn:function(){},enable:function(){}},a.prototype.register=function(a,b,c){var d;return null==c&&(c={}),(d=e("string",a,"module ID")||e("function",b,"creator")||e("object",c,"option parameter"))?(this.log.error("could not register module '"+a+"': "+d),this):null!=this._modules[a]?(this.log.warn("module "+a+" was already registered"),this):(this._modules[a]={creator:b,options:c,id:a},this)},a.prototype.start=function(a,b,c){var d,f,g,h,i,j=this;return null==b&&(b={}),null==c&&(c=function(){}),0===arguments.length?this._startAll():a instanceof Array?this._startAll(a,b):"function"==typeof a?this._startAll(null,a):("function"==typeof b&&(c=b,b={}),f=function(a){return j.log.error(a),c(new Error("could not start module: "+a.message)),j},(d=e("string",a,"module ID")||e("object",b,"second parameter")||(null==this._modules[a]?"module doesn't exist":void 0))?f(d):(g=b.instanceId||a,(null!=(i=this._instances[g])?i.running:void 0)===!0?f(new Error("module was already started")):(h=function(a,b){if(a)return j.log.error(a),c(a);try{return k.hasArgument(b.init,2)?b.init(b.options,function(a){return a||(b.running=!0),c(a)}):(b.init(b.options),b.running=!0,c(null))}catch(e){if(d=e)return f(d)}},this.boot(function(){return j._createInstance(a,b.instanceId,b.options,h)}))))},a.prototype._createInstance=function(a,b,c,d){var e,f,g,h,i,j,k,l,m,n=this;if(null==b&&(b=a),g=this._modules[a],null!=this._instances[b])return d(this._instances[b]);for(e={},m=[g.options,c],k=0,l=m.length;l>k;k++)if(h=m[k])for(f in h)j=h[f],null==e[f]&&(e[f]=j);return i=new this.Sandbox(this,b,e),i.moduleId=a,this._runSandboxPlugins("init",i,function(){var a;return a=new g.creator(i),"function"!=typeof a.init?d(new Error("module has no 'init' method")):(a.options=e,a.id=b,n._instances[b]=a,n._sandboxes[b]=i,d(null,a))})},a.prototype._runSandboxPlugins=function(a,b,c){var d,e;return e=function(){var c,e,f,g,h;for(f=this._plugins,h=[],c=0,e=f.length;e>c;c++)d=f[c],"function"==typeof(null!=(g=d.plugin)?g[a]:void 0)&&h.push(function(c){var d;return d=c.plugin[a],function(a){return k.hasArgument(d,3)?d(b,c.options,a):(d(b,c.options),a())}}(d));return h}.call(this),k.runSeries(e,c,!0)},a.prototype._startAll=function(a,b){var c,d,e,f=this;return null==a&&(a=function(){var a;a=[];for(d in this._modules)a.push(d);return a}.call(this)),e=function(a,b){return f.start(a,f._modules[a].options,b)},c=function(c){var d,e,f,g;return(null!=c?c.length:void 0)>0&&(f=function(){var b,d,f;for(f=[],e=b=0,d=c.length;d>b;e=++b)g=c[e],null!=g&&f.push("'"+a[e]+"'");return f}(),d=new Error("errors occoured in the following modules: "+f)),"function"==typeof b?b(d):void 0},k.doForAll(a,e,c,!0),this},a.prototype.stop=function(a,b){var c,d,e=this;return 0===arguments.length||"function"==typeof a?k.doForAll(function(){var a;a=[];for(d in this._instances)a.push(d);return a}.call(this),function(){return e.stop.apply(e,arguments)},a,!0):(c=this._instances[a])&&(delete this._instances[a],this._mediator.off(c),this._runSandboxPlugins("destroy",this._sandboxes[a],function(){return null==c.destroy&&(c.destroy=function(){}),k.hasArgument(c.destroy)?c.destroy(function(d){return d&&(this._instances[a]=c),"function"==typeof b?b(d):void 0}):(c.destroy(),"function"==typeof b?b(null):void 0)})),this},a.prototype.use=function(a,b){var c,d,e;if(a instanceof Array)for(d=0,e=a.length;e>d;d++)c=a[d],"function"==typeof c&&this.use(c),"object"==typeof c&&this.use(c.plugin,c.options);else{if("function"!=typeof a)return this;this._plugins.push({creator:a,options:b})}return this},a.prototype.boot=function(a){var b,c,d;return b=this,d=function(){var a,d,e,f;for(e=this._plugins,f=[],a=0,d=e.length;d>a;a++)c=e[a],c.booted!==!0&&f.push(function(a){return k.hasArgument(a.creator,3)?function(c){var d;return d=a.creator(b,a.options,function(b){return b||(a.booted=!0,a.plugin=d),c()})}:function(c){return a.plugin=a.creator(b,a.options),a.booted=!0,c()}}(c));return f}.call(this),k.runSeries(d,a,!0),this},a.prototype.on=function(){return this._mediator.on.apply(this._mediator,arguments)},a.prototype.off=function(){return this._mediator.off.apply(this._mediator,arguments)},a.prototype.emit=function(){return this._mediator.emit.apply(this._mediator,arguments)},a}(),d={VERSION:"0.4.0",util:k,Mediator:b,Sandbox:c,Core:a,plugins:{},modules:{}},null!=("undefined"!=typeof define&&null!==define?define.amd:void 0)?define(function(){return d}):"undefined"!=typeof window&&null!==window?null==window.scaleApp&&(window.scaleApp=d):null!=("undefined"!=typeof module&&null!==module?module.exports:void 0)&&(module.exports=d)}.call(this); \ No newline at end of file diff --git a/ajax/libs/scaleapp/package.json b/ajax/libs/scaleapp/package.json new file mode 100644 index 000000000..56d50f84a --- /dev/null +++ b/ajax/libs/scaleapp/package.json @@ -0,0 +1,24 @@ +{ + "name": "scaleapp", + "version": "0.4.0", + "filename": "scaleapp.min.js", + "description": "scaleApp is a JavaScript framework for scalable One-Page-Applications", + "author": "Markus Kohlhase ", + "homepage": "http://www.scaleapp.org", + "bugs": "http://github.com/flosse/scaleApp/issues", + "contributors": ["Markus Kohlhase", "Johann Philipp Strathausen"], + "licenses": [{"type": "MIT"}], + "repository": + { + "type": "git", + "url": "git://github.com/flosse/scaleApp.git" + }, + "maintainers": + [ + { + "name": "Markus Kohlhase", + "email": "mail@markus-kohlhase.de", + "web": "http://github.com/flosse/" + } + ] +}