poke_js 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/app/assets/javascripts/poke_js.js +24 -14
- data/lib/poke_js/version.rb +1 -1
- metadata +2 -2
@@ -3,24 +3,24 @@ POKE = {
|
|
3
3
|
blank: function(o) {
|
4
4
|
return typeof o === "undefined" || o === null;
|
5
5
|
},
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
return
|
6
|
+
get_or_create: function(namespace_string) {
|
7
|
+
var current_namepace = window;
|
8
|
+
$.each(namespace_string.split('.'), function(index, level) {
|
9
|
+
if (POKE.blank(current_namepace[level]))
|
10
|
+
current_namepace[level] = {};
|
11
|
+
current_namepace = current_namepace[level];
|
12
|
+
});
|
13
|
+
|
14
|
+
return current_namepace;
|
15
15
|
},
|
16
|
-
define: function(
|
17
|
-
var
|
18
|
-
return $.extend(
|
16
|
+
define: function(namespace_string, definition) {
|
17
|
+
var found_namespace = POKE.get_or_create(namespace_string);
|
18
|
+
return $.extend(found_namespace, definition);
|
19
19
|
},
|
20
20
|
|
21
21
|
|
22
22
|
exec_all: function(controller, format, action) {
|
23
|
-
POKE.exec("
|
23
|
+
POKE.exec("all", format);
|
24
24
|
POKE.exec(controller, format);
|
25
25
|
POKE.exec(controller, format, action);
|
26
26
|
},
|
@@ -44,5 +44,15 @@ POKE = {
|
|
44
44
|
};
|
45
45
|
|
46
46
|
if (POKE.blank(window["APP"]))
|
47
|
-
APP = {
|
47
|
+
APP = {
|
48
|
+
namespace_string: function(namespace_string) {
|
49
|
+
return "APP." + namespace_string;
|
50
|
+
},
|
51
|
+
get_or_create: function(namespace_string) {
|
52
|
+
return POKE.define(APP.namespace_string(namespace_string));
|
53
|
+
},
|
54
|
+
define: function(namespace_string, definition) {
|
55
|
+
return POKE.define(APP.namespace_string(namespace_string), definition);
|
56
|
+
}
|
57
|
+
};
|
48
58
|
$(POKE.init);
|
data/lib/poke_js/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: poke_js
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
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: 2012-12-
|
12
|
+
date: 2012-12-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|