ninjs 0.16.1 → 0.16.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. data/VERSION +1 -1
  2. data/ninjs.gemspec +13 -14
  3. data/repository/ninjs/core/dom.js +143 -137
  4. metadata +4 -5
  5. data/CNAME +0 -1
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.16.1
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 = "ninjs"
8
- s.version = "0.16.1"
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 = ["Dayton Nolan"]
12
- s.date = "2011-10-21"
13
- s.description = "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 = "daytonn@gmail.com"
15
- s.executables = ["ninjs"]
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 = "http://github.com/textnotspeech/ninjs"
190
- s.licenses = ["MIT"]
191
- s.require_paths = ["lib"]
192
- s.rubyforge_project = "nowarning"
193
- s.rubygems_version = "1.8.10"
194
- s.summary = "ninjs is a command line application to help you write clean, modular javascript applications."
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
- // Slightly modified version of domready: http://code.google.com/p/domready/
2
- var dom = (function() {
3
- var userAgent = navigator.userAgent;
4
- var browser = {
5
- agent: userAgent,
6
- mozilla: (/mozilla/.test(userAgent.toLowerCase())) && !(/(compatible|webkit)/.test(userAgent.toLowerCase())),
7
- webkit: /webkit/.test(userAgent.toLowerCase()),
8
- firefox: /firefox/.test(userAgent.toLowerCase()),
9
- chrome: /webkit/.test(userAgent.toLowerCase()),
10
- safari: /safari/.test(userAgent.toLowerCase()),
11
- opera: /opera/.test(userAgent.toLowerCase()),
12
- msie: (/msie/.test(userAgent.toLowerCase())) && !(/opera/.test( userAgent.toLowerCase() ))
13
- };
14
-
15
- var readyBound = false;
16
- var isReady = false;
17
- var readyList = [];
18
-
19
- function domReady() {
20
- if (!isReady) {
21
- isReady = true;
22
- if (readyList) {
23
- for(var fn = 0; fn < readyList.length; fn++) {
24
- readyList[fn].call(window, []);
25
- }
26
- readyList = [];
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
- // From Simon Willison. A safe way to fire onload w/o screwing up everyone else.
32
- function addLoadEvent(func) {
33
- var oldonload = window.onload;
34
- if (typeof window.onload != 'function') {
35
- window.onload = func;
36
- }
37
- else {
38
- window.onload = function() {
39
- if (oldonload) {
40
- oldonload();
41
- }
42
- func();
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
- // does the heavy work of working through the browsers idiosyncracies (let's call them that) to hook onload.
48
- function bindReady() {
49
- if (readyBound) {
50
- return;
51
- }
52
-
53
- readyBound = true;
54
-
55
- // Mozilla, Opera (see further below for it) and webkit nightlies currently support this event
56
- if (document.addEventListener && !browser.opera) {
57
- // Use the handy event callback
58
- document.addEventListener("DOMContentLoaded", domReady, false);
59
- }
60
-
61
- // If IE is used and is not in a frame
62
- // Continually check to see if the document is ready
63
- if (browser.msie && window == top) {
64
- (function() {
65
- if (isReady) {
66
- return;
67
- }
68
- try {
69
- // If IE is used, use the trick by Diego Perini
70
- // http://javascript.nwbox.com/IEContentLoaded/
71
- document.documentElement.doScroll("left");
72
- } catch(error) {
73
- setTimeout(arguments.callee, 0);
74
- return;
75
- }
76
- // and execute any waiting functions
77
- domReady();
78
- })();
79
- }
80
-
81
- if (browser.opera) {
82
- document.addEventListener( "DOMContentLoaded", function () {
83
- if (isReady) {
84
- return;
85
- }
86
- for (var i = 0; i < document.styleSheets.length; i++) {
87
- if (document.styleSheets[i].disabled) {
88
- setTimeout( arguments.callee, 0 );
89
- return;
90
- }
91
- // and execute any waiting functions
92
- domReady();
93
- }
94
- }, false);
95
- }
96
-
97
- if (browser.safari) {
98
- var numStyles;
99
- (function() {
100
- if (isReady) {
101
- return;
102
- }
103
- if (document.readyState != "loaded" && document.readyState != "complete") {
104
- setTimeout( arguments.callee, 0 );
105
- return;
106
- }
107
- if (numStyles === undefined) {
108
- var links = document.getElementsByTagName("link");
109
- for (var i=0; i < links.length; i++) {
110
- if (links[i].getAttribute('rel') == 'stylesheet') {
111
- numStyles++;
112
- }
113
- }
114
- var styles = document.getElementsByTagName("style");
115
- numStyles += styles.length;
116
- }
117
- if (document.styleSheets.length != numStyles) {
118
- setTimeout( arguments.callee, 0 );
119
- return;
120
- }
121
-
122
- // and execute any waiting functions
123
- domReady();
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
- return {
132
- bind: bindReady,
133
- is_ready: isReady,
134
- ready_list: readyList
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
- dom.bind();
151
+ bindReady();
146
152
 
147
153
  // If the DOM is already ready
148
- if (dom.is_ready()) {
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
- dom.ready_list.push( function() { return fn.call(window, args || []); } );
160
+ readyList.push( function() { return fn.call(window, args || []); } );
155
161
  }
156
162
  };
157
163
 
158
- dom.bind();
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.1
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-21 00:00:00 Z
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: 4531478717148627885
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.10
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