loadjs 0.0.2 → 0.0.3
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.
- data/MIT-LICENSE +1 -1
- data/lib/loadjs/version.rb +1 -1
- data/vendor/assets/javascripts/loadjs.js +31 -6
- metadata +4 -4
data/MIT-LICENSE
CHANGED
data/lib/loadjs/version.rb
CHANGED
@@ -1,11 +1,36 @@
|
|
1
1
|
function load(options, fn) {
|
2
2
|
$(function(){
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
3
|
+
var body = $("body");
|
4
|
+
var currentController = body.data("controller");
|
5
|
+
var currentAction = body.data("action");
|
6
|
+
|
7
|
+
if (typeof options === "string") {
|
8
|
+
var splitOption = options.split("#");
|
9
|
+
if (splitOption[0] != currentController || splitOption[1] != currentAction) {
|
10
|
+
return;
|
11
|
+
}
|
12
|
+
fn(controller, action);
|
13
|
+
} else if (typeof options.controllers !== "undefined") {
|
14
|
+
for (var controller in options.controllers) {
|
15
|
+
var actions = options.controllers[controller];
|
16
|
+
if (controller == currentController && actions.length == 0) {
|
17
|
+
fn(controller, action);
|
18
|
+
} else {
|
19
|
+
for (var i = 0, length = actions.length; i < length; ++i) {
|
20
|
+
if (actions[i] == currentAction) {
|
21
|
+
fn(controller, action);
|
22
|
+
break;
|
23
|
+
}
|
24
|
+
}
|
25
|
+
}
|
26
|
+
}
|
27
|
+
} else {
|
28
|
+
if (options.controller != currentController) {
|
29
|
+
return;
|
30
|
+
}
|
31
|
+
if (typeof options.action === "undefined" || options.action == currentAction) {
|
32
|
+
fn(controller, action);
|
33
|
+
}
|
9
34
|
}
|
10
35
|
});
|
11
36
|
}
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: loadjs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.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: 2013-
|
12
|
+
date: 2013-04-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -101,7 +101,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
101
101
|
version: '0'
|
102
102
|
segments:
|
103
103
|
- 0
|
104
|
-
hash: -
|
104
|
+
hash: -2462525434442556114
|
105
105
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
106
106
|
none: false
|
107
107
|
requirements:
|
@@ -110,7 +110,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
110
110
|
version: '0'
|
111
111
|
segments:
|
112
112
|
- 0
|
113
|
-
hash: -
|
113
|
+
hash: -2462525434442556114
|
114
114
|
requirements: []
|
115
115
|
rubyforge_project:
|
116
116
|
rubygems_version: 1.8.23
|