ninjs 0.13.4 → 0.13.5
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +1 -1
- data/VERSION +1 -1
- data/bin/ninjs +22 -21
- data/lib/ninjs/command.rb +15 -32
- data/lib/ninjs/configuration.rb +9 -3
- data/lib/ninjs/generator.rb +33 -24
- data/lib/ninjs/helpers.rb +1 -0
- data/lib/ninjs/notification.rb +1 -1
- data/lib/ninjs/project.rb +34 -18
- data/ninjs.gemspec +14 -5
- data/repository/ninjs/core/application.js +11 -20
- data/repository/ninjs/core/existence.js +37 -11
- data/repository/ninjs/core/extend.js +25 -34
- data/repository/ninjs/core/module.js +38 -49
- data/repository/ninjs/extensions/jquery.elements.js +60 -0
- data/repository/ninjs/utilities/array.js +8 -13
- data/repository/ninjs/utilities/string.js +6 -11
- data/repository/syntaxhighlighter/{default.js → all.js} +0 -0
- data/spec/helpers_spec.rb +11 -0
- data/spec/integration_spec.rb +257 -0
- data/spec/manifest_spec.rb +8 -0
- data/spec/ninjs_spec.rb +29 -250
- data/spec/notification_spec.rb +27 -0
- data/spec/spec_helper.rb +2 -1
- metadata +68 -60
- data/repository/ninjs/extensions/ninjs.jquery.js +0 -67
@@ -1,67 +0,0 @@
|
|
1
|
-
(function($) {
|
2
|
-
|
3
|
-
NinjsModule.prototype.elements = function(elements, force) {
|
4
|
-
var self = this;
|
5
|
-
|
6
|
-
unless(is_defined(force), function() {
|
7
|
-
force = false;
|
8
|
-
});
|
9
|
-
|
10
|
-
if (is_string(elements)) {
|
11
|
-
var key = elements;
|
12
|
-
|
13
|
-
try {
|
14
|
-
if (is_undefined(self.dom[key])) {
|
15
|
-
throw new SyntaxError("NinjsModule.elements('" + key + "'): " + self.name + ".dom." + key + " is undefined");
|
16
|
-
}
|
17
|
-
|
18
|
-
if (is_string(self.dom[key])) {
|
19
|
-
var selection = $(self.dom[key]);
|
20
|
-
|
21
|
-
unless(selection.length === 0, function() {
|
22
|
-
return self.dom[key] = selection;
|
23
|
-
}, function() {
|
24
|
-
return self.dom[key];
|
25
|
-
});
|
26
|
-
}
|
27
|
-
else {
|
28
|
-
if (self.dom[key].length === 0 || force) {
|
29
|
-
|
30
|
-
var return_obj = undefined;
|
31
|
-
|
32
|
-
if (is_string(force)) {
|
33
|
-
var selector = self.dom[key].selector;
|
34
|
-
self.dom[key] = $(force).find(selector);
|
35
|
-
self.dom[key].selector = selector;
|
36
|
-
|
37
|
-
return_obj = self.dom[key];
|
38
|
-
}
|
39
|
-
|
40
|
-
var selection = $(self.dom[key].selector);
|
41
|
-
unless(selection.length === 0, function() {
|
42
|
-
return_obj = selection;
|
43
|
-
});
|
44
|
-
|
45
|
-
return return_obj;
|
46
|
-
}
|
47
|
-
else {
|
48
|
-
return self.dom[key];
|
49
|
-
}
|
50
|
-
}
|
51
|
-
}
|
52
|
-
catch(error) {
|
53
|
-
alert(error.message);
|
54
|
-
}
|
55
|
-
}
|
56
|
-
else if (is_typeof(Object, elements)){
|
57
|
-
self.call_on_ready(function() {
|
58
|
-
for(var key in elements) {
|
59
|
-
if (elements.hasOwnProperty(key)) {
|
60
|
-
self.dom[key] = elements[key];
|
61
|
-
}
|
62
|
-
}
|
63
|
-
});
|
64
|
-
}
|
65
|
-
};
|
66
|
-
|
67
|
-
})(jQuery);
|