opal-rails 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- 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/.gitignore
CHANGED
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
@@ -4,6 +4,10 @@ source :rubygems
|
|
4
4
|
gemspec
|
5
5
|
|
6
6
|
|
7
|
+
gem 'opal-jquery', :git => 'git://github.com/adambeynon/opal-jquery.git', :require => false
|
8
|
+
gem 'opal-spec', :git => 'git://github.com/adambeynon/opal-spec.git', :require => false
|
9
|
+
|
10
|
+
|
7
11
|
# Test app stuff
|
8
12
|
|
9
13
|
gem 'rails', '3.2.6'
|
@@ -23,4 +27,5 @@ gem 'jquery-rails'
|
|
23
27
|
|
24
28
|
group :test do
|
25
29
|
gem 'capybara'
|
30
|
+
gem 'launchy'
|
26
31
|
end
|
data/README.md
CHANGED
@@ -1,9 +1,6 @@
|
|
1
|
-
# Opal
|
2
|
-
|
3
|
-
[![Build Status](https://secure.travis-ci.org/elia/opal-rails.png)](http://travis-ci.org/elia/opal-rails)
|
4
|
-
|
5
|
-
For Rails 3.2 only.
|
1
|
+
# Opal Rails
|
6
2
|
|
3
|
+
_Rails (3.2+) bindings for [Opal JS](http://opalrb.org) engine._
|
7
4
|
|
8
5
|
|
9
6
|
## Installation
|
@@ -22,17 +19,18 @@ gem 'opal-rails'
|
|
22
19
|
``` js
|
23
20
|
// app/assets/application.js
|
24
21
|
|
25
|
-
// The
|
26
|
-
// require opal
|
27
|
-
|
28
|
-
//
|
29
|
-
// require
|
22
|
+
// The Opal runtime
|
23
|
+
// = require opal
|
24
|
+
//
|
25
|
+
// Dom manipulation
|
26
|
+
// = require jquery
|
27
|
+
// = require opal-jquery
|
30
28
|
```
|
31
29
|
|
32
|
-
and then just use the `.opal` extensions:
|
30
|
+
and then just use the `.rb` or `.opal` extensions:
|
33
31
|
|
34
32
|
```ruby
|
35
|
-
# app/assets/javascripts/hi-world.js.
|
33
|
+
# app/assets/javascripts/hi-world.js.rb
|
36
34
|
|
37
35
|
puts "G'day world!"
|
38
36
|
```
|
@@ -75,8 +73,34 @@ Of course you need to require `haml-rails` separately since its presence is not
|
|
75
73
|
```
|
76
74
|
|
77
75
|
|
76
|
+
### Spec!
|
77
|
+
|
78
|
+
Add a `spec.js` into `assets/javascripts` to require your specs
|
79
|
+
|
80
|
+
```js
|
81
|
+
// = require_tree ./spec
|
82
|
+
```
|
83
|
+
|
84
|
+
and then a spec folder with you specs!
|
85
|
+
|
86
|
+
```ruby
|
87
|
+
# assets/javascripts/spec/example_spec.js.rb
|
88
|
+
|
89
|
+
describe 'a spec' do
|
90
|
+
it 'has successful examples' do
|
91
|
+
'I run'.should =~ /run/
|
92
|
+
end
|
93
|
+
end
|
94
|
+
```
|
95
|
+
|
96
|
+
Then visit `/opal_spec` from your app and **reload at will**.
|
97
|
+
|
98
|
+
![1 examples, 0 failures](http://f.cl.ly/items/001n0V0g0u0v14160W2G/Schermata%2007-2456110%20alle%201.06.29%20am.png)
|
99
|
+
|
100
|
+
|
101
|
+
|
78
102
|
|
79
|
-
##
|
103
|
+
## License
|
80
104
|
|
81
105
|
Copyright © 2012 by Elia Schito
|
82
106
|
|
data/Rakefile
CHANGED
@@ -15,6 +15,20 @@ Bundler::GemHelper.install_tasks
|
|
15
15
|
|
16
16
|
|
17
17
|
|
18
|
+
# OPAL
|
19
|
+
|
20
|
+
# Rakefile
|
21
|
+
require 'opal/rake_task'
|
22
|
+
|
23
|
+
Opal::RakeTask.new do |t|
|
24
|
+
t.build_dir = 'lib/assets/javascripts'
|
25
|
+
t.dependencies = %w[opal-jquery opal-spec]
|
26
|
+
t.files = []
|
27
|
+
end
|
28
|
+
|
29
|
+
|
30
|
+
|
31
|
+
|
18
32
|
# DOCS
|
19
33
|
|
20
34
|
begin
|
@@ -1,8 +1,13 @@
|
|
1
1
|
class OpalSpecController < ActionController::Base
|
2
2
|
def run
|
3
|
-
files = (params[:files] || 'spec').split(':')
|
4
|
-
render :nothing => true, :layout => 'opal_spec', :locals => {
|
5
|
-
:spec_files => files
|
6
|
-
}
|
7
3
|
end
|
4
|
+
|
5
|
+
|
6
|
+
private
|
7
|
+
|
8
|
+
def spec_files
|
9
|
+
@spec_files ||= (params[:files] || 'spec').split(':')
|
10
|
+
end
|
11
|
+
|
12
|
+
helper_method :spec_files
|
8
13
|
end
|
@@ -7,11 +7,10 @@
|
|
7
7
|
<%= javascript_include_tag 'opal-spec' %>
|
8
8
|
<%= javascript_include_tag *spec_files %>
|
9
9
|
<style>
|
10
|
-
|
10
|
+
body { font-family: sans-serif; }
|
11
11
|
</style>
|
12
12
|
</head>
|
13
13
|
<body>
|
14
|
-
|
15
|
-
<%= javascript_include_tag 'opal-spec-runner' %>
|
14
|
+
<%= yield %>
|
16
15
|
</body>
|
17
16
|
</html>
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<h2>All specs:</h2>
|
2
|
+
|
3
|
+
<ul>
|
4
|
+
<% Dir[Rails.root.join('app/assets/javascripts/spec/**_spec.js.rb')].each do |spec_file| %>
|
5
|
+
<li>
|
6
|
+
<% path = Pathname.new(spec_file).relative_path_from( Rails.root.join('app/assets/javascripts/') ) %>
|
7
|
+
<%= link_to path, "/opal_spec?files=#{URI.escape(path.to_s)}" %>
|
8
|
+
</li>
|
9
|
+
<% end %>
|
10
|
+
</ul>
|
11
|
+
|
data/config/routes.rb
CHANGED
@@ -0,0 +1,499 @@
|
|
1
|
+
// lib/opal-jquery/document.rb
|
2
|
+
(function() {
|
3
|
+
var __opal = Opal, self = __opal.top, __scope = __opal, nil = __opal.nil, __breaker = __opal.breaker, __slice = __opal.slice, __mm = __opal.mm, __module = __opal.module;
|
4
|
+
|
5
|
+
return (function(__base){
|
6
|
+
// line 1, opal-jquery/document, module Document
|
7
|
+
function Document() {};
|
8
|
+
Document = __module(__base, "Document", Document);
|
9
|
+
var Document_prototype = Document.prototype, __scope = Document._scope, TMP_1;
|
10
|
+
|
11
|
+
// line 2, opal-jquery/document, Document.[]
|
12
|
+
Document['$[]'] = function(selector) {
|
13
|
+
|
14
|
+
return $(selector);
|
15
|
+
};
|
16
|
+
|
17
|
+
// line 6, opal-jquery/document, Document.find
|
18
|
+
Document.$find = function(selector) {
|
19
|
+
|
20
|
+
return this['$[]'](selector)
|
21
|
+
};
|
22
|
+
|
23
|
+
// line 10, opal-jquery/document, Document.id
|
24
|
+
Document.$id = function(id) {
|
25
|
+
|
26
|
+
|
27
|
+
var el = document.getElementById(id);
|
28
|
+
|
29
|
+
if (!el) {
|
30
|
+
return nil;
|
31
|
+
}
|
32
|
+
|
33
|
+
return $(el);
|
34
|
+
|
35
|
+
};
|
36
|
+
|
37
|
+
// line 22, opal-jquery/document, Document.parse
|
38
|
+
Document.$parse = function(str) {
|
39
|
+
|
40
|
+
return $(str);
|
41
|
+
};
|
42
|
+
|
43
|
+
// line 26, opal-jquery/document, Document.ready?
|
44
|
+
Document['$ready?'] = TMP_1 = function() {
|
45
|
+
var __context, block;
|
46
|
+
block = TMP_1._p || nil, __context = block._s, TMP_1._p = null;
|
47
|
+
|
48
|
+
|
49
|
+
if (block === nil) {
|
50
|
+
return nil;
|
51
|
+
}
|
52
|
+
|
53
|
+
$(function() {
|
54
|
+
block.$call();
|
55
|
+
});
|
56
|
+
|
57
|
+
return nil;
|
58
|
+
|
59
|
+
};
|
60
|
+
;Document._sdonate(["$[]", "$find", "$id", "$parse", "$ready?"]);
|
61
|
+
})(self)
|
62
|
+
})();
|
63
|
+
// lib/opal-jquery/http.rb
|
64
|
+
(function() {
|
65
|
+
var __opal = Opal, self = __opal.top, __scope = __opal, nil = __opal.nil, __breaker = __opal.breaker, __slice = __opal.slice, __mm = __opal.mm, __klass = __opal.klass, __hash = __opal.hash;
|
66
|
+
|
67
|
+
return (function(__base, __super){
|
68
|
+
// line 7, opal-jquery/http, class HTTP
|
69
|
+
function HTTP() {};
|
70
|
+
HTTP = __klass(__base, __super, "HTTP", HTTP);
|
71
|
+
var HTTP_prototype = HTTP.prototype, __scope = HTTP._scope, TMP_1, TMP_2, TMP_3, TMP_4;
|
72
|
+
HTTP_prototype.body = HTTP_prototype.error_message = HTTP_prototype.method = HTTP_prototype.status_code = HTTP_prototype.url = HTTP_prototype.errback = HTTP_prototype.json = HTTP_prototype.ok = HTTP_prototype.settings = HTTP_prototype.callback = nil;
|
73
|
+
|
74
|
+
// line 8, opal-jquery/http, HTTP#body
|
75
|
+
HTTP_prototype.$body = function() {
|
76
|
+
|
77
|
+
return this.body
|
78
|
+
};
|
79
|
+
|
80
|
+
// line 9, opal-jquery/http, HTTP#error_message
|
81
|
+
HTTP_prototype.$error_message = function() {
|
82
|
+
|
83
|
+
return this.error_message
|
84
|
+
};
|
85
|
+
|
86
|
+
// line 10, opal-jquery/http, HTTP#method
|
87
|
+
HTTP_prototype.$method = function() {
|
88
|
+
|
89
|
+
return this.method
|
90
|
+
};
|
91
|
+
|
92
|
+
// line 11, opal-jquery/http, HTTP#status_code
|
93
|
+
HTTP_prototype.$status_code = function() {
|
94
|
+
|
95
|
+
return this.status_code
|
96
|
+
};
|
97
|
+
|
98
|
+
// line 12, opal-jquery/http, HTTP#url
|
99
|
+
HTTP_prototype.$url = function() {
|
100
|
+
|
101
|
+
return this.url
|
102
|
+
};
|
103
|
+
|
104
|
+
// line 14, opal-jquery/http, HTTP.get
|
105
|
+
HTTP.$get = TMP_1 = function(url, opts) {
|
106
|
+
var __context, block;
|
107
|
+
block = TMP_1._p || nil, __context = block._s, TMP_1._p = null;
|
108
|
+
if (opts == null) {
|
109
|
+
opts = __hash()
|
110
|
+
}
|
111
|
+
return this['$new'](url, "GET", opts, block)['$send!']()
|
112
|
+
};
|
113
|
+
|
114
|
+
// line 18, opal-jquery/http, HTTP.post
|
115
|
+
HTTP.$post = TMP_2 = function(url, opts) {
|
116
|
+
var __context, block;
|
117
|
+
block = TMP_2._p || nil, __context = block._s, TMP_2._p = null;
|
118
|
+
if (opts == null) {
|
119
|
+
opts = __hash()
|
120
|
+
}
|
121
|
+
return this['$new'](url, "POST", opts, block)['$send!']()
|
122
|
+
};
|
123
|
+
|
124
|
+
// line 22, opal-jquery/http, HTTP#initialize
|
125
|
+
HTTP_prototype.$initialize = function(url, method, options, handler) {
|
126
|
+
var http = nil, settings = nil;if (handler == null) {
|
127
|
+
handler = nil
|
128
|
+
}
|
129
|
+
this.url = url;
|
130
|
+
this.method = method;
|
131
|
+
this.ok = true;
|
132
|
+
http = this;
|
133
|
+
settings = options.$to_native();
|
134
|
+
if (handler !== false && handler !== nil) {
|
135
|
+
this.callback = this.errback = handler
|
136
|
+
};
|
137
|
+
|
138
|
+
settings.data = settings.payload;
|
139
|
+
settings.url = url;
|
140
|
+
settings.type = method;
|
141
|
+
|
142
|
+
settings.success = function(str) {
|
143
|
+
http.body = str;
|
144
|
+
|
145
|
+
if (typeof(str) === 'object') {
|
146
|
+
http.json = __scope.JSON.$from_object(str);
|
147
|
+
}
|
148
|
+
|
149
|
+
return http.$succeed();
|
150
|
+
};
|
151
|
+
|
152
|
+
settings.error = function(xhr, str) {
|
153
|
+
return http.$fail();
|
154
|
+
};
|
155
|
+
|
156
|
+
return this.settings = settings;
|
157
|
+
};
|
158
|
+
|
159
|
+
// line 56, opal-jquery/http, HTTP#callback
|
160
|
+
HTTP_prototype.$callback = TMP_3 = function() {
|
161
|
+
var __context, block;
|
162
|
+
block = TMP_3._p || nil, __context = block._s, TMP_3._p = null;
|
163
|
+
|
164
|
+
this.callback = block;
|
165
|
+
return this;
|
166
|
+
};
|
167
|
+
|
168
|
+
// line 61, opal-jquery/http, HTTP#errback
|
169
|
+
HTTP_prototype.$errback = TMP_4 = function() {
|
170
|
+
var __context, block;
|
171
|
+
block = TMP_4._p || nil, __context = block._s, TMP_4._p = null;
|
172
|
+
|
173
|
+
this.errback = block;
|
174
|
+
return this;
|
175
|
+
};
|
176
|
+
|
177
|
+
// line 66, opal-jquery/http, HTTP#fail
|
178
|
+
HTTP_prototype.$fail = function() {
|
179
|
+
var __a;
|
180
|
+
this.ok = false;
|
181
|
+
if ((__a = this.errback) !== false && __a !== nil) {
|
182
|
+
return this.errback.$call(this)
|
183
|
+
} else {
|
184
|
+
return nil
|
185
|
+
};
|
186
|
+
};
|
187
|
+
|
188
|
+
// line 83, opal-jquery/http, HTTP#json
|
189
|
+
HTTP_prototype.$json = function() {
|
190
|
+
var __a;
|
191
|
+
return ((__a = this.json), __a !== false && __a !== nil ? __a : __scope.JSON.$parse(this.body));
|
192
|
+
};
|
193
|
+
|
194
|
+
// line 98, opal-jquery/http, HTTP#ok?
|
195
|
+
HTTP_prototype['$ok?'] = function() {
|
196
|
+
|
197
|
+
return this.ok;
|
198
|
+
};
|
199
|
+
|
200
|
+
// line 105, opal-jquery/http, HTTP#send!
|
201
|
+
HTTP_prototype['$send!'] = function() {
|
202
|
+
|
203
|
+
$.ajax(this.settings);
|
204
|
+
return this;
|
205
|
+
};
|
206
|
+
|
207
|
+
// line 110, opal-jquery/http, HTTP#succeed
|
208
|
+
HTTP_prototype.$succeed = function() {
|
209
|
+
var __a;
|
210
|
+
if ((__a = this.callback) !== false && __a !== nil) {
|
211
|
+
return this.callback.$call(this)
|
212
|
+
} else {
|
213
|
+
return nil
|
214
|
+
};
|
215
|
+
};
|
216
|
+
;HTTP._donate(["$body", "$error_message", "$method", "$status_code", "$url", "$initialize", "$callback", "$errback", "$fail", "$json", "$ok?", "$send!", "$succeed"]); ;HTTP._sdonate(["$get", "$post"]);
|
217
|
+
})(self, null)
|
218
|
+
})();
|
219
|
+
// lib/opal-jquery/jquery.rb
|
220
|
+
(function() {
|
221
|
+
var __opal = Opal, self = __opal.top, __scope = __opal, nil = __opal.nil, __breaker = __opal.breaker, __slice = __opal.slice, __mm = __opal.mm, __klass = __opal.klass;
|
222
|
+
|
223
|
+
|
224
|
+
var fn;
|
225
|
+
|
226
|
+
if (typeof(jQuery) !== 'undefined') {
|
227
|
+
fn = jQuery;
|
228
|
+
}
|
229
|
+
else if (typeof(Zepto) !== 'undefined') {
|
230
|
+
fn = Zepto.fn.constructor;
|
231
|
+
}
|
232
|
+
else {
|
233
|
+
self.$raise("no DOM library found");
|
234
|
+
}
|
235
|
+
|
236
|
+
return (function(__base, __super){
|
237
|
+
// line 15, opal-jquery/jquery, class JQuery
|
238
|
+
function JQuery() {};
|
239
|
+
JQuery = __klass(__base, __super, "JQuery", JQuery);
|
240
|
+
var JQuery_prototype = JQuery.prototype, __scope = JQuery._scope, TMP_1, TMP_2;
|
241
|
+
|
242
|
+
// line 16, opal-jquery/jquery, JQuery.find
|
243
|
+
JQuery.$find = function(selector) {
|
244
|
+
|
245
|
+
return $(selector);
|
246
|
+
};
|
247
|
+
|
248
|
+
// line 20, opal-jquery/jquery, JQuery.id
|
249
|
+
JQuery.$id = function(id) {
|
250
|
+
|
251
|
+
return __scope.Document.$id(id)
|
252
|
+
};
|
253
|
+
|
254
|
+
// line 24, opal-jquery/jquery, JQuery.new
|
255
|
+
JQuery['$new'] = function(tag) {
|
256
|
+
if (tag == null) {
|
257
|
+
tag = "div"
|
258
|
+
}
|
259
|
+
return $(document.createElement(tag));
|
260
|
+
};
|
261
|
+
|
262
|
+
// line 28, opal-jquery/jquery, JQuery.parse
|
263
|
+
JQuery.$parse = function(str) {
|
264
|
+
|
265
|
+
return $(str);
|
266
|
+
};
|
267
|
+
|
268
|
+
// line 32, opal-jquery/jquery, JQuery#[]
|
269
|
+
JQuery_prototype['$[]'] = function(name) {
|
270
|
+
|
271
|
+
return this.attr(name) || "";
|
272
|
+
};
|
273
|
+
|
274
|
+
JQuery_prototype['$[]='] = JQuery_prototype.attr;
|
275
|
+
|
276
|
+
JQuery_prototype['$<<'] = JQuery_prototype.append;
|
277
|
+
|
278
|
+
JQuery_prototype.$add_class = JQuery_prototype.addClass;
|
279
|
+
|
280
|
+
JQuery_prototype.$after = JQuery_prototype.after;
|
281
|
+
|
282
|
+
JQuery_prototype.$append = JQuery_prototype['$<<'];
|
283
|
+
|
284
|
+
JQuery_prototype.$append_to = JQuery_prototype.appendTo;
|
285
|
+
|
286
|
+
// line 85, opal-jquery/jquery, JQuery#append_to_body
|
287
|
+
JQuery_prototype.$append_to_body = function() {
|
288
|
+
|
289
|
+
return this.appendTo(document.body);
|
290
|
+
};
|
291
|
+
|
292
|
+
// line 89, opal-jquery/jquery, JQuery#append_to_head
|
293
|
+
JQuery_prototype.$append_to_head = function() {
|
294
|
+
|
295
|
+
return this.appendTo(document.head);
|
296
|
+
};
|
297
|
+
|
298
|
+
// line 105, opal-jquery/jquery, JQuery#at
|
299
|
+
JQuery_prototype.$at = function(index) {
|
300
|
+
|
301
|
+
|
302
|
+
var length = this.length;
|
303
|
+
|
304
|
+
if (index < 0) {
|
305
|
+
index += length;
|
306
|
+
}
|
307
|
+
|
308
|
+
if (index < 0 || index >= length) {
|
309
|
+
return nil;
|
310
|
+
}
|
311
|
+
|
312
|
+
return $(this[index]);
|
313
|
+
|
314
|
+
};
|
315
|
+
|
316
|
+
JQuery_prototype.$before = JQuery_prototype.before;
|
317
|
+
|
318
|
+
JQuery_prototype.$children = JQuery_prototype.children;
|
319
|
+
|
320
|
+
// line 158, opal-jquery/jquery, JQuery#class_name
|
321
|
+
JQuery_prototype.$class_name = function() {
|
322
|
+
|
323
|
+
|
324
|
+
var first = this[0];
|
325
|
+
|
326
|
+
if (!first) {
|
327
|
+
return "";
|
328
|
+
}
|
329
|
+
|
330
|
+
return first.className || "";
|
331
|
+
|
332
|
+
};
|
333
|
+
|
334
|
+
// line 180, opal-jquery/jquery, JQuery#class_name=
|
335
|
+
JQuery_prototype['$class_name='] = function(name) {
|
336
|
+
|
337
|
+
|
338
|
+
for (var i = 0, length = this.length; i < length; i++) {
|
339
|
+
this[i].className = name;
|
340
|
+
}
|
341
|
+
|
342
|
+
return this;
|
343
|
+
};
|
344
|
+
|
345
|
+
JQuery_prototype.$css = JQuery_prototype.css;
|
346
|
+
|
347
|
+
// line 215, opal-jquery/jquery, JQuery#each
|
348
|
+
JQuery_prototype.$each = TMP_1 = function() {
|
349
|
+
var __context, __yield;
|
350
|
+
__yield = TMP_1._p || nil, __context = __yield._s, TMP_1._p = null;
|
351
|
+
|
352
|
+
for (var i = 0, length = this.length; i < length; i++) {
|
353
|
+
if (__yield.call(__context, $(this[i])) === __breaker) return __breaker.$v;
|
354
|
+
};
|
355
|
+
return this;
|
356
|
+
};
|
357
|
+
|
358
|
+
JQuery_prototype.$find = JQuery_prototype.find;
|
359
|
+
|
360
|
+
// line 235, opal-jquery/jquery, JQuery#first
|
361
|
+
JQuery_prototype.$first = function() {
|
362
|
+
|
363
|
+
return this.length ? this.first() : nil;
|
364
|
+
};
|
365
|
+
|
366
|
+
JQuery_prototype['$has_class?'] = JQuery_prototype.hasClass;
|
367
|
+
|
368
|
+
// line 241, opal-jquery/jquery, JQuery#html
|
369
|
+
JQuery_prototype.$html = function() {
|
370
|
+
|
371
|
+
return this.html() || "";
|
372
|
+
};
|
373
|
+
|
374
|
+
JQuery_prototype['$html='] = JQuery_prototype.html;
|
375
|
+
|
376
|
+
// line 247, opal-jquery/jquery, JQuery#id
|
377
|
+
JQuery_prototype.$id = function() {
|
378
|
+
|
379
|
+
|
380
|
+
var first = this[0];
|
381
|
+
|
382
|
+
if (!first) {
|
383
|
+
return "";
|
384
|
+
}
|
385
|
+
|
386
|
+
return first.id || "";
|
387
|
+
|
388
|
+
};
|
389
|
+
|
390
|
+
// line 259, opal-jquery/jquery, JQuery#id=
|
391
|
+
JQuery_prototype['$id='] = function(id) {
|
392
|
+
|
393
|
+
|
394
|
+
var first = this[0];
|
395
|
+
|
396
|
+
if (first) {
|
397
|
+
first.id = id;
|
398
|
+
}
|
399
|
+
|
400
|
+
return this;
|
401
|
+
|
402
|
+
};
|
403
|
+
|
404
|
+
// line 271, opal-jquery/jquery, JQuery#inspect
|
405
|
+
JQuery_prototype.$inspect = function() {
|
406
|
+
|
407
|
+
|
408
|
+
var val, el, str, result = [];
|
409
|
+
|
410
|
+
for (var i = 0, length = this.length; i < length; i++) {
|
411
|
+
el = this[i];
|
412
|
+
str = "<" + el.tagName.toLowerCase();
|
413
|
+
|
414
|
+
if (val = el.id) str += (' id="' + val + '"');
|
415
|
+
if (val = el.className) str += (' class="' + val + '"');
|
416
|
+
|
417
|
+
result.push(str + '>');
|
418
|
+
}
|
419
|
+
|
420
|
+
return '[' + result.join(', ') + ']';
|
421
|
+
|
422
|
+
};
|
423
|
+
|
424
|
+
// line 289, opal-jquery/jquery, JQuery#length
|
425
|
+
JQuery_prototype.$length = function() {
|
426
|
+
|
427
|
+
return this.length;
|
428
|
+
};
|
429
|
+
|
430
|
+
JQuery_prototype.$next = JQuery_prototype.next;
|
431
|
+
|
432
|
+
// line 295, opal-jquery/jquery, JQuery#on
|
433
|
+
JQuery_prototype.$on = TMP_2 = function(name) {
|
434
|
+
var __context, block;
|
435
|
+
block = TMP_2._p || nil, __context = block._s, TMP_2._p = null;
|
436
|
+
|
437
|
+
if (block === nil) {
|
438
|
+
return nil
|
439
|
+
};
|
440
|
+
|
441
|
+
this.on(name, function() {
|
442
|
+
return block.$call();
|
443
|
+
});
|
444
|
+
|
445
|
+
return block;
|
446
|
+
};
|
447
|
+
|
448
|
+
JQuery_prototype.$parent = JQuery_prototype.parent;
|
449
|
+
|
450
|
+
JQuery_prototype.$prev = JQuery_prototype.prev;
|
451
|
+
|
452
|
+
JQuery_prototype.$remove = JQuery_prototype.remove;
|
453
|
+
|
454
|
+
JQuery_prototype.$remove_class = JQuery_prototype.removeClass;
|
455
|
+
|
456
|
+
JQuery_prototype.$size = JQuery_prototype.$length;
|
457
|
+
|
458
|
+
JQuery_prototype.$succ = JQuery_prototype.$next;
|
459
|
+
|
460
|
+
JQuery_prototype['$text='] = JQuery_prototype.text;
|
461
|
+
|
462
|
+
// line 320, opal-jquery/jquery, JQuery#value
|
463
|
+
JQuery_prototype.$value = function() {
|
464
|
+
|
465
|
+
return this.val() || "";
|
466
|
+
};
|
467
|
+
|
468
|
+
JQuery_prototype['$value='] = JQuery_prototype.val;
|
469
|
+
;JQuery._donate(["$[]", "['$[]=']", "['$<<']", ".$add_class", ".$after", "$append", ".$append_to", "$append_to_body", "$append_to_head", "$at", ".$before", ".$children", "$class_name", "$class_name=", ".$css", "$each", ".$find", "$first", "['$has_class?']", "$html", "['$html=']", "$id", "$id=", "$inspect", "$length", ".$next", "$on", ".$parent", ".$prev", ".$remove", ".$remove_class", "$size", "$succ", "['$text=']", "$value", "['$value=']"]); ;JQuery._sdonate(["$find", "$id", "$new", "$parse"]);
|
470
|
+
})(self, fn);
|
471
|
+
})();
|
472
|
+
// lib/opal-jquery/kernel.rb
|
473
|
+
(function() {
|
474
|
+
var __opal = Opal, self = __opal.top, __scope = __opal, nil = __opal.nil, __breaker = __opal.breaker, __slice = __opal.slice, __mm = __opal.mm, __module = __opal.module;
|
475
|
+
|
476
|
+
return (function(__base){
|
477
|
+
// line 1, opal-jquery/kernel, module Kernel
|
478
|
+
function Kernel() {};
|
479
|
+
Kernel = __module(__base, "Kernel", Kernel);
|
480
|
+
var Kernel_prototype = Kernel.prototype, __scope = Kernel._scope;
|
481
|
+
|
482
|
+
// line 2, opal-jquery/kernel, Kernel#alert
|
483
|
+
Kernel_prototype.$alert = function(msg) {
|
484
|
+
|
485
|
+
alert(msg);
|
486
|
+
return nil;
|
487
|
+
}
|
488
|
+
;Kernel._donate(["$alert"]);
|
489
|
+
})(self)
|
490
|
+
})();
|
491
|
+
// lib/opal-jquery.rb
|
492
|
+
(function() {
|
493
|
+
var __opal = Opal, self = __opal.top, __scope = __opal, nil = __opal.nil, __breaker = __opal.breaker, __slice = __opal.slice, __mm = __opal.mm;
|
494
|
+
|
495
|
+
//= require opal-jquery/document;
|
496
|
+
//= require opal-jquery/jquery;
|
497
|
+
//= require opal-jquery/kernel;
|
498
|
+
return //= require opal-jquery/http;
|
499
|
+
})();
|