dou-rails 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +39 -0
- data/lib/dou/engine.rb +4 -0
- data/lib/dou/version.rb +3 -0
- data/lib/dou.rb +5 -0
- data/vendor/assets/javascripts/dou-min.js +1 -0
- data/vendor/assets/javascripts/dou.js +783 -0
- metadata +72 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: f212032ed226297e6384b770060d9209d5a97bb7
|
4
|
+
data.tar.gz: 6412f6c14c3d320b65d4d473c9c3ef98aa8a1b46
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 8c6b44ec31e41935290b2a2d9c9a3e6b6f739d419c5bfd66fbf3cce18ca3cdda6f52ce56a07083860b2aae8d9fbd5e397453f6a2ac0d59f2120c1d371c0ac24e
|
7
|
+
data.tar.gz: 239eb1687d3d126ae53760a0828c310cf427516772ceb691cd0683dfbb45b8b9d775a539cfcb33ee58d3499abe60ba318cd43dbd349f9c3ea339d252b84092c3
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2014 Hatio, Lab.
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
dou
|
2
|
+
=======
|
3
|
+
|
4
|
+
Light-weight javascript module framework
|
5
|
+
|
6
|
+
## Features
|
7
|
+
* Mixin base
|
8
|
+
|
9
|
+
## Usage
|
10
|
+
|
11
|
+
```js
|
12
|
+
var dou = require('dou');
|
13
|
+
|
14
|
+
function Super() {
|
15
|
+
...
|
16
|
+
}
|
17
|
+
|
18
|
+
function mixin1() {
|
19
|
+
this.methodA = function() { return 'foo'; };
|
20
|
+
}
|
21
|
+
|
22
|
+
function mixin2() {
|
23
|
+
this.methodB = function() { return 'bar'; };
|
24
|
+
}
|
25
|
+
|
26
|
+
var Clazz = dou.define({
|
27
|
+
extend : Super,
|
28
|
+
mixins : [mixin1, mixin2]
|
29
|
+
});
|
30
|
+
|
31
|
+
var inst = new Clazz();
|
32
|
+
|
33
|
+
inst.methodA();
|
34
|
+
inst.methodB();
|
35
|
+
|
36
|
+
```
|
37
|
+
|
38
|
+
## License
|
39
|
+
Copyright (c) 2014 Hearty, Oh. Licensed under the MIT license.
|
data/lib/dou/engine.rb
ADDED
data/lib/dou/version.rb
ADDED
data/lib/dou.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
(function(){define(["./compose"],function(a){"use strict";var b;return b={around:function(a,b){return function(){var c,d,e,f,g,h;for(f=arguments.length,c=new Array(f+1),c[0]=a.bind(this),e=g=0,h=c.length;h>g;e=++g)d=c[e],c[e+1]=arguments[e];return b.apply(this,c)}},before:function(a,b){var c;return c="function"==typeof b?b:b.obj[b.fnName],function(){return c.apply(this,arguments),a.apply(this,arguments)}},after:function(a,b){var c;return c="function"==typeof b?b:b.obj[b.fnName],function(){var b;return b=(a.unbound||a).apply(this,arguments),c.apply(this,arguments),b}},withAdvice:function(){return["before","after","around"].forEach(function(c){return this[c]=function(d,e){return a.unlockProperty(this,d,function(){return this[d]="function"==typeof this[d]?b[c](this[d],e):e,this[d]})}},this)}}})}).call(this),function(){var a={}.hasOwnProperty;define(["./utils","./debug"],function(b,c){"use strict";var d,e,f,g,h,i;if(d=c.enabled&&!b.isEnumerable(Object,"getOwnPropertyDescriptor"),e=["mixedIn","mixingIn"],d)try{Object.getOwnPropertyDescriptor(Object,"keys")}catch(j){f=j,d=!1}return h=function(b,c){var f,g,h;if(d){h=Object.create(null);for(g in b)a.call(b,g)&&e.indexOf(0>g)&&(f=Object.getOwnPropertyDescriptor(b,g),f.writable=c,h[g]=f);return Object.defineProperties(b,h)}},i=function(a,b,c){var e;return d&&a.hasOwnProperty(b)?(e=Object.getOwnPropertyDescriptor(a,b).writable,Object.defineProperties(a,b,{writable:!0}),c.call(a),Object.defineProperties(a,b,{writable:e})):c.call(a)},g=function(a,b){var c,d;if(!(b instanceof Array))return this.mixin(a,[b]);for(a.mixedIn=a.hasOwnProperty("mixedIn")?a.mixedIn:[],a.mixingIn=a.hasOwnProperty("mixingIn")?a.mixingIn:[],h(a,!1),c=0,d=b.length;d>c;c++)if(g=b[c],-1===a.mixedIn.indexOf(g)){if(a.mixingIn.indexOf(g)>-1)throw new Error("found cyclic dependencies between "+a.mixingIn);a.mixingIn.push(g),g.call(a),a.mixingIn.pop(),a.mixedIn.push(g)}return h(a,!0)},{mixin:g,unlockProperty:i}})}.call(this),function(){var a={}.hasOwnProperty;define([],function(){"use strict";var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u;return m=window||{},u=function(b,c,d){var e,f,g,h;d=d||{},e=d.obj||m,f=d.path||(e===m?"global":""),h=[];for(g in e)a.call(e,g)&&((t[b]||b)(c,e,g)&&console.log(""+f+"."+g+" -> ("+typeof e[g]+")",e[g]),h.push(e[g]&&"object"==typeof e[g]&&e[g]!==e?u(b,c,{obj:e[g],path:""+f+"."+g}):void 0));return h},r=function(a,b,c,d){return b&&typeof c!==b?console.error(""+c+" must be "+b):u(a,c,d)},t={name:function(a,b,c){return a===c},nameContains:function(a,b,c){return c.indexOf(a)>-1},type:function(a,b,c){return b[c]instanceof a},value:function(a,b,c){return b[c]===a},valueCoerced:function(a,b,c){return b[c]==a}},c=function(a,b){return r("name","string",a,b)},d=function(a,b){return r("nameContains","string",a,b)},e=function(a,b){return r("type","function",a,b)},f=function(a,b){return r("value",null,a,b)},g=function(a,b){return r("valueCoerced",null,a,b)},h=function(a,b){return u(a,null,b)},k=function(){var a;return a=[].slice.call(arguments),o.eventNames.length||(o.eventNames=b),o.actions=a.length?a:b,q()},l=function(){var a;return a=[].slice.call(arguments),o.actions.length||(o.actions=b),o.eventNames=a.length?a:b,q()},n=function(){return o.actions=[],o.eventNames=[],q()},s=function(){return o.actions=b,o.eventNames=b,q()},q=function(){return m.localStorage?(m.localStorage.setItem("logFilter_eventNames",o.eventNames),m.localStorage.setItem("logFilter_actions",o.actions)):void 0},p=function(){var c,d,e;d={eventNames:m.localStorage&&m.localStorage.getItem("logFilter_eventNames")||j,actions:m.localStorage&&m.localStorage.getItem("logFilter_actions")||i};for(c in d)a.call(d,c)&&(e=d[c],"string"==typeof e&&e!==b&&(d[c]=e.split(".")));return d},b="all",j=[],i=[],o=p(),{enable:function(a){return this.enabled=!!a,a&&m.console&&(console.info("Booting in DEBUG mode"),console.info("You can configure event logging with DEBUG.events.logAll()/logNone()/logByName()/logByAction()")),m.DEBUG=this},find:{byName:c,byNameContains:d,byType:e,byValue:f,byValueCoerced:g,custom:h},events:{logFilter:o,logByAction:k,logByName:l,logAll:s,logNone:n}}})}.call(this),function(){var a={}.hasOwnProperty,b=function(b,c){function d(){this.constructor=b}for(var e in c)a.call(c,e)&&(b[e]=c[e]);return d.prototype=c.prototype,b.prototype=new d,b.__super__=c.prototype,b};define(["./compose"],function(a){"use strict";var c;return c=function(c){var d;return d=c["extends"]?function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return b(c,a),c}(c["extends"]):function(){function a(){}return a}(),c.mixins&&a.mixin(d.prototype,c.mixins),c.name&&(d.name=c.name),d},{define:c}})}.call(this),function(){define(["./utils"],function(a){"use strict";var b,c,d,e,f,g,h,i;h=[].slice,b={withEvent:function(){var a,c,d,e,f;for(e=["on","off","once","trigger"],f=[],c=0,d=e.length;d>c;c++)a=e[c],f.push(this[a]=b[a]);return f},on:function(a,b,c){var e;return d(this,"on",a,[b,c])&&b?(this._events||(this._events={}),e=this._events[a]||(this._events[a]=[]),e.push({callback:b,context:c,ctx:c||this}),this):this},once:function(b,c,e){var f,g;return d(this,"once",b,[c,e])&&c?(g=this,f=a.once(function(){return g.off(b,f),c.apply(this,arguments)}),f._callback=c,this.on(b,f,e)):this},off:function(a,b,c){var e,f,g,h,i,j,k,l,m,n;if(!this._events||!d(this,"off",a,[b,c]))return this;if(!a&&!b&&!c)return this._events=void 0,this;for(i=a?[a]:Object.keys(this._events),g=k=0,m=i.length;m>k;g=++k)if(a=i[g],f=this._events[a]){if(this._events[a]=j=[],b||c)for(h=l=0,n=f.length;n>l;h=++l)e=f[h],(b&&b!==e.callback&&b!==e.callback._callback||c&&c!==e.context)&&j.push(e);j.length||delete this._events[a]}return this},trigger:function(a){var b,c,e;return this._events?(c=h.call(arguments,1),d(this,"trigger",a,c)?(e=this._events[a],b=this._events.all,e&&i(e,c),b&&i(b,arguments),this):this):this},stopListening:function(a,b,c){var d,e,f;if(e=this._listeningTo,!e)return this;f=!b&&!c,c||"object"!=typeof b||(c=this),a&&((e={})[a._listenId]=a);for(d in e)a=e[d],a.off(b,c,this),(f||_.isEmpty(a._events))&&delete this._listeningTo[d];return this}},c=/\s+/,d=function(a,b,d,e){var f,g,h,i,j;if(!d)return!0;if("object"==typeof d){for(f in d)h=d[f],a[b].apply(a,[f,h].concat(e));return!1}if(c.test(d)){for(g=d.split(c),i=0,j=g.length;j>i;i++)h=g[i],a[b].apply(a,[h].concat(e));return!1}return!0},i=function(a,b){var c,d,e,f;for(f=[],d=0,e=a.length;e>d;d++)c=a[d],f.push(c.callback.apply(c.ctx,b));return f},f={listenTo:"on",listenToOnce:"once"};for(g in f)e=f[g],b[g]=function(b,c,d){var f,g;return g=this._listeningTo||(this._listeningTo={}),f=b._listenId||(b._listenId=a.uniqueId("l")),g[f]=b,d||"object"!=typeof c||(d=this),b[e](c,d,this),this};return b})}.call(this),function(){var a={}.hasOwnProperty;define(["./compose","./property"],function(b,c){"use strict";return function(){return b.mixin(this,c),this.initialize=function(b){var c,d,e,f;b||(b={}),c={};for(d in b)a.call(b,d)&&(e=b[d],c[d]=e);f=this.defaults;for(d in f)a.call(f,d)&&(e=f[d],c.hasOwnProperty(d)||(c[d]=e));return this.set(c),this},this.despose=function(){}}})}.call(this),function(){var a={}.hasOwnProperty;define(["./utils","./compose","./event"],function(b,c,d){"use strict";return function(){return c.mixin(this,d.withEvent),this.set=function(c,d){var e,f,g,h,i;if(!c)return this;if(arguments.length>1&&"string"==typeof arguments[0])return f={},f[c]=d,this.set(f);this.attrs||(this.attrs={}),f=c,e={},g={},h=this.attrs;for(c in h)a.call(h,c)&&(d=h[c],g[c]=d);b.push(this.attrs,f),i=this.attrs;for(c in i)a.call(i,c)&&(d=i[c],d!==g[c]?e[c]=d:delete g[c]);return 0!==Object.keys(e).length&&this.trigger("change",{before:g,after:e},!0),this},this.get=function(a){return this.attrs&&this.attrs[a]}}})}.call(this),function(){define(["./compose","./property"],function(a,b){"use strict";return function(){return a.mixin(this,b),this.serialize=function(){return["type: "+this.name,"id: "+this.id,"props: "+JSON.stringify(this.attrs)].join(",")},this.deserialize=function(){}}})}.call(this),function(){var a=[].slice,b={}.hasOwnProperty;define([],function(){"use strict";var c,d;return c=100,d=0,{merge:function(){var c,d,e,f,g,h,i;for(f=arguments[0],c=2<=arguments.length?a.call(arguments,1):[],f&&typeof f!==!1||(f={}),h=0,i=c.length;i>h;h++){e=c[h];for(d in e)b.call(e,d)&&(g=e[d],f[d]="object"!=typeof g?g:this.merge(f[d],g))}return f},push:function(a,c,d){var e,f;if(!a||!c)return a;for(e in c)if(b.call(c,e)){if(f=c[e],a[e]&&d)throw new Error('utils.push attempted to overwrite "'+e+'" while running in protected mode');"object"==typeof a[e]&&"object"==typeof c[e]?this.push(a[e],c[e]):a[e]=c[e]}return a},isEnumerable:function(a,b){return Object.keys(a).indexOf(b)>-1},compose:function(){var a;return a=arguments,function(){var b,c,d,e;for(b=arguments,c=d=e=a.length-1;0>=e?0>=d:d>=0;c=0>=e?++d:--d)b=a[c].apply(this,b);return b[0]}},uniqueArray:function(a){var b,c,d,e,f;for(d={},b=[],e=0,f=a.length;f>e;e++)c=a[e],d.hasOwnProperty(c)||(b.push(c),d[c]=1);return b},debounce:function(a,b,d){var e,f;return"number"!=typeof b&&(b=c),f=0,e=null,function(){var c,g,h,i;return h=this,c=arguments,i=function(){return f=null,d?void 0:e=a.apply(h,c)},g=d&&!f,clearTimeout(f),f=setTimeout(i,b),g&&(e=a.apply(h,c)),e}},throttle:function(a,b){var d,e,f,g,h,i,j;return"number"!=typeof b&&(b=c),e=d=i=h=f=g=null,j=this.debounce(function(){return f=h=!1},b),function(){var c;return e=this,d=arguments,c=function(){return i=null,f&&(g=a.apply(e,d)),j()},i||(i=setTimeout(c,b)),h?f=!0:(h=!0,g=a.apply(e,d)),j(),g}},countThen:function(a,b){return function(){return--a?void 0:b.apply(this,arguments)}},delegate:function(a){return function(c,d){var e,f,g;g=$(c.target),e=null;for(f in a)if(b.call(a,f)&&!c.isPropagationStopped()&&(e=g.closest(f)).length)return d=d||{},d.el=e[0],a[f].apply(this,[c,d])}},once:function(a){var b,c;return b=!1,c=null,function(){return b?c:(c=a.apply(this,arguments),b=!0,c)}},uniqueId:function(a){var b;return b=++d+"",a?a+b:b}}})}.call(this);
|
@@ -0,0 +1,783 @@
|
|
1
|
+
/*! dou - v0.0.1 - 2014-02-25
|
2
|
+
* https://github.com/heartyoh/dou
|
3
|
+
* Copyright (c) 2014 Hearty, Oh.; Licensed MIT */
|
4
|
+
(function() {
|
5
|
+
define(['./compose'], function(compose) {
|
6
|
+
"use strict";
|
7
|
+
var advice;
|
8
|
+
advice = {
|
9
|
+
around: function(base, wrapped) {
|
10
|
+
return function() {
|
11
|
+
var args, el, i, l, _i, _len;
|
12
|
+
l = arguments.length;
|
13
|
+
args = new Array(l + 1);
|
14
|
+
args[0] = base.bind(this);
|
15
|
+
for (i = _i = 0, _len = args.length; _i < _len; i = ++_i) {
|
16
|
+
el = args[i];
|
17
|
+
args[i + 1] = arguments[i];
|
18
|
+
}
|
19
|
+
return wrapped.apply(this, args);
|
20
|
+
};
|
21
|
+
},
|
22
|
+
before: function(base, before) {
|
23
|
+
var beforeFn;
|
24
|
+
beforeFn = typeof before === 'function' ? before : before.obj[before.fnName];
|
25
|
+
return function() {
|
26
|
+
beforeFn.apply(this, arguments);
|
27
|
+
return base.apply(this, arguments);
|
28
|
+
};
|
29
|
+
},
|
30
|
+
after: function(base, after) {
|
31
|
+
var afterFn;
|
32
|
+
afterFn = (typeof after === 'function' ? after : after.obj[after.fnName]);
|
33
|
+
return function() {
|
34
|
+
var res;
|
35
|
+
res = (base.unbound || base).apply(this, arguments);
|
36
|
+
afterFn.apply(this, arguments);
|
37
|
+
return res;
|
38
|
+
};
|
39
|
+
},
|
40
|
+
withAdvice: function() {
|
41
|
+
return ['before', 'after', 'around'].forEach(function(m) {
|
42
|
+
return this[m] = function(method, fn) {
|
43
|
+
return compose.unlockProperty(this, method, function() {
|
44
|
+
if (typeof this[method] === 'function') {
|
45
|
+
this[method] = advice[m](this[method], fn);
|
46
|
+
} else {
|
47
|
+
this[method] = fn;
|
48
|
+
}
|
49
|
+
return this[method];
|
50
|
+
});
|
51
|
+
};
|
52
|
+
}, this);
|
53
|
+
}
|
54
|
+
};
|
55
|
+
return advice;
|
56
|
+
});
|
57
|
+
|
58
|
+
}).call(this);
|
59
|
+
|
60
|
+
(function() {
|
61
|
+
var __hasProp = {}.hasOwnProperty;
|
62
|
+
|
63
|
+
define(['./utils', './debug'], function(utils, debug) {
|
64
|
+
"use strict";
|
65
|
+
var canWriteProtect, dontLock, e, mixin, setPropertyWritability, unlockProperty;
|
66
|
+
canWriteProtect = debug.enabled && !utils.isEnumerable(Object, 'getOwnPropertyDescriptor');
|
67
|
+
dontLock = ['mixedIn', 'mixingIn'];
|
68
|
+
if (canWriteProtect) {
|
69
|
+
try {
|
70
|
+
Object.getOwnPropertyDescriptor(Object, 'keys');
|
71
|
+
} catch (_error) {
|
72
|
+
e = _error;
|
73
|
+
canWriteProtect = false;
|
74
|
+
}
|
75
|
+
}
|
76
|
+
setPropertyWritability = function(obj, isWritable) {
|
77
|
+
var desc, key, props;
|
78
|
+
if (!canWriteProtect) {
|
79
|
+
return;
|
80
|
+
}
|
81
|
+
props = Object.create(null);
|
82
|
+
for (key in obj) {
|
83
|
+
if (!__hasProp.call(obj, key)) continue;
|
84
|
+
if (dontLock.indexOf(key < 0)) {
|
85
|
+
desc = Object.getOwnPropertyDescriptor(obj, key);
|
86
|
+
desc.writable = isWritable;
|
87
|
+
props[key] = desc;
|
88
|
+
}
|
89
|
+
}
|
90
|
+
return Object.defineProperties(obj, props);
|
91
|
+
};
|
92
|
+
unlockProperty = function(obj, prop, op) {
|
93
|
+
var writable;
|
94
|
+
if (!canWriteProtect || !obj.hasOwnProperty(prop)) {
|
95
|
+
return op.call(obj);
|
96
|
+
}
|
97
|
+
writable = Object.getOwnPropertyDescriptor(obj, prop).writable;
|
98
|
+
Object.defineProperties(obj, prop, {
|
99
|
+
writable: true
|
100
|
+
});
|
101
|
+
op.call(obj);
|
102
|
+
return Object.defineProperties(obj, prop, {
|
103
|
+
writable: writable
|
104
|
+
});
|
105
|
+
};
|
106
|
+
mixin = function(base, mixins) {
|
107
|
+
var _i, _len;
|
108
|
+
if (!(mixins instanceof Array)) {
|
109
|
+
return this.mixin(base, [mixins]);
|
110
|
+
}
|
111
|
+
base.mixedIn = base.hasOwnProperty('mixedIn') ? base.mixedIn : [];
|
112
|
+
base.mixingIn = base.hasOwnProperty('mixingIn') ? base.mixingIn : [];
|
113
|
+
setPropertyWritability(base, false);
|
114
|
+
for (_i = 0, _len = mixins.length; _i < _len; _i++) {
|
115
|
+
mixin = mixins[_i];
|
116
|
+
if (!(base.mixedIn.indexOf(mixin) === -1)) {
|
117
|
+
continue;
|
118
|
+
}
|
119
|
+
if (base.mixingIn.indexOf(mixin) > -1) {
|
120
|
+
throw new Error('found cyclic dependencies between ' + base.mixingIn);
|
121
|
+
}
|
122
|
+
base.mixingIn.push(mixin);
|
123
|
+
mixin.call(base);
|
124
|
+
base.mixingIn.pop();
|
125
|
+
base.mixedIn.push(mixin);
|
126
|
+
}
|
127
|
+
return setPropertyWritability(base, true);
|
128
|
+
};
|
129
|
+
return {
|
130
|
+
mixin: mixin,
|
131
|
+
unlockProperty: unlockProperty
|
132
|
+
};
|
133
|
+
});
|
134
|
+
|
135
|
+
}).call(this);
|
136
|
+
|
137
|
+
(function() {
|
138
|
+
var __hasProp = {}.hasOwnProperty;
|
139
|
+
|
140
|
+
define([], function() {
|
141
|
+
"use strict";
|
142
|
+
var ALL, byName, byNameContains, byType, byValue, byValueCoerced, custom, defaultActionsFilter, defaultEventNamesFilter, filterEventLogsByAction, filterEventLogsByName, global, hideAllEventLogs, logFilter, retrieveLogFilter, saveLogFilter, search, showAllEventLogs, tests, traverse;
|
143
|
+
global = window || {};
|
144
|
+
traverse = function(comparator, clue, options) {
|
145
|
+
var obj, path, prop, _results;
|
146
|
+
options = options || {};
|
147
|
+
obj = options.obj || global;
|
148
|
+
path = options.path || (obj === global ? 'global' : '');
|
149
|
+
_results = [];
|
150
|
+
for (prop in obj) {
|
151
|
+
if (!__hasProp.call(obj, prop)) continue;
|
152
|
+
if ((tests[comparator] || comparator)(clue, obj, prop)) {
|
153
|
+
console.log("" + path + "." + prop + " -> (" + (typeof obj[prop]) + ")", obj[prop]);
|
154
|
+
}
|
155
|
+
if (obj[prop] && typeof obj[prop] === 'object' && obj[prop] !== obj) {
|
156
|
+
_results.push(traverse(comparator, clue, {
|
157
|
+
obj: obj[prop],
|
158
|
+
path: "" + path + "." + prop
|
159
|
+
}));
|
160
|
+
} else {
|
161
|
+
_results.push(void 0);
|
162
|
+
}
|
163
|
+
}
|
164
|
+
return _results;
|
165
|
+
};
|
166
|
+
search = function(comparator, expected, clue, options) {
|
167
|
+
if (!expected || typeof clue === expected) {
|
168
|
+
return traverse(comparator, clue, options);
|
169
|
+
} else {
|
170
|
+
return console.error("" + clue + " must be " + expected);
|
171
|
+
}
|
172
|
+
};
|
173
|
+
tests = {
|
174
|
+
name: function(clue, obj, prop) {
|
175
|
+
return clue === prop;
|
176
|
+
},
|
177
|
+
nameContains: function(clue, obj, prop) {
|
178
|
+
return prop.indexOf(clue) > -1;
|
179
|
+
},
|
180
|
+
type: function(clue, obj, prop) {
|
181
|
+
return obj[prop] instanceof clue;
|
182
|
+
},
|
183
|
+
value: function(clue, obj, prop) {
|
184
|
+
return obj[prop] === clue;
|
185
|
+
},
|
186
|
+
valueCoerced: function(clue, obj, prop) {
|
187
|
+
return obj[prop] == clue;
|
188
|
+
}
|
189
|
+
};
|
190
|
+
byName = function(clue, options) {
|
191
|
+
return search('name', 'string', clue, options);
|
192
|
+
};
|
193
|
+
byNameContains = function(clue, options) {
|
194
|
+
return search('nameContains', 'string', clue, options);
|
195
|
+
};
|
196
|
+
byType = function(clue, options) {
|
197
|
+
return search('type', 'function', clue, options);
|
198
|
+
};
|
199
|
+
byValue = function(clue, options) {
|
200
|
+
return search('value', null, clue, options);
|
201
|
+
};
|
202
|
+
byValueCoerced = function(clue, options) {
|
203
|
+
return search('valueCoerced', null, clue, options);
|
204
|
+
};
|
205
|
+
custom = function(comparator, options) {
|
206
|
+
return traverse(comparator, null, options);
|
207
|
+
};
|
208
|
+
filterEventLogsByAction = function() {
|
209
|
+
var actions;
|
210
|
+
actions = [].slice.call(arguments);
|
211
|
+
logFilter.eventNames.length || (logFilter.eventNames = ALL);
|
212
|
+
logFilter.actions = actions.length ? actions : ALL;
|
213
|
+
return saveLogFilter();
|
214
|
+
};
|
215
|
+
filterEventLogsByName = function() {
|
216
|
+
var eventNames;
|
217
|
+
eventNames = [].slice.call(arguments);
|
218
|
+
logFilter.actions.length || (logFilter.actions = ALL);
|
219
|
+
logFilter.eventNames = eventNames.length ? eventNames : ALL;
|
220
|
+
return saveLogFilter();
|
221
|
+
};
|
222
|
+
hideAllEventLogs = function() {
|
223
|
+
logFilter.actions = [];
|
224
|
+
logFilter.eventNames = [];
|
225
|
+
return saveLogFilter();
|
226
|
+
};
|
227
|
+
showAllEventLogs = function() {
|
228
|
+
logFilter.actions = ALL;
|
229
|
+
logFilter.eventNames = ALL;
|
230
|
+
return saveLogFilter();
|
231
|
+
};
|
232
|
+
saveLogFilter = function() {
|
233
|
+
if (global.localStorage) {
|
234
|
+
global.localStorage.setItem('logFilter_eventNames', logFilter.eventNames);
|
235
|
+
return global.localStorage.setItem('logFilter_actions', logFilter.actions);
|
236
|
+
}
|
237
|
+
};
|
238
|
+
retrieveLogFilter = function() {
|
239
|
+
var key, result, value;
|
240
|
+
result = {
|
241
|
+
eventNames: (global.localStorage && global.localStorage.getItem('logFilter_eventNames')) || defaultEventNamesFilter,
|
242
|
+
actions: (global.localStorage && global.localStorage.getItem('logFilter_actions')) || defaultActionsFilter
|
243
|
+
};
|
244
|
+
for (key in result) {
|
245
|
+
if (!__hasProp.call(result, key)) continue;
|
246
|
+
value = result[key];
|
247
|
+
if (typeof value === 'string' && value !== ALL) {
|
248
|
+
result[key] = value.split('.');
|
249
|
+
}
|
250
|
+
}
|
251
|
+
return result;
|
252
|
+
};
|
253
|
+
ALL = 'all';
|
254
|
+
defaultEventNamesFilter = [];
|
255
|
+
defaultActionsFilter = [];
|
256
|
+
logFilter = retrieveLogFilter();
|
257
|
+
return {
|
258
|
+
enable: function(enable) {
|
259
|
+
this.enabled = !!enable;
|
260
|
+
if (enable && global.console) {
|
261
|
+
console.info('Booting in DEBUG mode');
|
262
|
+
console.info('You can configure event logging with DEBUG.events.logAll()/logNone()/logByName()/logByAction()');
|
263
|
+
}
|
264
|
+
return global.DEBUG = this;
|
265
|
+
},
|
266
|
+
find: {
|
267
|
+
byName: byName,
|
268
|
+
byNameContains: byNameContains,
|
269
|
+
byType: byType,
|
270
|
+
byValue: byValue,
|
271
|
+
byValueCoerced: byValueCoerced,
|
272
|
+
custom: custom
|
273
|
+
},
|
274
|
+
events: {
|
275
|
+
logFilter: logFilter,
|
276
|
+
logByAction: filterEventLogsByAction,
|
277
|
+
logByName: filterEventLogsByName,
|
278
|
+
logAll: showAllEventLogs,
|
279
|
+
logNone: hideAllEventLogs
|
280
|
+
}
|
281
|
+
};
|
282
|
+
});
|
283
|
+
|
284
|
+
}).call(this);
|
285
|
+
|
286
|
+
(function() {
|
287
|
+
var __hasProp = {}.hasOwnProperty,
|
288
|
+
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
|
289
|
+
|
290
|
+
define(['./compose'], function(compose) {
|
291
|
+
"use strict";
|
292
|
+
var define;
|
293
|
+
define = function(options) {
|
294
|
+
var Component;
|
295
|
+
if (options["extends"]) {
|
296
|
+
Component = (function(_super) {
|
297
|
+
__extends(Component, _super);
|
298
|
+
|
299
|
+
function Component() {
|
300
|
+
return Component.__super__.constructor.apply(this, arguments);
|
301
|
+
}
|
302
|
+
|
303
|
+
return Component;
|
304
|
+
|
305
|
+
})(options["extends"]);
|
306
|
+
} else {
|
307
|
+
Component = (function() {
|
308
|
+
function Component() {}
|
309
|
+
|
310
|
+
return Component;
|
311
|
+
|
312
|
+
})();
|
313
|
+
}
|
314
|
+
if (options.mixins) {
|
315
|
+
compose.mixin(Component.prototype, options.mixins);
|
316
|
+
}
|
317
|
+
if (options.name) {
|
318
|
+
Component.name = options.name;
|
319
|
+
}
|
320
|
+
return Component;
|
321
|
+
};
|
322
|
+
return {
|
323
|
+
define: define
|
324
|
+
};
|
325
|
+
});
|
326
|
+
|
327
|
+
}).call(this);
|
328
|
+
|
329
|
+
(function() {
|
330
|
+
define(['./utils'], function(utils) {
|
331
|
+
"use strict";
|
332
|
+
var Event, eventSplitter, eventsApi, implementation, listenMethods, method, slice, triggerEvents;
|
333
|
+
slice = [].slice;
|
334
|
+
Event = {
|
335
|
+
withEvent: function() {
|
336
|
+
var method, _i, _len, _ref, _results;
|
337
|
+
_ref = ['on', 'off', 'once', 'trigger'];
|
338
|
+
_results = [];
|
339
|
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
340
|
+
method = _ref[_i];
|
341
|
+
_results.push(this[method] = Event[method]);
|
342
|
+
}
|
343
|
+
return _results;
|
344
|
+
},
|
345
|
+
on: function(name, callback, context) {
|
346
|
+
var events;
|
347
|
+
if (!eventsApi(this, 'on', name, [callback, context]) || !callback) {
|
348
|
+
return this;
|
349
|
+
}
|
350
|
+
this._events || (this._events = {});
|
351
|
+
events = this._events[name] || (this._events[name] = []);
|
352
|
+
events.push({
|
353
|
+
callback: callback,
|
354
|
+
context: context,
|
355
|
+
ctx: context || this
|
356
|
+
});
|
357
|
+
return this;
|
358
|
+
},
|
359
|
+
once: function(name, callback, context) {
|
360
|
+
var once, self;
|
361
|
+
if (!eventsApi(this, 'once', name, [callback, context]) || !callback) {
|
362
|
+
return this;
|
363
|
+
}
|
364
|
+
self = this;
|
365
|
+
once = utils.once(function() {
|
366
|
+
self.off(name, once);
|
367
|
+
return callback.apply(this, arguments);
|
368
|
+
});
|
369
|
+
once._callback = callback;
|
370
|
+
return this.on(name, once, context);
|
371
|
+
},
|
372
|
+
off: function(name, callback, context) {
|
373
|
+
var ev, events, i, j, names, retain, _i, _j, _len, _len1;
|
374
|
+
if (!this._events || !eventsApi(this, 'off', name, [callback, context])) {
|
375
|
+
return this;
|
376
|
+
}
|
377
|
+
if (!name && !callback && !context) {
|
378
|
+
this._events = void 0;
|
379
|
+
return this;
|
380
|
+
}
|
381
|
+
names = name ? [name] : Object.keys(this._events);
|
382
|
+
for (i = _i = 0, _len = names.length; _i < _len; i = ++_i) {
|
383
|
+
name = names[i];
|
384
|
+
if ((events = this._events[name])) {
|
385
|
+
this._events[name] = retain = [];
|
386
|
+
if (callback || context) {
|
387
|
+
for (j = _j = 0, _len1 = events.length; _j < _len1; j = ++_j) {
|
388
|
+
ev = events[j];
|
389
|
+
if ((callback && callback !== ev.callback && callback !== ev.callback._callback) || (context && context !== ev.context)) {
|
390
|
+
retain.push(ev);
|
391
|
+
}
|
392
|
+
}
|
393
|
+
}
|
394
|
+
if (!retain.length) {
|
395
|
+
delete this._events[name];
|
396
|
+
}
|
397
|
+
}
|
398
|
+
}
|
399
|
+
return this;
|
400
|
+
},
|
401
|
+
trigger: function(name) {
|
402
|
+
var allEvents, args, events;
|
403
|
+
if (!this._events) {
|
404
|
+
return this;
|
405
|
+
}
|
406
|
+
args = slice.call(arguments, 1);
|
407
|
+
if (!eventsApi(this, 'trigger', name, args)) {
|
408
|
+
return this;
|
409
|
+
}
|
410
|
+
events = this._events[name];
|
411
|
+
allEvents = this._events.all;
|
412
|
+
if (events) {
|
413
|
+
triggerEvents(events, args);
|
414
|
+
}
|
415
|
+
if (allEvents) {
|
416
|
+
triggerEvents(allEvents, arguments);
|
417
|
+
}
|
418
|
+
return this;
|
419
|
+
},
|
420
|
+
stopListening: function(obj, name, callback) {
|
421
|
+
var id, listeningTo, remove;
|
422
|
+
listeningTo = this._listeningTo;
|
423
|
+
if (!listeningTo) {
|
424
|
+
return this;
|
425
|
+
}
|
426
|
+
remove = !name && !callback;
|
427
|
+
if (!callback && typeof name === 'object') {
|
428
|
+
callback = this;
|
429
|
+
}
|
430
|
+
if (obj) {
|
431
|
+
(listeningTo = {})[obj._listenId] = obj;
|
432
|
+
}
|
433
|
+
for (id in listeningTo) {
|
434
|
+
obj = listeningTo[id];
|
435
|
+
obj.off(name, callback, this);
|
436
|
+
if (remove || _.isEmpty(obj._events)) {
|
437
|
+
delete this._listeningTo[id];
|
438
|
+
}
|
439
|
+
}
|
440
|
+
return this;
|
441
|
+
}
|
442
|
+
};
|
443
|
+
eventSplitter = /\s+/;
|
444
|
+
eventsApi = function(obj, action, name, rest) {
|
445
|
+
var key, names, val, _i, _len;
|
446
|
+
if (!name) {
|
447
|
+
return true;
|
448
|
+
}
|
449
|
+
if (typeof name === 'object') {
|
450
|
+
for (key in name) {
|
451
|
+
val = name[key];
|
452
|
+
obj[action].apply(obj, [key, val].concat(rest));
|
453
|
+
}
|
454
|
+
return false;
|
455
|
+
}
|
456
|
+
if (eventSplitter.test(name)) {
|
457
|
+
names = name.split(eventSplitter);
|
458
|
+
for (_i = 0, _len = names.length; _i < _len; _i++) {
|
459
|
+
val = names[_i];
|
460
|
+
obj[action].apply(obj, [val].concat(rest));
|
461
|
+
}
|
462
|
+
return false;
|
463
|
+
}
|
464
|
+
return true;
|
465
|
+
};
|
466
|
+
triggerEvents = function(events, args) {
|
467
|
+
var ev, _i, _len, _results;
|
468
|
+
_results = [];
|
469
|
+
for (_i = 0, _len = events.length; _i < _len; _i++) {
|
470
|
+
ev = events[_i];
|
471
|
+
_results.push(ev.callback.apply(ev.ctx, args));
|
472
|
+
}
|
473
|
+
return _results;
|
474
|
+
};
|
475
|
+
listenMethods = {
|
476
|
+
listenTo: 'on',
|
477
|
+
listenToOnce: 'once'
|
478
|
+
};
|
479
|
+
for (method in listenMethods) {
|
480
|
+
implementation = listenMethods[method];
|
481
|
+
Event[method] = function(obj, name, callback) {
|
482
|
+
var id, listeningTo;
|
483
|
+
listeningTo = this._listeningTo || (this._listeningTo = {});
|
484
|
+
id = obj._listenId || (obj._listenId = utils.uniqueId('l'));
|
485
|
+
listeningTo[id] = obj;
|
486
|
+
if (!callback && typeof name === 'object') {
|
487
|
+
callback = this;
|
488
|
+
}
|
489
|
+
obj[implementation](name, callback, this);
|
490
|
+
return this;
|
491
|
+
};
|
492
|
+
}
|
493
|
+
return Event;
|
494
|
+
});
|
495
|
+
|
496
|
+
}).call(this);
|
497
|
+
|
498
|
+
(function() {
|
499
|
+
var __hasProp = {}.hasOwnProperty;
|
500
|
+
|
501
|
+
define(['./compose', './property'], function(compose, withProperty) {
|
502
|
+
"use strict";
|
503
|
+
return function() {
|
504
|
+
compose.mixin(this, withProperty);
|
505
|
+
this.initialize = function(attrs) {
|
506
|
+
var cloned, key, val, _ref;
|
507
|
+
attrs || (attrs = {});
|
508
|
+
cloned = {};
|
509
|
+
for (key in attrs) {
|
510
|
+
if (!__hasProp.call(attrs, key)) continue;
|
511
|
+
val = attrs[key];
|
512
|
+
cloned[key] = val;
|
513
|
+
}
|
514
|
+
_ref = this.defaults;
|
515
|
+
for (key in _ref) {
|
516
|
+
if (!__hasProp.call(_ref, key)) continue;
|
517
|
+
val = _ref[key];
|
518
|
+
if (!cloned.hasOwnProperty(key)) {
|
519
|
+
cloned[key] = val;
|
520
|
+
}
|
521
|
+
}
|
522
|
+
this.set(cloned);
|
523
|
+
return this;
|
524
|
+
};
|
525
|
+
return this.despose = function() {};
|
526
|
+
};
|
527
|
+
});
|
528
|
+
|
529
|
+
}).call(this);
|
530
|
+
|
531
|
+
(function() {
|
532
|
+
var __hasProp = {}.hasOwnProperty;
|
533
|
+
|
534
|
+
define(['./utils', './compose', './event'], function(utils, compose, event) {
|
535
|
+
"use strict";
|
536
|
+
return function() {
|
537
|
+
compose.mixin(this, event.withEvent);
|
538
|
+
this.set = function(key, val) {
|
539
|
+
var after, attrs, before, _ref, _ref1;
|
540
|
+
if (!key) {
|
541
|
+
return this;
|
542
|
+
}
|
543
|
+
if (arguments.length > 1 && typeof arguments[0] === 'string') {
|
544
|
+
attrs = {};
|
545
|
+
attrs[key] = val;
|
546
|
+
return this.set(attrs);
|
547
|
+
}
|
548
|
+
this.attrs || (this.attrs = {});
|
549
|
+
attrs = key;
|
550
|
+
after = {};
|
551
|
+
before = {};
|
552
|
+
_ref = this.attrs;
|
553
|
+
for (key in _ref) {
|
554
|
+
if (!__hasProp.call(_ref, key)) continue;
|
555
|
+
val = _ref[key];
|
556
|
+
before[key] = val;
|
557
|
+
}
|
558
|
+
utils.push(this.attrs, attrs);
|
559
|
+
_ref1 = this.attrs;
|
560
|
+
for (key in _ref1) {
|
561
|
+
if (!__hasProp.call(_ref1, key)) continue;
|
562
|
+
val = _ref1[key];
|
563
|
+
if (val !== before[key]) {
|
564
|
+
after[key] = val;
|
565
|
+
} else {
|
566
|
+
delete before[key];
|
567
|
+
}
|
568
|
+
}
|
569
|
+
if (Object.keys(after).length !== 0) {
|
570
|
+
this.trigger('change', {
|
571
|
+
before: before,
|
572
|
+
after: after
|
573
|
+
}, true);
|
574
|
+
}
|
575
|
+
return this;
|
576
|
+
};
|
577
|
+
return this.get = function(attr) {
|
578
|
+
return this.attrs && this.attrs[attr];
|
579
|
+
};
|
580
|
+
};
|
581
|
+
});
|
582
|
+
|
583
|
+
}).call(this);
|
584
|
+
|
585
|
+
(function() {
|
586
|
+
define(['./compose', './property'], function(compose, withProperty) {
|
587
|
+
"use strict";
|
588
|
+
return function() {
|
589
|
+
compose.mixin(this, withProperty);
|
590
|
+
this.serialize = function() {
|
591
|
+
return ["type: " + this.name, "id: " + this.id, "props: " + (JSON.stringify(this.attrs))].join(',');
|
592
|
+
};
|
593
|
+
return this.deserialize = function() {};
|
594
|
+
};
|
595
|
+
});
|
596
|
+
|
597
|
+
}).call(this);
|
598
|
+
|
599
|
+
(function() {
|
600
|
+
var __slice = [].slice,
|
601
|
+
__hasProp = {}.hasOwnProperty;
|
602
|
+
|
603
|
+
define([], function() {
|
604
|
+
"use strict";
|
605
|
+
var DEFAULT_INTERVAL, idCounter;
|
606
|
+
DEFAULT_INTERVAL = 100;
|
607
|
+
idCounter = 0;
|
608
|
+
return {
|
609
|
+
merge: function() {
|
610
|
+
var extenders, key, other, target, val, _i, _len;
|
611
|
+
target = arguments[0], extenders = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
|
612
|
+
if (!target || typeof target === !"object") {
|
613
|
+
target = {};
|
614
|
+
}
|
615
|
+
for (_i = 0, _len = extenders.length; _i < _len; _i++) {
|
616
|
+
other = extenders[_i];
|
617
|
+
for (key in other) {
|
618
|
+
if (!__hasProp.call(other, key)) continue;
|
619
|
+
val = other[key];
|
620
|
+
if (typeof val !== "object") {
|
621
|
+
target[key] = val;
|
622
|
+
} else {
|
623
|
+
target[key] = this.merge(target[key], val);
|
624
|
+
}
|
625
|
+
}
|
626
|
+
}
|
627
|
+
return target;
|
628
|
+
},
|
629
|
+
push: function(base, extra, protect) {
|
630
|
+
var key, val;
|
631
|
+
if (!base || !extra) {
|
632
|
+
return base;
|
633
|
+
}
|
634
|
+
for (key in extra) {
|
635
|
+
if (!__hasProp.call(extra, key)) continue;
|
636
|
+
val = extra[key];
|
637
|
+
if (base[key] && protect) {
|
638
|
+
throw new Error("utils.push attempted to overwrite \"" + key + "\" while running in protected mode");
|
639
|
+
}
|
640
|
+
if (typeof base[key] === "object" && typeof extra[key] === "object") {
|
641
|
+
this.push(base[key], extra[key]);
|
642
|
+
} else {
|
643
|
+
base[key] = extra[key];
|
644
|
+
}
|
645
|
+
}
|
646
|
+
return base;
|
647
|
+
},
|
648
|
+
isEnumerable: function(obj, property) {
|
649
|
+
return Object.keys(obj).indexOf(property) > -1;
|
650
|
+
},
|
651
|
+
compose: function() {
|
652
|
+
var funcs;
|
653
|
+
funcs = arguments;
|
654
|
+
return function() {
|
655
|
+
var args, i, _i, _ref;
|
656
|
+
args = arguments;
|
657
|
+
for (i = _i = _ref = funcs.length - 1; _ref <= 0 ? _i <= 0 : _i >= 0; i = _ref <= 0 ? ++_i : --_i) {
|
658
|
+
args = funcs[i].apply(this, args);
|
659
|
+
}
|
660
|
+
return args[0];
|
661
|
+
};
|
662
|
+
},
|
663
|
+
uniqueArray: function(array) {
|
664
|
+
var a, item, u, _i, _len;
|
665
|
+
u = {};
|
666
|
+
a = [];
|
667
|
+
for (_i = 0, _len = array.length; _i < _len; _i++) {
|
668
|
+
item = array[_i];
|
669
|
+
if (u.hasOwnProperty(item)) {
|
670
|
+
continue;
|
671
|
+
}
|
672
|
+
a.push(item);
|
673
|
+
u[item] = 1;
|
674
|
+
}
|
675
|
+
return a;
|
676
|
+
},
|
677
|
+
debounce: function(func, wait, immediate) {
|
678
|
+
var result, timeout;
|
679
|
+
if (typeof wait !== 'number') {
|
680
|
+
wait = DEFAULT_INTERVAL;
|
681
|
+
}
|
682
|
+
timeout = 0;
|
683
|
+
result = null;
|
684
|
+
return function() {
|
685
|
+
var args, callNow, context, later;
|
686
|
+
context = this;
|
687
|
+
args = arguments;
|
688
|
+
later = function() {
|
689
|
+
timeout = null;
|
690
|
+
if (!immediate) {
|
691
|
+
return result = func.apply(context, args);
|
692
|
+
}
|
693
|
+
};
|
694
|
+
callNow = immediate && !timeout;
|
695
|
+
clearTimeout(timeout);
|
696
|
+
timeout = setTimeout(later, wait);
|
697
|
+
if (callNow) {
|
698
|
+
result = func.apply(context, args);
|
699
|
+
}
|
700
|
+
return result;
|
701
|
+
};
|
702
|
+
},
|
703
|
+
throttle: function(func, wait) {
|
704
|
+
var args, context, more, result, throttling, timeout, whenDone;
|
705
|
+
if (typeof wait !== 'number') {
|
706
|
+
wait = DEFAULT_INTERVAL;
|
707
|
+
}
|
708
|
+
context = args = timeout = throttling = more = result = null;
|
709
|
+
whenDone = this.debounce(function() {
|
710
|
+
return more = throttling = false;
|
711
|
+
}, wait);
|
712
|
+
return function() {
|
713
|
+
var later;
|
714
|
+
context = this;
|
715
|
+
args = arguments;
|
716
|
+
later = function() {
|
717
|
+
timeout = null;
|
718
|
+
if (more) {
|
719
|
+
result = func.apply(context, args);
|
720
|
+
}
|
721
|
+
return whenDone();
|
722
|
+
};
|
723
|
+
if (!timeout) {
|
724
|
+
timeout = setTimeout(later, wait);
|
725
|
+
}
|
726
|
+
if (throttling) {
|
727
|
+
more = true;
|
728
|
+
} else {
|
729
|
+
throttling = true;
|
730
|
+
result = func.apply(context, args);
|
731
|
+
}
|
732
|
+
whenDone();
|
733
|
+
return result;
|
734
|
+
};
|
735
|
+
},
|
736
|
+
countThen: function(num, base) {
|
737
|
+
return function() {
|
738
|
+
if (!--num) {
|
739
|
+
return base.apply(this, arguments);
|
740
|
+
}
|
741
|
+
};
|
742
|
+
},
|
743
|
+
delegate: function(rules) {
|
744
|
+
return function(e, data) {
|
745
|
+
var parent, selector, target;
|
746
|
+
target = $(e.target);
|
747
|
+
parent = null;
|
748
|
+
for (selector in rules) {
|
749
|
+
if (!__hasProp.call(rules, selector)) continue;
|
750
|
+
if (!e.isPropagationStopped() && (parent = target.closest(selector)).length) {
|
751
|
+
data = data || {};
|
752
|
+
data.el = parent[0];
|
753
|
+
return rules[selector].apply(this, [e, data]);
|
754
|
+
}
|
755
|
+
}
|
756
|
+
};
|
757
|
+
},
|
758
|
+
once: function(func) {
|
759
|
+
var ran, result;
|
760
|
+
ran = false;
|
761
|
+
result = null;
|
762
|
+
return function() {
|
763
|
+
if (ran) {
|
764
|
+
return result;
|
765
|
+
}
|
766
|
+
result = func.apply(this, arguments);
|
767
|
+
ran = true;
|
768
|
+
return result;
|
769
|
+
};
|
770
|
+
},
|
771
|
+
uniqueId: function(prefix) {
|
772
|
+
var id;
|
773
|
+
id = (++idCounter) + '';
|
774
|
+
if (prefix) {
|
775
|
+
return prefix + id;
|
776
|
+
} else {
|
777
|
+
return id;
|
778
|
+
}
|
779
|
+
}
|
780
|
+
};
|
781
|
+
});
|
782
|
+
|
783
|
+
}).call(this);
|
metadata
ADDED
@@ -0,0 +1,72 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: dou-rails
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Hearty, Oh
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-02-25 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: railties
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '3.0'
|
20
|
+
- - <
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '5.0'
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '3.0'
|
30
|
+
- - <
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '5.0'
|
33
|
+
description: This gem provides light-weight javascript module framework for your Rails
|
34
|
+
3 application.
|
35
|
+
email:
|
36
|
+
- heartyoh@gmail.com
|
37
|
+
executables: []
|
38
|
+
extensions: []
|
39
|
+
extra_rdoc_files: []
|
40
|
+
files:
|
41
|
+
- MIT-LICENSE
|
42
|
+
- README.md
|
43
|
+
- lib/dou.rb
|
44
|
+
- lib/dou/engine.rb
|
45
|
+
- lib/dou/version.rb
|
46
|
+
- vendor/assets/javascripts/dou-min.js
|
47
|
+
- vendor/assets/javascripts/dou.js
|
48
|
+
homepage: http://github.com/heartyoh/dou
|
49
|
+
licenses:
|
50
|
+
- MIT
|
51
|
+
metadata: {}
|
52
|
+
post_install_message:
|
53
|
+
rdoc_options: []
|
54
|
+
require_paths:
|
55
|
+
- lib
|
56
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - '>='
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '0'
|
61
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
62
|
+
requirements:
|
63
|
+
- - '>='
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: 1.3.6
|
66
|
+
requirements: []
|
67
|
+
rubyforge_project:
|
68
|
+
rubygems_version: 2.2.1
|
69
|
+
signing_key:
|
70
|
+
specification_version: 4
|
71
|
+
summary: A gem for Dou javascript module framework
|
72
|
+
test_files: []
|