elementaljs-rails 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/elementaljs-rails/version.rb +1 -1
- data/vendor/assets/javascripts/elemental.js +33 -31
- metadata +4 -4
@@ -1,43 +1,45 @@
|
|
1
|
-
(function(){
|
1
|
+
(function(ns) {
|
2
2
|
|
3
|
-
var
|
4
|
-
var Elemental;
|
5
|
-
if (typeof exports !== 'undefined') {
|
6
|
-
Elemental = exports;
|
7
|
-
} else {
|
8
|
-
Elemental = root.Elemental = {};
|
9
|
-
}
|
3
|
+
var namespaces = [this];
|
10
4
|
|
11
|
-
var
|
5
|
+
var attachBehavior = function($element, behavior) {
|
6
|
+
var fn = namespaces;
|
12
7
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
8
|
+
behavior.replace(/([^.]+)/g, function(object) {
|
9
|
+
if(fn === namespaces) {
|
10
|
+
for(var nextFn, index = 0; index < fn.length; ++index) {
|
11
|
+
nextFn = fn[index][object];
|
12
|
+
if(nextFn) {
|
13
|
+
fn = nextFn;
|
14
|
+
break;
|
15
|
+
}
|
16
|
+
}
|
17
|
+
} else if(typeof fn === 'object') {
|
18
|
+
fn = fn[object];
|
19
|
+
}
|
20
|
+
});
|
26
21
|
|
27
|
-
|
28
|
-
|
29
|
-
|
22
|
+
if(typeof fn === 'function') {
|
23
|
+
return fn($element);
|
24
|
+
} else {
|
25
|
+
if (window.console && console.warn) {
|
26
|
+
console.warn("elementalJS: Unable to find behavior:", behavior);
|
27
|
+
}
|
28
|
+
}
|
29
|
+
};
|
30
30
|
|
31
|
-
|
32
|
-
|
33
|
-
|
31
|
+
ns.load = function(container) {
|
32
|
+
$(container).find("*").andSelf().filter("[data-behavior]").each(function(index, element) {
|
33
|
+
var $element = $(element);
|
34
|
+
var behaviors = $element.data('behavior');
|
35
|
+
behaviors.replace(/([^ ]+)/g, function(behavior) {
|
36
|
+
attachBehavior($element, behavior);
|
34
37
|
});
|
35
38
|
});
|
36
39
|
};
|
37
40
|
|
38
|
-
|
41
|
+
ns.addNamespace = function(namespace) {
|
39
42
|
namespaces.push(namespace);
|
40
43
|
};
|
41
44
|
|
42
|
-
})();
|
43
|
-
|
45
|
+
})(window.Elemental = {});
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: elementaljs-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-03
|
12
|
+
date: 2013-04-03 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: jquery-rails
|
@@ -73,7 +73,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
73
73
|
version: '0'
|
74
74
|
segments:
|
75
75
|
- 0
|
76
|
-
hash:
|
76
|
+
hash: -2270599889799533641
|
77
77
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
78
78
|
none: false
|
79
79
|
requirements:
|
@@ -82,7 +82,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
82
82
|
version: '0'
|
83
83
|
segments:
|
84
84
|
- 0
|
85
|
-
hash:
|
85
|
+
hash: -2270599889799533641
|
86
86
|
requirements: []
|
87
87
|
rubyforge_project:
|
88
88
|
rubygems_version: 1.8.25
|