opal-rails 0.1.0 → 0.2.0
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/.gitignore +4 -0
- data/.travis.yml +6 -1
- data/Gemfile +5 -0
- data/README.md +37 -13
- data/Rakefile +14 -0
- data/app/controllers/opal_spec_controller.rb +9 -4
- data/app/views/layouts/opal_spec.html.erb +2 -3
- data/app/views/opal_spec/_index.html.erb +11 -0
- data/app/views/opal_spec/_runner.html.erb +2 -0
- data/app/views/opal_spec/run.html.erb +2 -0
- data/config/routes.rb +1 -1
- data/lib/assets/javascripts/opal-jquery.js +499 -0
- data/lib/assets/javascripts/opal-spec-runner.js.rb +2 -1
- data/lib/assets/javascripts/opal-spec.js +519 -222
- data/lib/assets/javascripts/opal.js +974 -932
- data/lib/opal/rails/engine.rb +5 -1
- data/lib/opal/rails/version.rb +2 -2
- data/opal-rails.gemspec +2 -4
- data/spec/opal/rails/processor_spec.rb +1 -1
- data/spec/spec_helper.rb +1 -1
- data/test_app/app/assets/javascripts/spec/{example_spec.js_spec.rb → example_spec.js.rb} +0 -0
- data/test_app/config/initializers/session_store.rb +1 -1
- data/test_app/config/initializers/wrap_parameters.rb +1 -1
- metadata +19 -35
- data/app/assets/images/opal-rails/.gitkeep +0 -0
- data/app/assets/javascripts/opal-rails/.gitkeep +0 -0
- data/app/assets/stylesheets/opal-rails/.gitkeep +0 -0
- data/app/controllers/.gitkeep +0 -0
- data/app/helpers/.gitkeep +0 -0
- data/app/mailers/.gitkeep +0 -0
- data/app/models/.gitkeep +0 -0
- data/app/views/.gitkeep +0 -0
- data/lib/assets/javascripts/opal-dom.js +0 -654
data/lib/opal/rails/engine.rb
CHANGED
@@ -1,9 +1,13 @@
|
|
1
|
-
require 'rails
|
1
|
+
require 'rails'
|
2
2
|
|
3
3
|
module Opal
|
4
4
|
module Rails
|
5
5
|
class Engine < ::Rails::Engine
|
6
6
|
config.app_generators.javascript_engine :opal
|
7
|
+
|
8
|
+
# Cache eager_load_paths now, otherwise the assets dir is added
|
9
|
+
# and its .rb files are eagerly loaded.
|
10
|
+
config.eager_load_paths
|
7
11
|
end
|
8
12
|
end
|
9
13
|
end
|
data/lib/opal/rails/version.rb
CHANGED
data/opal-rails.gemspec
CHANGED
@@ -18,11 +18,9 @@ Gem::Specification.new do |s|
|
|
18
18
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
19
19
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
20
20
|
s.require_paths = ['lib']
|
21
|
-
|
21
|
+
|
22
22
|
s.add_runtime_dependency 'opal', Opal::Rails::OPAL_VERSION
|
23
|
-
s.add_runtime_dependency '
|
24
|
-
s.add_runtime_dependency 'sprockets', '~> 2.1'
|
25
|
-
|
23
|
+
s.add_runtime_dependency 'rails', '~> 3.2.0'
|
26
24
|
s.add_development_dependency 'rspec', '~> 2.4'
|
27
25
|
s.add_development_dependency 'rspec-rails', '~> 2.4'
|
28
26
|
end
|
data/spec/spec_helper.rb
CHANGED
File without changes
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# Be sure to restart your server when you modify this file.
|
2
2
|
|
3
|
-
TestApp::Application.config.session_store :cookie_store, key
|
3
|
+
TestApp::Application.config.session_store :cookie_store, :key => '_test_app_session'
|
4
4
|
|
5
5
|
# Use the database for sessions instead of the cookie-based default,
|
6
6
|
# which shouldn't be used to store highly confidential information
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: opal-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,22 +9,22 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-09-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: opal
|
16
|
-
requirement: &
|
16
|
+
requirement: &70314270486520 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - =
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 0.3.
|
21
|
+
version: 0.3.22
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70314270486520
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
|
-
name:
|
27
|
-
requirement: &
|
26
|
+
name: rails
|
27
|
+
requirement: &70314270486060 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,21 +32,10 @@ dependencies:
|
|
32
32
|
version: 3.2.0
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
36
|
-
- !ruby/object:Gem::Dependency
|
37
|
-
name: sprockets
|
38
|
-
requirement: &70169717227380 !ruby/object:Gem::Requirement
|
39
|
-
none: false
|
40
|
-
requirements:
|
41
|
-
- - ~>
|
42
|
-
- !ruby/object:Gem::Version
|
43
|
-
version: '2.1'
|
44
|
-
type: :runtime
|
45
|
-
prerelease: false
|
46
|
-
version_requirements: *70169717227380
|
35
|
+
version_requirements: *70314270486060
|
47
36
|
- !ruby/object:Gem::Dependency
|
48
37
|
name: rspec
|
49
|
-
requirement: &
|
38
|
+
requirement: &70314270485560 !ruby/object:Gem::Requirement
|
50
39
|
none: false
|
51
40
|
requirements:
|
52
41
|
- - ~>
|
@@ -54,10 +43,10 @@ dependencies:
|
|
54
43
|
version: '2.4'
|
55
44
|
type: :development
|
56
45
|
prerelease: false
|
57
|
-
version_requirements: *
|
46
|
+
version_requirements: *70314270485560
|
58
47
|
- !ruby/object:Gem::Dependency
|
59
48
|
name: rspec-rails
|
60
|
-
requirement: &
|
49
|
+
requirement: &70314270485100 !ruby/object:Gem::Requirement
|
61
50
|
none: false
|
62
51
|
requirements:
|
63
52
|
- - ~>
|
@@ -65,7 +54,7 @@ dependencies:
|
|
65
54
|
version: '2.4'
|
66
55
|
type: :development
|
67
56
|
prerelease: false
|
68
|
-
version_requirements: *
|
57
|
+
version_requirements: *70314270485100
|
69
58
|
description: Rails bindings for opal JS engine
|
70
59
|
email:
|
71
60
|
- elia@schito.me
|
@@ -79,18 +68,13 @@ files:
|
|
79
68
|
- Gemfile
|
80
69
|
- README.md
|
81
70
|
- Rakefile
|
82
|
-
- app/assets/images/opal-rails/.gitkeep
|
83
|
-
- app/assets/javascripts/opal-rails/.gitkeep
|
84
|
-
- app/assets/stylesheets/opal-rails/.gitkeep
|
85
|
-
- app/controllers/.gitkeep
|
86
71
|
- app/controllers/opal_spec_controller.rb
|
87
|
-
- app/helpers/.gitkeep
|
88
|
-
- app/mailers/.gitkeep
|
89
|
-
- app/models/.gitkeep
|
90
|
-
- app/views/.gitkeep
|
91
72
|
- app/views/layouts/opal_spec.html.erb
|
73
|
+
- app/views/opal_spec/_index.html.erb
|
74
|
+
- app/views/opal_spec/_runner.html.erb
|
75
|
+
- app/views/opal_spec/run.html.erb
|
92
76
|
- config/routes.rb
|
93
|
-
- lib/assets/javascripts/opal-
|
77
|
+
- lib/assets/javascripts/opal-jquery.js
|
94
78
|
- lib/assets/javascripts/opal-spec-runner.js.rb
|
95
79
|
- lib/assets/javascripts/opal-spec.js
|
96
80
|
- lib/assets/javascripts/opal.js
|
@@ -111,7 +95,7 @@ files:
|
|
111
95
|
- test_app/app/assets/images/rails.png
|
112
96
|
- test_app/app/assets/javascripts/application.js
|
113
97
|
- test_app/app/assets/javascripts/spec.js
|
114
|
-
- test_app/app/assets/javascripts/spec/example_spec.
|
98
|
+
- test_app/app/assets/javascripts/spec/example_spec.js.rb
|
115
99
|
- test_app/app/assets/stylesheets/application.css
|
116
100
|
- test_app/app/controllers/application_controller.rb
|
117
101
|
- test_app/app/views/layouts/application.html.erb
|
@@ -154,7 +138,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
154
138
|
version: '0'
|
155
139
|
segments:
|
156
140
|
- 0
|
157
|
-
hash: -
|
141
|
+
hash: -3556514632691640513
|
158
142
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
159
143
|
none: false
|
160
144
|
requirements:
|
@@ -163,7 +147,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
163
147
|
version: '0'
|
164
148
|
segments:
|
165
149
|
- 0
|
166
|
-
hash: -
|
150
|
+
hash: -3556514632691640513
|
167
151
|
requirements: []
|
168
152
|
rubyforge_project: opal-rails
|
169
153
|
rubygems_version: 1.8.17
|
File without changes
|
File without changes
|
File without changes
|
data/app/controllers/.gitkeep
DELETED
File without changes
|
data/app/helpers/.gitkeep
DELETED
File without changes
|
data/app/mailers/.gitkeep
DELETED
File without changes
|
data/app/models/.gitkeep
DELETED
File without changes
|
data/app/views/.gitkeep
DELETED
File without changes
|
@@ -1,654 +0,0 @@
|
|
1
|
-
// file lib/opal/dom/depreceated.rb
|
2
|
-
(function() {
|
3
|
-
var __opal = Opal, self = __opal.top, __scope = __opal, nil = __opal.nil, __breaker = __opal.breaker, __slice = __opal.slice, __klass = __opal.klass;
|
4
|
-
|
5
|
-
return (function(__base, __super){
|
6
|
-
// line 1, lib/opal/dom/depreceated.rb, class DOM
|
7
|
-
function DOM() {};
|
8
|
-
DOM = __klass(__base, __super, "DOM", DOM);
|
9
|
-
var DOM_prototype = DOM.prototype, __scope = DOM._scope;
|
10
|
-
|
11
|
-
// line 2, lib/opal/dom/depreceated.rb, DOM.parse
|
12
|
-
DOM.$parse = function(str) {
|
13
|
-
|
14
|
-
|
15
|
-
var el = document.createElement('div');
|
16
|
-
// awkward IE
|
17
|
-
el.innerHTML = "_" + str;
|
18
|
-
|
19
|
-
var child = el.firstChild;
|
20
|
-
|
21
|
-
while (child) {
|
22
|
-
if (child.nodeType !== 1) {
|
23
|
-
child = child.nextSibling
|
24
|
-
continue;
|
25
|
-
}
|
26
|
-
|
27
|
-
return __scope.Element.$new(child)
|
28
|
-
}
|
29
|
-
|
30
|
-
this.$raise("no DOM node in content")
|
31
|
-
|
32
|
-
}
|
33
|
-
;DOM._sdonate(["$parse"]);
|
34
|
-
})(self, null)
|
35
|
-
})();
|
36
|
-
// file lib/opal/dom/document.rb
|
37
|
-
(function() {
|
38
|
-
var __opal = Opal, self = __opal.top, __scope = __opal, nil = __opal.nil, __breaker = __opal.breaker, __slice = __opal.slice, __module = __opal.module;
|
39
|
-
|
40
|
-
return (function(__base){
|
41
|
-
// line 1, lib/opal/dom/document.rb, module Document
|
42
|
-
function Document() {};
|
43
|
-
Document = __module(__base, "Document", Document);
|
44
|
-
var Document_prototype = Document.prototype, __scope = Document._scope, TMP_1;
|
45
|
-
|
46
|
-
// line 2, lib/opal/dom/document.rb, Document.body_ready?
|
47
|
-
Document.$body_ready$p = function() {
|
48
|
-
|
49
|
-
return !!(document && document.body);
|
50
|
-
};
|
51
|
-
|
52
|
-
// line 6, lib/opal/dom/document.rb, Document.ready?
|
53
|
-
Document.$ready$p = TMP_1 = function() {
|
54
|
-
var __context, block;
|
55
|
-
block = TMP_1._p || nil, __context = block._s, TMP_1._p = null;
|
56
|
-
|
57
|
-
setTimeout(function() { block.call(block._s); }, 0)
|
58
|
-
};
|
59
|
-
;Document._sdonate(["$body_ready$p", "$ready$p"]);
|
60
|
-
})(self)
|
61
|
-
})();
|
62
|
-
// file lib/opal/dom/element.rb
|
63
|
-
(function() {
|
64
|
-
var __opal = Opal, self = __opal.top, __scope = __opal, nil = __opal.nil, __breaker = __opal.breaker, __slice = __opal.slice, __klass = __opal.klass;
|
65
|
-
|
66
|
-
return (function(__base, __super){
|
67
|
-
// line 1, lib/opal/dom/element.rb, class Element
|
68
|
-
function Element() {};
|
69
|
-
Element = __klass(__base, __super, "Element", Element);
|
70
|
-
var supports_inner_html = nil, Element_prototype = Element.prototype, __scope = Element._scope, __a;
|
71
|
-
|
72
|
-
// line 5, lib/opal/dom/element.rb, Element.[]
|
73
|
-
Element.$aref$ = function(str) {
|
74
|
-
|
75
|
-
return this.$Element(str)
|
76
|
-
};
|
77
|
-
|
78
|
-
// line 27, lib/opal/dom/element.rb, Element#initialize
|
79
|
-
Element_prototype.$initialize = function(el) {
|
80
|
-
if (el == null) {
|
81
|
-
el = "div"
|
82
|
-
}
|
83
|
-
|
84
|
-
if (typeof(el) === 'string') {
|
85
|
-
el = document.createElement(el);
|
86
|
-
}
|
87
|
-
|
88
|
-
if (!el || !el.nodeType) {
|
89
|
-
throw new Error('not a valid element');
|
90
|
-
}
|
91
|
-
|
92
|
-
this.el = el;
|
93
|
-
|
94
|
-
};
|
95
|
-
|
96
|
-
// line 41, lib/opal/dom/element.rb, Element#<<
|
97
|
-
Element_prototype.$lshft$ = function(content) {
|
98
|
-
|
99
|
-
return this.el.appendChild(content.el);
|
100
|
-
};
|
101
|
-
|
102
|
-
Element_prototype.$append = Element_prototype.$lshft$;
|
103
|
-
|
104
|
-
// line 47, lib/opal/dom/element.rb, Element#append_to_body
|
105
|
-
Element_prototype.$append_to_body = function() {
|
106
|
-
|
107
|
-
|
108
|
-
document.body.appendChild(this.el);
|
109
|
-
return this;
|
110
|
-
|
111
|
-
};
|
112
|
-
|
113
|
-
// line 54, lib/opal/dom/element.rb, Element#append_to_head
|
114
|
-
Element_prototype.$append_to_head = function() {
|
115
|
-
|
116
|
-
|
117
|
-
document.getElementsByTagName('head')[0].appendChild(this.el);
|
118
|
-
return this;
|
119
|
-
|
120
|
-
};
|
121
|
-
|
122
|
-
// line 70, lib/opal/dom/element.rb, Element#add_class
|
123
|
-
Element_prototype.$add_class = function(name) {
|
124
|
-
|
125
|
-
|
126
|
-
var el = this.el, className = el.className;
|
127
|
-
|
128
|
-
if (!className) {
|
129
|
-
el.className = name;
|
130
|
-
}
|
131
|
-
else if((' ' + className + ' ').indexOf(' ' + name + ' ') === -1) {
|
132
|
-
el.className += (' ' + name);
|
133
|
-
}
|
134
|
-
|
135
|
-
return this;
|
136
|
-
|
137
|
-
};
|
138
|
-
|
139
|
-
// line 97, lib/opal/dom/element.rb, Element#has_class?
|
140
|
-
Element_prototype.$has_class$p = function(name) {
|
141
|
-
|
142
|
-
return (' ' + this.el.className + ' ').indexOf(' ' + name + ' ') !== -1;
|
143
|
-
};
|
144
|
-
|
145
|
-
// line 101, lib/opal/dom/element.rb, Element#id
|
146
|
-
Element_prototype.$id = function() {
|
147
|
-
|
148
|
-
return this.el.id;
|
149
|
-
};
|
150
|
-
|
151
|
-
// line 105, lib/opal/dom/element.rb, Element#inspect
|
152
|
-
Element_prototype.$inspect = function() {
|
153
|
-
|
154
|
-
|
155
|
-
var val, el = this.el, str = '<' + el.tagName.toLowerCase();
|
156
|
-
|
157
|
-
if (val = el.id) str += (' id="' + val + '"');
|
158
|
-
if (val = el.className) str += (' class="' + val + '"');
|
159
|
-
|
160
|
-
return str + '>';
|
161
|
-
|
162
|
-
};
|
163
|
-
|
164
|
-
// line 116, lib/opal/dom/element.rb, Element#class_name
|
165
|
-
Element_prototype.$class_name = function() {
|
166
|
-
|
167
|
-
|
168
|
-
return this.el.className || '';
|
169
|
-
|
170
|
-
};
|
171
|
-
|
172
|
-
// line 122, lib/opal/dom/element.rb, Element#class_name=
|
173
|
-
Element_prototype.$class_name$e = function(name) {
|
174
|
-
|
175
|
-
|
176
|
-
return this.el.className = name;
|
177
|
-
|
178
|
-
};
|
179
|
-
|
180
|
-
// line 137, lib/opal/dom/element.rb, Element#next
|
181
|
-
Element_prototype.$next = function() {
|
182
|
-
|
183
|
-
return this.$sibling("nextSibling");
|
184
|
-
};
|
185
|
-
|
186
|
-
// line 150, lib/opal/dom/element.rb, Element#prev
|
187
|
-
Element_prototype.$prev = function() {
|
188
|
-
|
189
|
-
return this.$sibling("previousSibling");
|
190
|
-
};
|
191
|
-
|
192
|
-
// line 163, lib/opal/dom/element.rb, Element#remove_class
|
193
|
-
Element_prototype.$remove_class = function(name) {
|
194
|
-
|
195
|
-
|
196
|
-
var el = this.el, className = ' ' + el.className + ' ';
|
197
|
-
|
198
|
-
className = className.replace(' ' + name + ' ', ' ');
|
199
|
-
className = className.replace(/^\s+/, '').replace(/\s+$/, '');
|
200
|
-
|
201
|
-
el.className = className;
|
202
|
-
|
203
|
-
return this;
|
204
|
-
|
205
|
-
};
|
206
|
-
|
207
|
-
// line 176, lib/opal/dom/element.rb, Element#remove
|
208
|
-
Element_prototype.$remove = function() {
|
209
|
-
|
210
|
-
|
211
|
-
var el = this.el, parent = el.parentNode;
|
212
|
-
|
213
|
-
if (parent) {
|
214
|
-
parent.removeChild(el);
|
215
|
-
}
|
216
|
-
|
217
|
-
return this;
|
218
|
-
|
219
|
-
};
|
220
|
-
|
221
|
-
// line 189, lib/opal/dom/element.rb, Element#sibling
|
222
|
-
Element_prototype.$sibling = function(type) {
|
223
|
-
|
224
|
-
|
225
|
-
var el = this.el;
|
226
|
-
|
227
|
-
while (el = el[type]) {
|
228
|
-
if (el.nodeType !== 1) {
|
229
|
-
continue;
|
230
|
-
}
|
231
|
-
|
232
|
-
return __scope.Element.$new(el)
|
233
|
-
}
|
234
|
-
|
235
|
-
return nil;
|
236
|
-
|
237
|
-
};
|
238
|
-
|
239
|
-
Element_prototype.$succ = Element_prototype.$next;
|
240
|
-
|
241
|
-
// line 207, lib/opal/dom/element.rb, Element#hide
|
242
|
-
Element_prototype.$hide = function() {
|
243
|
-
|
244
|
-
|
245
|
-
this.el.style.display = 'none';
|
246
|
-
return this;
|
247
|
-
|
248
|
-
};
|
249
|
-
|
250
|
-
// line 214, lib/opal/dom/element.rb, Element#show
|
251
|
-
Element_prototype.$show = function() {
|
252
|
-
|
253
|
-
|
254
|
-
this.el.style.display = '';
|
255
|
-
return this;
|
256
|
-
|
257
|
-
};
|
258
|
-
|
259
|
-
// line 228, lib/opal/dom/element.rb, Element#clear
|
260
|
-
Element_prototype.$clear = function() {
|
261
|
-
|
262
|
-
|
263
|
-
var el = this.el;
|
264
|
-
|
265
|
-
while (el.firstChild) {
|
266
|
-
el.removeChild(el.firstChild);
|
267
|
-
}
|
268
|
-
|
269
|
-
return this;
|
270
|
-
|
271
|
-
};
|
272
|
-
|
273
|
-
// line 240, lib/opal/dom/element.rb, Element#css
|
274
|
-
Element_prototype.$css = function(name, value) {
|
275
|
-
|
276
|
-
|
277
|
-
if (value == null) {
|
278
|
-
return this.el.style[name];
|
279
|
-
}
|
280
|
-
|
281
|
-
return this.el.style[name] = value;
|
282
|
-
|
283
|
-
};
|
284
|
-
|
285
|
-
// line 258, lib/opal/dom/element.rb, Element#html
|
286
|
-
Element_prototype.$html = function() {
|
287
|
-
|
288
|
-
return this.el.innerHTML;
|
289
|
-
};
|
290
|
-
|
291
|
-
// line 272, lib/opal/dom/element.rb, Element#html=
|
292
|
-
Element_prototype.$html$e = function(html) {
|
293
|
-
|
294
|
-
|
295
|
-
this.el.innerHTML = html;
|
296
|
-
|
297
|
-
return this;
|
298
|
-
|
299
|
-
};
|
300
|
-
|
301
|
-
supports_inner_html = true;
|
302
|
-
|
303
|
-
|
304
|
-
try {
|
305
|
-
var table = document.createElement('table');
|
306
|
-
table.innerHTML = "<tr><td></td></tr>";
|
307
|
-
} catch (err) {
|
308
|
-
supports_inner_html = false;
|
309
|
-
}
|
310
|
-
|
311
|
-
|
312
|
-
if ((__a = supports_inner_html) === false || __a === nil) {
|
313
|
-
// line 293, lib/opal/dom/element.rb, Element#html=
|
314
|
-
Element_prototype.$html$e = function(html) {
|
315
|
-
|
316
|
-
this.el.innerHTML = html;
|
317
|
-
return this;
|
318
|
-
}
|
319
|
-
};
|
320
|
-
|
321
|
-
// line 301, lib/opal/dom/element.rb, Element#text
|
322
|
-
Element_prototype.$text = function() {
|
323
|
-
|
324
|
-
return text_value(this.el);
|
325
|
-
};
|
326
|
-
|
327
|
-
// line 305, lib/opal/dom/element.rb, Element#text=
|
328
|
-
Element_prototype.$text$e = function(str) {
|
329
|
-
|
330
|
-
this.$clear();
|
331
|
-
this.el.appendChild(document.createTextNode(str));
|
332
|
-
return this;
|
333
|
-
};
|
334
|
-
|
335
|
-
|
336
|
-
function text_value(el) {
|
337
|
-
var type = el.nodeType, result = '';
|
338
|
-
|
339
|
-
if (type === 1 || type === 9 || type === 11) {
|
340
|
-
if (typeof(el.textContent) === 'string') {
|
341
|
-
return el.textContent;
|
342
|
-
}
|
343
|
-
else if (typeof(el.innerText) === 'string') {
|
344
|
-
return el.innerText.replace(/\r/g, '');
|
345
|
-
}
|
346
|
-
else {
|
347
|
-
for (var c = el.firstChild; c; c = c.nextSibling) {
|
348
|
-
result += text_value(c);
|
349
|
-
}
|
350
|
-
}
|
351
|
-
}
|
352
|
-
else if (type === 3 || type === 4) {
|
353
|
-
return el.nodeValue;
|
354
|
-
}
|
355
|
-
|
356
|
-
return result;
|
357
|
-
}
|
358
|
-
|
359
|
-
;Element._donate(["$initialize", "$lshft$", "$append", "$append_to_body", "$append_to_head", "$add_class", "$has_class$p", "$id", "$inspect", "$class_name", "$class_name$e", "$next", "$prev", "$remove_class", "$remove", "$sibling", "$succ", "$hide", "$show", "$clear", "$css", "$html", "$html$e", "$html$e", "$text", "$text$e"]); ;Element._sdonate(["$aref$"]);
|
360
|
-
})(self, null)
|
361
|
-
})();
|
362
|
-
// file lib/opal/dom/element_set.rb
|
363
|
-
(function() {
|
364
|
-
var __opal = Opal, self = __opal.top, __scope = __opal, nil = __opal.nil, __breaker = __opal.breaker, __slice = __opal.slice, __klass = __opal.klass;
|
365
|
-
|
366
|
-
return (function(__base, __super){
|
367
|
-
// line 11, lib/opal/dom/element_set.rb, class ElementSet
|
368
|
-
function ElementSet() {};
|
369
|
-
ElementSet = __klass(__base, __super, "ElementSet", ElementSet);
|
370
|
-
var ElementSet_prototype = ElementSet.prototype, __scope = ElementSet._scope, TMP_1;
|
371
|
-
|
372
|
-
// line 19, lib/opal/dom/element_set.rb, ElementSet#initialize
|
373
|
-
ElementSet_prototype.$initialize = function(selector, context) {
|
374
|
-
|
375
|
-
return this.length = 0;
|
376
|
-
};
|
377
|
-
|
378
|
-
// line 24, lib/opal/dom/element_set.rb, ElementSet#each
|
379
|
-
ElementSet_prototype.$each = TMP_1 = function() {
|
380
|
-
var __context, block;
|
381
|
-
block = TMP_1._p || nil, __context = block._s, TMP_1._p = null;
|
382
|
-
|
383
|
-
for (var i = 0, length = this.length; i < length; i++) {
|
384
|
-
if (block.call(__context, this[i]) === __breaker) return __breaker.$v;
|
385
|
-
};
|
386
|
-
return this;
|
387
|
-
};
|
388
|
-
|
389
|
-
// line 32, lib/opal/dom/element_set.rb, ElementSet#length
|
390
|
-
ElementSet_prototype.$length = function() {
|
391
|
-
|
392
|
-
return this.length;
|
393
|
-
};
|
394
|
-
|
395
|
-
ElementSet_prototype.$size = ElementSet_prototype.$length;
|
396
|
-
;ElementSet._donate(["$initialize", "$each", "$length", "$size"]);
|
397
|
-
})(self, null)
|
398
|
-
})();
|
399
|
-
// file lib/opal/dom/event.rb
|
400
|
-
(function() {
|
401
|
-
var __opal = Opal, self = __opal.top, __scope = __opal, nil = __opal.nil, __breaker = __opal.breaker, __slice = __opal.slice, __klass = __opal.klass;
|
402
|
-
|
403
|
-
return (function(__base, __super){
|
404
|
-
// line 1, lib/opal/dom/event.rb, class Event
|
405
|
-
function Event() {};
|
406
|
-
Event = __klass(__base, __super, "Event", Event);
|
407
|
-
var Event_prototype = Event.prototype, __scope = Event._scope;
|
408
|
-
Event_prototype.alt = Event_prototype.ctrl = Event_prototype.meta = Event_prototype.shift = nil;
|
409
|
-
|
410
|
-
// line 2, lib/opal/dom/event.rb, Event#initialize
|
411
|
-
Event_prototype.$initialize = function(evt) {
|
412
|
-
|
413
|
-
|
414
|
-
this.evt = evt;
|
415
|
-
|
416
|
-
this.alt = evt.altKey;
|
417
|
-
this.ctrl = evt.ctrlKey;
|
418
|
-
this.meta = evt.metaKey;
|
419
|
-
this.shift = evt.shiftKey;
|
420
|
-
|
421
|
-
};
|
422
|
-
|
423
|
-
// line 13, lib/opal/dom/event.rb, Event#alt?
|
424
|
-
Event_prototype.$alt$p = function() {
|
425
|
-
|
426
|
-
return this.alt;
|
427
|
-
};
|
428
|
-
|
429
|
-
// line 17, lib/opal/dom/event.rb, Event#ctrl?
|
430
|
-
Event_prototype.$ctrl$p = function() {
|
431
|
-
|
432
|
-
return this.ctrl;
|
433
|
-
};
|
434
|
-
|
435
|
-
// line 21, lib/opal/dom/event.rb, Event#meta?
|
436
|
-
Event_prototype.$meta$p = function() {
|
437
|
-
|
438
|
-
return this.meta;
|
439
|
-
};
|
440
|
-
|
441
|
-
// line 35, lib/opal/dom/event.rb, Event#stop
|
442
|
-
Event_prototype.$stop = function() {
|
443
|
-
|
444
|
-
this.$prevent_default();
|
445
|
-
return this.$stop_propagation();
|
446
|
-
};
|
447
|
-
|
448
|
-
// line 40, lib/opal/dom/event.rb, Event#prevent_default
|
449
|
-
Event_prototype.$prevent_default = function() {
|
450
|
-
|
451
|
-
|
452
|
-
var evt = this.evt;
|
453
|
-
|
454
|
-
if (evt.preventDefault) {
|
455
|
-
evt.preventDefault()
|
456
|
-
}
|
457
|
-
else {
|
458
|
-
evt.returnValue = false;
|
459
|
-
}
|
460
|
-
|
461
|
-
return this;
|
462
|
-
|
463
|
-
};
|
464
|
-
|
465
|
-
// line 55, lib/opal/dom/event.rb, Event#shift?
|
466
|
-
Event_prototype.$shift$p = function() {
|
467
|
-
|
468
|
-
return this.shift;
|
469
|
-
};
|
470
|
-
|
471
|
-
// line 59, lib/opal/dom/event.rb, Event#stop_propagation
|
472
|
-
Event_prototype.$stop_propagation = function() {
|
473
|
-
|
474
|
-
|
475
|
-
var evt = this.evt;
|
476
|
-
|
477
|
-
if (evt.stopPropagation) {
|
478
|
-
evt.stopPropagation();
|
479
|
-
}
|
480
|
-
else {
|
481
|
-
evt.cancelBubble = true;
|
482
|
-
}
|
483
|
-
|
484
|
-
return this;
|
485
|
-
|
486
|
-
};
|
487
|
-
;Event._donate(["$initialize", "$alt$p", "$ctrl$p", "$meta$p", "$stop", "$prevent_default", "$shift$p", "$stop_propagation"]);
|
488
|
-
})(self, null)
|
489
|
-
})();
|
490
|
-
// file lib/opal/dom/events.rb
|
491
|
-
(function() {
|
492
|
-
var __opal = Opal, self = __opal.top, __scope = __opal, nil = __opal.nil, __breaker = __opal.breaker, __slice = __opal.slice, __klass = __opal.klass;
|
493
|
-
|
494
|
-
return (function(__base, __super){
|
495
|
-
// line 1, lib/opal/dom/events.rb, class Element
|
496
|
-
function Element() {};
|
497
|
-
Element = __klass(__base, __super, "Element", Element);
|
498
|
-
var Element_prototype = Element.prototype, __scope = Element._scope, __a, __b, TMP_2, TMP_3;
|
499
|
-
|
500
|
-
__scope.EVENTS = ["click", "mousedown", "mouseup"];
|
501
|
-
|
502
|
-
(__b = __scope.EVENTS, __b.$each._p = (__a = function(evt) {
|
503
|
-
|
504
|
-
var TMP_1, __a, __b;
|
505
|
-
if (evt == null) evt = nil;
|
506
|
-
|
507
|
-
return (__b = this, __b.$define_method._p = (__a = TMP_1 = function() {
|
508
|
-
|
509
|
-
var handler, __context, __a;
|
510
|
-
|
511
|
-
handler = TMP_1._p || nil, __context = handler._s, TMP_1.p = null;
|
512
|
-
|
513
|
-
return (__a = this, __a.$add_listener._p = handler.$to_proc(), __a.$add_listener(evt))
|
514
|
-
}, __a._s = this, __a), __b.$define_method(evt))
|
515
|
-
}, __a._s = Element, __a), __b.$each());
|
516
|
-
|
517
|
-
// line 49, lib/opal/dom/events.rb, Element#add_listener
|
518
|
-
Element_prototype.$add_listener = TMP_2 = function(type) {
|
519
|
-
var __context, handler;
|
520
|
-
handler = TMP_2._p || nil, __context = handler._s, TMP_2._p = null;
|
521
|
-
|
522
|
-
|
523
|
-
var el = this.el, responder = function(event) {
|
524
|
-
if (!event) {
|
525
|
-
var event = window.event;
|
526
|
-
}
|
527
|
-
var evt = __scope.Event.$new(event);
|
528
|
-
return handler.call(handler._s, evt);
|
529
|
-
};
|
530
|
-
|
531
|
-
if (el.addEventListener) {
|
532
|
-
el.addEventListener(type, responder, false);
|
533
|
-
}
|
534
|
-
else if (el.attachEvent) {
|
535
|
-
el.attachEvent('on' + type, responder);
|
536
|
-
}
|
537
|
-
|
538
|
-
return handler;
|
539
|
-
|
540
|
-
};
|
541
|
-
|
542
|
-
// line 70, lib/opal/dom/events.rb, Element#remove_listener
|
543
|
-
Element_prototype.$remove_listener = TMP_3 = function(type) {
|
544
|
-
var __context, handler;
|
545
|
-
handler = TMP_3._p || nil, __context = handler._s, TMP_3._p = null;
|
546
|
-
|
547
|
-
return nil;
|
548
|
-
};
|
549
|
-
;Element._donate(["$add_listener", "$remove_listener"]);
|
550
|
-
})(self, null)
|
551
|
-
})();
|
552
|
-
// file lib/opal/dom/http.rb
|
553
|
-
(function() {
|
554
|
-
var __opal = Opal, self = __opal.top, __scope = __opal, nil = __opal.nil, __breaker = __opal.breaker, __slice = __opal.slice, __klass = __opal.klass;
|
555
|
-
|
556
|
-
return (function(__base, __super){
|
557
|
-
// line 1, lib/opal/dom/http.rb, class HTTP
|
558
|
-
function HTTP() {};
|
559
|
-
HTTP = __klass(__base, __super, "HTTP", HTTP);
|
560
|
-
var HTTP_prototype = HTTP.prototype, __scope = HTTP._scope;
|
561
|
-
|
562
|
-
|
563
|
-
var make_xhr = function() {
|
564
|
-
if (typeof XMLHttpRequest !== 'undefined' && (window.location.protocol !== 'file:' || !window.ActiveXObject)) {
|
565
|
-
return new XMLHttpRequest();
|
566
|
-
} else {
|
567
|
-
try {
|
568
|
-
return new ActiveXObject('Msxml2.XMLHTTP.6.0');
|
569
|
-
} catch(e) { }
|
570
|
-
try {
|
571
|
-
return new ActiveXObject('Msxml2.XMLHTTP.3.0');
|
572
|
-
} catch(e) { }
|
573
|
-
try {
|
574
|
-
return new ActiveXObject('Msxml2.XMLHTTP');
|
575
|
-
} catch(e) { }
|
576
|
-
}
|
577
|
-
|
578
|
-
HTTP.$raise("Cannot make request");
|
579
|
-
}
|
580
|
-
|
581
|
-
|
582
|
-
// line 22, lib/opal/dom/http.rb, HTTP#initialize
|
583
|
-
HTTP_prototype.$initialize = function() {
|
584
|
-
|
585
|
-
|
586
|
-
this.xhr = make_xhr();
|
587
|
-
|
588
|
-
};
|
589
|
-
|
590
|
-
// line 28, lib/opal/dom/http.rb, HTTP#ok?
|
591
|
-
HTTP_prototype.$ok$p = function() {
|
592
|
-
|
593
|
-
return this.status >= 200 && this.status < 300;
|
594
|
-
};
|
595
|
-
;HTTP._donate(["$initialize", "$ok$p"]);
|
596
|
-
})(self, null)
|
597
|
-
})();
|
598
|
-
// file lib/opal/dom/kernel.rb
|
599
|
-
(function() {
|
600
|
-
var __opal = Opal, self = __opal.top, __scope = __opal, nil = __opal.nil, __breaker = __opal.breaker, __slice = __opal.slice, __module = __opal.module;
|
601
|
-
|
602
|
-
return (function(__base){
|
603
|
-
// line 1, lib/opal/dom/kernel.rb, module Kernel
|
604
|
-
function Kernel() {};
|
605
|
-
Kernel = __module(__base, "Kernel", Kernel);
|
606
|
-
var Kernel_prototype = Kernel.prototype, __scope = Kernel._scope;
|
607
|
-
|
608
|
-
// line 13, lib/opal/dom/kernel.rb, Kernel#Element
|
609
|
-
Kernel_prototype.$Element = function(selector) {
|
610
|
-
|
611
|
-
|
612
|
-
var el
|
613
|
-
|
614
|
-
if (selector.charAt(0) === '#') {
|
615
|
-
el = document.getElementById(selector.substr(1));
|
616
|
-
|
617
|
-
if (el) {
|
618
|
-
return __scope.Element.$new(el);
|
619
|
-
}
|
620
|
-
else {
|
621
|
-
return nil;
|
622
|
-
}
|
623
|
-
}
|
624
|
-
else {
|
625
|
-
return __scope.DOM.$parse(selector)
|
626
|
-
}
|
627
|
-
|
628
|
-
return nil;
|
629
|
-
|
630
|
-
};
|
631
|
-
|
632
|
-
// line 43, lib/opal/dom/kernel.rb, Kernel#alert
|
633
|
-
Kernel_prototype.$alert = function(msg) {
|
634
|
-
|
635
|
-
alert(msg);
|
636
|
-
return this;
|
637
|
-
};
|
638
|
-
;Kernel._donate(["$Element", "$alert"]);
|
639
|
-
})(self)
|
640
|
-
})();
|
641
|
-
// file lib/opal/dom/version.rb
|
642
|
-
(function() {
|
643
|
-
var __opal = Opal, self = __opal.top, __scope = __opal, nil = __opal.nil, __breaker = __opal.breaker, __slice = __opal.slice, __klass = __opal.klass;
|
644
|
-
|
645
|
-
return (function(__base, __super){
|
646
|
-
// line 1, lib/opal/dom/version.rb, class DOM
|
647
|
-
function DOM() {};
|
648
|
-
DOM = __klass(__base, __super, "DOM", DOM);
|
649
|
-
var DOM_prototype = DOM.prototype, __scope = DOM._scope;
|
650
|
-
|
651
|
-
__scope.VERSION = "0.0.1"
|
652
|
-
|
653
|
-
})(self, null)
|
654
|
-
})();
|