ninjs 0.16.1 → 0.16.2
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/VERSION +1 -1
- data/ninjs.gemspec +13 -14
- data/repository/ninjs/core/dom.js +143 -137
- metadata +4 -5
- data/CNAME +0 -1
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.16.
|
1
|
+
0.16.2
|
data/ninjs.gemspec
CHANGED
@@ -4,15 +4,15 @@
|
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
|
-
s.name =
|
8
|
-
s.version = "0.16.
|
7
|
+
s.name = %q{ninjs}
|
8
|
+
s.version = "0.16.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
-
s.authors = [
|
12
|
-
s.date =
|
13
|
-
s.description =
|
14
|
-
s.email =
|
15
|
-
s.executables = [
|
11
|
+
s.authors = [%q{Dayton Nolan}]
|
12
|
+
s.date = %q{2011-10-27}
|
13
|
+
s.description = %q{Ninjs is a ruby application and small javascript framework that helps you build clean, modular javascript applications. Ninjs encourages "Good Parts" best practices and the Crockford school Module pattern (http://www.crockford.com/). The ninjs command line application is an automatic compiler, written in ruby, and based on the Sprockets library (http://getsprockets.org/).}
|
14
|
+
s.email = %q{daytonn@gmail.com}
|
15
|
+
s.executables = [%q{ninjs}]
|
16
16
|
s.extra_rdoc_files = [
|
17
17
|
"LICENSE",
|
18
18
|
"README.md"
|
@@ -21,7 +21,6 @@ Gem::Specification.new do |s|
|
|
21
21
|
".bundle/config",
|
22
22
|
".gitmodules",
|
23
23
|
".travis.yml",
|
24
|
-
"CNAME",
|
25
24
|
"Gemfile",
|
26
25
|
"Gemfile.lock",
|
27
26
|
"LICENSE",
|
@@ -186,12 +185,12 @@ Gem::Specification.new do |s|
|
|
186
185
|
"templates/jasmine.yml",
|
187
186
|
"templates/test-index.html"
|
188
187
|
]
|
189
|
-
s.homepage =
|
190
|
-
s.licenses = [
|
191
|
-
s.require_paths = [
|
192
|
-
s.rubyforge_project =
|
193
|
-
s.rubygems_version =
|
194
|
-
s.summary =
|
188
|
+
s.homepage = %q{http://github.com/textnotspeech/ninjs}
|
189
|
+
s.licenses = [%q{MIT}]
|
190
|
+
s.require_paths = [%q{lib}]
|
191
|
+
s.rubyforge_project = %q{nowarning}
|
192
|
+
s.rubygems_version = %q{1.8.8}
|
193
|
+
s.summary = %q{ninjs is a command line application to help you write clean, modular javascript applications.}
|
195
194
|
s.test_files = [
|
196
195
|
"spec/cli_spec.rb",
|
197
196
|
"spec/command_spec.rb",
|
@@ -1,139 +1,145 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
1
|
+
var DomReady = window.DomReady = {},
|
2
|
+
userAgent = navigator.userAgent.toLowerCase(),
|
3
|
+
browser = {
|
4
|
+
version: (userAgent.match( /.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/ ) || [])[1],
|
5
|
+
safari: /webkit/.test(userAgent),
|
6
|
+
opera: /opera/.test(userAgent),
|
7
|
+
msie: (/msie/.test(userAgent)) && (!/opera/.test( userAgent )),
|
8
|
+
mozilla: (/mozilla/.test(userAgent)) && (!/(compatible|webkit)/.test(userAgent))
|
9
|
+
},
|
10
|
+
readyBound = false,
|
11
|
+
isReady = false,
|
12
|
+
readyList = [];
|
13
|
+
|
14
|
+
|
15
|
+
function domReady() {
|
16
|
+
// Make sure that the DOM is not already loaded
|
17
|
+
if(!isReady) {
|
18
|
+
// Remember that the DOM is ready
|
19
|
+
isReady = true;
|
20
|
+
|
21
|
+
if(readyList) {
|
22
|
+
var length = readyList.length;
|
23
|
+
for(var fn = 0; fn < length; fn++) {
|
24
|
+
readyList[fn].call(window, []);
|
25
|
+
}
|
26
|
+
|
27
|
+
readyList = [];
|
28
|
+
}
|
29
|
+
}
|
30
|
+
};
|
30
31
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
32
|
+
// From Simon Willison. A safe way to fire onload w/o screwing up everyone else.
|
33
|
+
function addLoadEvent(func) {
|
34
|
+
var oldonload = window.onload;
|
35
|
+
if (typeof window.onload != 'function') {
|
36
|
+
window.onload = func;
|
37
|
+
}
|
38
|
+
else {
|
39
|
+
window.onload = function() {
|
40
|
+
if (oldonload) {
|
41
|
+
oldonload();
|
42
|
+
}
|
43
|
+
func();
|
44
|
+
}
|
45
|
+
}
|
46
|
+
};
|
46
47
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
// A fallback to window.onload, that will always work
|
128
|
-
addLoadEvent(domReady);
|
129
|
-
}
|
48
|
+
// does the heavy work of working through the browsers idiosyncracies (let's call them that) to hook onload.
|
49
|
+
function bindReady() {
|
50
|
+
if(readyBound) {
|
51
|
+
return;
|
52
|
+
}
|
53
|
+
|
54
|
+
readyBound = true;
|
55
|
+
|
56
|
+
// Mozilla, Opera (see further below for it) and webkit nightlies currently support this event
|
57
|
+
if (document.addEventListener && !browser.opera) {
|
58
|
+
// Use the handy event callback
|
59
|
+
document.addEventListener("DOMContentLoaded", domReady, false);
|
60
|
+
}
|
61
|
+
|
62
|
+
// If IE is used and is not in a frame
|
63
|
+
// Continually check to see if the document is ready
|
64
|
+
if (browser.msie && window == top) (function() {
|
65
|
+
if (isReady) return;
|
66
|
+
try {
|
67
|
+
// If IE is used, use the trick by Diego Perini
|
68
|
+
// http://javascript.nwbox.com/IEContentLoaded/
|
69
|
+
document.documentElement.doScroll("left");
|
70
|
+
}
|
71
|
+
catch(error) {
|
72
|
+
setTimeout(arguments.callee, 0);
|
73
|
+
return;
|
74
|
+
}
|
75
|
+
// and execute any waiting functions
|
76
|
+
domReady();
|
77
|
+
})();
|
78
|
+
|
79
|
+
if(browser.opera) {
|
80
|
+
document.addEventListener( "DOMContentLoaded", function () {
|
81
|
+
if (isReady) return;
|
82
|
+
for (var i = 0; i < document.styleSheets.length; i++)
|
83
|
+
if (document.styleSheets[i].disabled) {
|
84
|
+
setTimeout( arguments.callee, 0 );
|
85
|
+
return;
|
86
|
+
}
|
87
|
+
// and execute any waiting functions
|
88
|
+
domReady();
|
89
|
+
}, false);
|
90
|
+
}
|
91
|
+
|
92
|
+
if(browser.safari) {
|
93
|
+
var numStyles;
|
94
|
+
(function(){
|
95
|
+
if (isReady) return;
|
96
|
+
|
97
|
+
if (document.readyState != "loaded" && document.readyState != "complete") {
|
98
|
+
setTimeout( arguments.callee, 0 );
|
99
|
+
return;
|
100
|
+
}
|
101
|
+
|
102
|
+
if (numStyles === undefined) {
|
103
|
+
var links = document.getElementsByTagName("link");
|
104
|
+
for (var i=0; i < links.length; i++) {
|
105
|
+
if(links[i].getAttribute('rel') == 'stylesheet') {
|
106
|
+
numStyles++;
|
107
|
+
}
|
108
|
+
}
|
109
|
+
|
110
|
+
var styles = document.getElementsByTagName("style");
|
111
|
+
numStyles += styles.length;
|
112
|
+
}
|
113
|
+
|
114
|
+
if (document.styleSheets.length != numStyles) {
|
115
|
+
setTimeout( arguments.callee, 0 );
|
116
|
+
return;
|
117
|
+
}
|
118
|
+
|
119
|
+
// and execute any waiting functions
|
120
|
+
domReady();
|
121
|
+
})();
|
122
|
+
}
|
123
|
+
|
124
|
+
// A fallback to window.onload, that will always work
|
125
|
+
addLoadEvent(domReady);
|
126
|
+
};
|
130
127
|
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
128
|
+
// This is the public function that people can use to hook up ready.
|
129
|
+
DomReady.ready = function(fn, args) {
|
130
|
+
// Attach the listeners
|
131
|
+
bindReady();
|
132
|
+
|
133
|
+
// If the DOM is already ready
|
134
|
+
if (isReady) {
|
135
|
+
// Execute the function immediately
|
136
|
+
fn.call(window, []);
|
137
|
+
}
|
138
|
+
else {
|
139
|
+
// Add the function to the wait list
|
140
|
+
readyList.push( function() { return fn.call(window, []); } );
|
141
|
+
}
|
142
|
+
};
|
137
143
|
|
138
144
|
NinjsDOM = function() {
|
139
145
|
this.cached_selectors = {};
|
@@ -142,17 +148,17 @@ NinjsDOM = function() {
|
|
142
148
|
// This is the public function that people can use to hook up ready.
|
143
149
|
NinjsDOM.prototype.ready = function(fn, args) {
|
144
150
|
// Attach the listeners
|
145
|
-
|
151
|
+
bindReady();
|
146
152
|
|
147
153
|
// If the DOM is already ready
|
148
|
-
if (
|
154
|
+
if (isReady) {
|
149
155
|
// Execute the function immediately
|
150
156
|
fn.call(window, args || []);
|
151
157
|
}
|
152
158
|
else {
|
153
159
|
// Add the function to the wait list
|
154
|
-
|
160
|
+
readyList.push( function() { return fn.call(window, args || []); } );
|
155
161
|
}
|
156
162
|
};
|
157
163
|
|
158
|
-
|
164
|
+
bindReady();
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: ninjs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.16.
|
5
|
+
version: 0.16.2
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Dayton Nolan
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-10-
|
13
|
+
date: 2011-10-27 00:00:00 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: fssm
|
@@ -179,7 +179,6 @@ files:
|
|
179
179
|
- .bundle/config
|
180
180
|
- .gitmodules
|
181
181
|
- .travis.yml
|
182
|
-
- CNAME
|
183
182
|
- Gemfile
|
184
183
|
- Gemfile.lock
|
185
184
|
- LICENSE
|
@@ -356,7 +355,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
356
355
|
requirements:
|
357
356
|
- - ">="
|
358
357
|
- !ruby/object:Gem::Version
|
359
|
-
hash:
|
358
|
+
hash: 4215172574797245996
|
360
359
|
segments:
|
361
360
|
- 0
|
362
361
|
version: "0"
|
@@ -369,7 +368,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
369
368
|
requirements: []
|
370
369
|
|
371
370
|
rubyforge_project: nowarning
|
372
|
-
rubygems_version: 1.8.
|
371
|
+
rubygems_version: 1.8.8
|
373
372
|
signing_key:
|
374
373
|
specification_version: 3
|
375
374
|
summary: ninjs is a command line application to help you write clean, modular javascript applications.
|
data/CNAME
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
ninjs.info
|