smokejs_rails 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +14 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +63 -0
- data/Rakefile +2 -0
- data/lib/smokejs_rails.rb +11 -0
- data/lib/smokejs_rails/version.rb +3 -0
- data/smokejs_rails.gemspec +23 -0
- data/vendor/assets/javascripts/smoke.js +518 -0
- data/vendor/assets/stylesheets/smoke.css +114 -0
- metadata +85 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 7df99564d7a61d24ae5f10b840a970f80ef7244c
|
4
|
+
data.tar.gz: 768c8e852cbe5cdd4c19db2b774be4ff3335d831
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 8f0e2211b783e014ffe4d48cd530ab0d5d9332cbfd9a6b6ae1d0f75f3add1a3a56d8bcf43630f022b0b7b321dbf7bcd4ff8010cb4bc9dde286f4b0d5eb06c9c4
|
7
|
+
data.tar.gz: 97caab15e64f3b9d1effae1fcd5f2d4c1f882b1f2cea8e16713abd49974d2ade61ea904350a09291105da0c669a5f1ab432af256a3299da6b101474e9aa2a976
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2015 Guinsly Mondesir
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
# SmokejsRails
|
2
|
+
|
3
|
+
This is a rails implementation of [Smoke-js](http://smoke-js.com/).
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'smokejs_rails'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install smokejs_rails
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
add in `app/assets/javascripts/application.js` after jquery (below jquery)
|
23
|
+
|
24
|
+
//= require smoke
|
25
|
+
|
26
|
+
add in `app/assets/stylesheets/application.css`
|
27
|
+
|
28
|
+
*= require smoke
|
29
|
+
|
30
|
+
```javascript
|
31
|
+
<script type="text/javascript">
|
32
|
+
$(function(){
|
33
|
+
|
34
|
+
smoke.confirm('this is still cool, yeah?',function(e){
|
35
|
+
if (e){
|
36
|
+
smoke.alert('OK pressed');
|
37
|
+
}else{
|
38
|
+
smoke.alert('CANCEL pressed');
|
39
|
+
}
|
40
|
+
});
|
41
|
+
|
42
|
+
});
|
43
|
+
</script>
|
44
|
+
```
|
45
|
+
###Doc
|
46
|
+
[smoke-js](http://smoke-js.com/) and
|
47
|
+
[jque.re](http://www.jque.re/plugins/modals-lightboxes/smoke.js/)
|
48
|
+
|
49
|
+
```javascript
|
50
|
+
smoke.alert('this is a normal alert');
|
51
|
+
smoke.signal('this goes away after a sec');
|
52
|
+
smoke.confirm('behaves like a normal confirm?');
|
53
|
+
smoke.prompt('behaves like a normal prompt?');
|
54
|
+
```
|
55
|
+
|
56
|
+
|
57
|
+
## Contributing
|
58
|
+
|
59
|
+
1. Fork it ( https://github.com/guinslym/smokejs_rails/fork )
|
60
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
61
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
62
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
63
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
require "smokejs_rails/version"
|
2
|
+
|
3
|
+
module SmokejsRails
|
4
|
+
module Rails
|
5
|
+
if defined?(::Rails) and Gem::Requirement.new('>= 3.1').satisfied_by?(Gem::Version.new ::Rails.version)
|
6
|
+
class Rails::Engine < ::Rails::Engine
|
7
|
+
# this class enables the asset pipeline
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'smokejs_rails/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "smokejs_rails"
|
8
|
+
spec.version = SmokejsRails::VERSION
|
9
|
+
spec.authors = ["Guinsly Mondesir"]
|
10
|
+
spec.email = ["agmond@gmx.com.br"]
|
11
|
+
spec.summary = %q{A Rails implementation of smokejs (http://smoke-js.com/) A stylish javascript alert, framework-agnostic styled alert}
|
12
|
+
spec.description = %q{A Rails implementation of smokejs (http://smoke-js.com/) A stylish javascript alert, framework-agnostic styled alert}
|
13
|
+
spec.homepage = "https://github.com/guinslym/smokejs_rails"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.7"
|
22
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
23
|
+
end
|
@@ -0,0 +1,518 @@
|
|
1
|
+
/*
|
2
|
+
SMOKE.JS - 0.1.3
|
3
|
+
(c) 2011-2013 Jonathan Youngblood
|
4
|
+
demos / documentation: http://smoke-js.com/
|
5
|
+
*/
|
6
|
+
|
7
|
+
;(function(window, document) {
|
8
|
+
|
9
|
+
/*jslint browser: true, onevar: true, undef: true, nomen: false, eqeqeq: true, bitwise: true, regexp: true, newcap: true, immed: true */
|
10
|
+
|
11
|
+
var smoke = {
|
12
|
+
smoketimeout: [],
|
13
|
+
init: false,
|
14
|
+
zindex: 1000,
|
15
|
+
i: 0,
|
16
|
+
|
17
|
+
bodyload: function(id) {
|
18
|
+
var ff = document.createElement('div');
|
19
|
+
ff.setAttribute('id','smoke-out-'+id);
|
20
|
+
ff.className = 'smoke-base';
|
21
|
+
ff.style.zIndex = smoke.zindex;
|
22
|
+
smoke.zindex++;
|
23
|
+
document.body.appendChild(ff);
|
24
|
+
},
|
25
|
+
|
26
|
+
newdialog: function() {
|
27
|
+
var newid = new Date().getTime();
|
28
|
+
newid = Math.random(1,99) + newid;
|
29
|
+
|
30
|
+
if (!smoke.init) {
|
31
|
+
smoke.listen(window,"load", function() {
|
32
|
+
smoke.bodyload(newid);
|
33
|
+
});
|
34
|
+
}else{
|
35
|
+
smoke.bodyload(newid);
|
36
|
+
}
|
37
|
+
|
38
|
+
return newid;
|
39
|
+
},
|
40
|
+
|
41
|
+
forceload: function() {},
|
42
|
+
|
43
|
+
build: function (e, f) {
|
44
|
+
smoke.i++;
|
45
|
+
|
46
|
+
f.stack = smoke.i;
|
47
|
+
|
48
|
+
e = e.replace(/\n/g,'<br />');
|
49
|
+
e = e.replace(/\r/g,'<br />');
|
50
|
+
|
51
|
+
var prompt = '',
|
52
|
+
ok = 'OK',
|
53
|
+
cancel = 'Cancel',
|
54
|
+
classname = '',
|
55
|
+
buttons = '',
|
56
|
+
box;
|
57
|
+
|
58
|
+
if (f.type === 'prompt') {
|
59
|
+
prompt =
|
60
|
+
'<div class="dialog-prompt">'+
|
61
|
+
'<input id="dialog-input-'+f.newid+'" type="text" ' + (f.params.value ? 'value="' + f.params.value + '"' : '') + ' />'+
|
62
|
+
'</div>';
|
63
|
+
}
|
64
|
+
|
65
|
+
if (f.params.ok) {
|
66
|
+
ok = f.params.ok;
|
67
|
+
}
|
68
|
+
|
69
|
+
if (f.params.cancel) {
|
70
|
+
cancel = f.params.cancel;
|
71
|
+
}
|
72
|
+
|
73
|
+
if (f.params.classname) {
|
74
|
+
classname = f.params.classname;
|
75
|
+
}
|
76
|
+
|
77
|
+
if (f.type !== 'signal') {
|
78
|
+
buttons = '<div class="dialog-buttons">';
|
79
|
+
if (f.type === 'alert') {
|
80
|
+
buttons +=
|
81
|
+
'<button id="alert-ok-'+f.newid+'">'+ok+'</button>';
|
82
|
+
}
|
83
|
+
else if (f.type === 'quiz') {
|
84
|
+
|
85
|
+
if (f.params.button_1) {
|
86
|
+
buttons +=
|
87
|
+
'<button class="quiz-button" id="'+f.type+'-ok1-'+f.newid+'">'+f.params.button_1+'</button>';
|
88
|
+
}
|
89
|
+
|
90
|
+
if (f.params.button_2) {
|
91
|
+
buttons +=
|
92
|
+
'<button class="quiz-button" id="'+f.type+'-ok2-'+f.newid+'">'+f.params.button_2+'</button>';
|
93
|
+
}
|
94
|
+
|
95
|
+
if (f.params.button_3) {
|
96
|
+
buttons +=
|
97
|
+
'<button class="quiz-button" id="'+f.type+'-ok3-'+f.newid+'">'+f.params.button_3+'</button>';
|
98
|
+
}
|
99
|
+
if (f.params.button_cancel) {
|
100
|
+
buttons +=
|
101
|
+
'<button id="'+f.type+'-cancel-'+f.newid+'" class="cancel">'+f.params.button_cancel+'</button>';
|
102
|
+
}
|
103
|
+
|
104
|
+
}
|
105
|
+
|
106
|
+
else if (f.type === 'prompt' || f.type === 'confirm') {
|
107
|
+
if (f.params.reverseButtons) {
|
108
|
+
buttons +=
|
109
|
+
'<button id="'+f.type+'-ok-'+f.newid+'">'+ok+'</button>' +
|
110
|
+
'<button id="'+f.type+'-cancel-'+f.newid+'" class="cancel">'+cancel+'</button>';
|
111
|
+
} else {
|
112
|
+
buttons +=
|
113
|
+
'<button id="'+f.type+'-cancel-'+f.newid+'" class="cancel">'+cancel+'</button>'+
|
114
|
+
'<button id="'+f.type+'-ok-'+f.newid+'">'+ok+'</button>';
|
115
|
+
}
|
116
|
+
}
|
117
|
+
buttons += '</div>';
|
118
|
+
}
|
119
|
+
|
120
|
+
|
121
|
+
box =
|
122
|
+
'<div id="smoke-bg-'+f.newid+'" class="smokebg"></div>'+
|
123
|
+
'<div class="dialog smoke '+classname+'">'+
|
124
|
+
'<div class="dialog-inner">'+
|
125
|
+
e+
|
126
|
+
prompt+
|
127
|
+
buttons+
|
128
|
+
'</div>'+
|
129
|
+
'</div>';
|
130
|
+
|
131
|
+
if (!smoke.init) {
|
132
|
+
smoke.listen(window,"load", function() {
|
133
|
+
smoke.finishbuild(e,f,box);
|
134
|
+
});
|
135
|
+
} else{
|
136
|
+
smoke.finishbuild(e,f,box);
|
137
|
+
}
|
138
|
+
|
139
|
+
},
|
140
|
+
|
141
|
+
finishbuild: function(e, f, box) {
|
142
|
+
|
143
|
+
var ff = document.getElementById('smoke-out-'+f.newid);
|
144
|
+
|
145
|
+
ff.className = 'smoke-base smoke-visible smoke-' + f.type;
|
146
|
+
ff.innerHTML = box;
|
147
|
+
|
148
|
+
while (ff.innerHTML === "") {
|
149
|
+
ff.innerHTML = box;
|
150
|
+
}
|
151
|
+
|
152
|
+
if (smoke.smoketimeout[f.newid]) {
|
153
|
+
clearTimeout(smoke.smoketimeout[f.newid]);
|
154
|
+
}
|
155
|
+
|
156
|
+
smoke.listen(
|
157
|
+
document.getElementById('smoke-bg-'+f.newid),
|
158
|
+
"click",
|
159
|
+
function () {
|
160
|
+
smoke.destroy(f.type, f.newid);
|
161
|
+
if (f.type === 'prompt' || f.type === 'confirm' || f.type === 'quiz') {
|
162
|
+
f.callback(false);
|
163
|
+
} else if (f.type === 'alert' && typeof f.callback !== 'undefined') {
|
164
|
+
f.callback();
|
165
|
+
}
|
166
|
+
}
|
167
|
+
);
|
168
|
+
|
169
|
+
|
170
|
+
switch (f.type) {
|
171
|
+
case 'alert':
|
172
|
+
smoke.finishbuildAlert(e, f, box);
|
173
|
+
break;
|
174
|
+
case 'confirm':
|
175
|
+
smoke.finishbuildConfirm(e, f, box);
|
176
|
+
break;
|
177
|
+
case 'quiz':
|
178
|
+
smoke.finishbuildQuiz(e, f, box);
|
179
|
+
break;
|
180
|
+
case 'prompt':
|
181
|
+
smoke.finishbuildPrompt(e, f, box);
|
182
|
+
break;
|
183
|
+
case 'signal':
|
184
|
+
smoke.finishbuildSignal(e, f, box);
|
185
|
+
break;
|
186
|
+
default:
|
187
|
+
throw "Unknown type: " + f.type;
|
188
|
+
}
|
189
|
+
},
|
190
|
+
|
191
|
+
finishbuildAlert: function (e, f, box) {
|
192
|
+
smoke.listen(
|
193
|
+
document.getElementById('alert-ok-'+f.newid),
|
194
|
+
"click",
|
195
|
+
function () {
|
196
|
+
smoke.destroy(f.type, f.newid);
|
197
|
+
if (typeof f.callback !== 'undefined') {
|
198
|
+
f.callback();
|
199
|
+
}
|
200
|
+
}
|
201
|
+
);
|
202
|
+
|
203
|
+
document.onkeyup = function (e) {
|
204
|
+
if (!e) {
|
205
|
+
e = window.event;
|
206
|
+
}
|
207
|
+
if (e.keyCode === 13 || e.keyCode === 32 || e.keyCode === 27) {
|
208
|
+
smoke.destroy(f.type, f.newid);
|
209
|
+
if (typeof f.callback !== 'undefined') {
|
210
|
+
f.callback();
|
211
|
+
}
|
212
|
+
}
|
213
|
+
};
|
214
|
+
},
|
215
|
+
|
216
|
+
finishbuildConfirm: function (e, f, box) {
|
217
|
+
smoke.listen(
|
218
|
+
document.getElementById('confirm-cancel-' + f.newid),
|
219
|
+
"click",
|
220
|
+
function ()
|
221
|
+
{
|
222
|
+
smoke.destroy(f.type, f.newid);
|
223
|
+
f.callback(false);
|
224
|
+
}
|
225
|
+
);
|
226
|
+
|
227
|
+
smoke.listen(
|
228
|
+
document.getElementById('confirm-ok-' + f.newid),
|
229
|
+
"click",
|
230
|
+
function ()
|
231
|
+
{
|
232
|
+
smoke.destroy(f.type, f.newid);
|
233
|
+
f.callback(true);
|
234
|
+
}
|
235
|
+
);
|
236
|
+
|
237
|
+
document.onkeyup = function (e) {
|
238
|
+
if (!e) {
|
239
|
+
e = window.event;
|
240
|
+
}
|
241
|
+
if (e.keyCode === 13 || e.keyCode === 32) {
|
242
|
+
smoke.destroy(f.type, f.newid);
|
243
|
+
f.callback(true);
|
244
|
+
} else if (e.keyCode === 27) {
|
245
|
+
smoke.destroy(f.type, f.newid);
|
246
|
+
f.callback(false);
|
247
|
+
}
|
248
|
+
};
|
249
|
+
},
|
250
|
+
|
251
|
+
finishbuildQuiz: function (e, f, box) {
|
252
|
+
var a, b, c;
|
253
|
+
|
254
|
+
smoke.listen(
|
255
|
+
document.getElementById('quiz-cancel-' + f.newid),
|
256
|
+
"click",
|
257
|
+
function ()
|
258
|
+
{
|
259
|
+
smoke.destroy(f.type, f.newid);
|
260
|
+
f.callback(false);
|
261
|
+
}
|
262
|
+
);
|
263
|
+
|
264
|
+
|
265
|
+
if (a = document.getElementById('quiz-ok1-'+f.newid))
|
266
|
+
smoke.listen(
|
267
|
+
a,
|
268
|
+
"click",
|
269
|
+
function () {
|
270
|
+
smoke.destroy(f.type, f.newid);
|
271
|
+
f.callback(a.innerHTML);
|
272
|
+
}
|
273
|
+
);
|
274
|
+
|
275
|
+
|
276
|
+
if (b = document.getElementById('quiz-ok2-'+f.newid))
|
277
|
+
smoke.listen(
|
278
|
+
b,
|
279
|
+
"click",
|
280
|
+
function () {
|
281
|
+
smoke.destroy(f.type, f.newid);
|
282
|
+
f.callback(b.innerHTML);
|
283
|
+
}
|
284
|
+
);
|
285
|
+
|
286
|
+
|
287
|
+
if (c = document.getElementById('quiz-ok3-'+f.newid))
|
288
|
+
smoke.listen(
|
289
|
+
c,
|
290
|
+
"click",
|
291
|
+
function () {
|
292
|
+
smoke.destroy(f.type, f.newid);
|
293
|
+
f.callback(c.innerHTML);
|
294
|
+
}
|
295
|
+
);
|
296
|
+
|
297
|
+
document.onkeyup = function (e) {
|
298
|
+
if (!e) {
|
299
|
+
e = window.event;
|
300
|
+
}
|
301
|
+
if (e.keyCode === 27) {
|
302
|
+
smoke.destroy(f.type, f.newid);
|
303
|
+
f.callback(false);
|
304
|
+
}
|
305
|
+
};
|
306
|
+
|
307
|
+
},
|
308
|
+
|
309
|
+
finishbuildPrompt: function (e, f, box) {
|
310
|
+
var pi = document.getElementById('dialog-input-'+f.newid);
|
311
|
+
|
312
|
+
setTimeout(function () {
|
313
|
+
pi.focus();
|
314
|
+
pi.select();
|
315
|
+
}, 100);
|
316
|
+
|
317
|
+
smoke.listen(
|
318
|
+
document.getElementById('prompt-cancel-'+f.newid),
|
319
|
+
"click",
|
320
|
+
function () {
|
321
|
+
smoke.destroy(f.type, f.newid);
|
322
|
+
f.callback(false);
|
323
|
+
}
|
324
|
+
);
|
325
|
+
|
326
|
+
smoke.listen(
|
327
|
+
document.getElementById('prompt-ok-'+f.newid),
|
328
|
+
"click",
|
329
|
+
function () {
|
330
|
+
smoke.destroy(f.type, f.newid);
|
331
|
+
f.callback(pi.value);
|
332
|
+
}
|
333
|
+
);
|
334
|
+
|
335
|
+
document.onkeyup = function (e) {
|
336
|
+
if (!e) {
|
337
|
+
e = window.event;
|
338
|
+
}
|
339
|
+
|
340
|
+
if (e.keyCode === 13) {
|
341
|
+
smoke.destroy(f.type, f.newid);
|
342
|
+
f.callback(pi.value);
|
343
|
+
} else if (e.keyCode === 27) {
|
344
|
+
smoke.destroy(f.type, f.newid);
|
345
|
+
f.callback(false);
|
346
|
+
}
|
347
|
+
};
|
348
|
+
},
|
349
|
+
|
350
|
+
finishbuildSignal: function (e, f, box) {
|
351
|
+
|
352
|
+
|
353
|
+
document.onkeyup = function (e) {
|
354
|
+
if (!e) {
|
355
|
+
e = window.event;
|
356
|
+
}
|
357
|
+
if (e.keyCode === 27) {
|
358
|
+
smoke.destroy(f.type, f.newid);
|
359
|
+
if (typeof f.callback !== 'undefined') {
|
360
|
+
f.callback();
|
361
|
+
}
|
362
|
+
}
|
363
|
+
};
|
364
|
+
|
365
|
+
smoke.smoketimeout[f.newid] = setTimeout(function () {
|
366
|
+
smoke.destroy(f.type, f.newid);
|
367
|
+
if (typeof f.callback !== 'undefined') {
|
368
|
+
f.callback();
|
369
|
+
}
|
370
|
+
}, f.timeout);
|
371
|
+
},
|
372
|
+
|
373
|
+
|
374
|
+
destroy: function (type,id) {
|
375
|
+
|
376
|
+
var box = document.getElementById('smoke-out-'+id);
|
377
|
+
|
378
|
+
if (type !== 'quiz') {
|
379
|
+
var okButton = document.getElementById(type+'-ok-'+id);
|
380
|
+
}
|
381
|
+
|
382
|
+
var cancelButton = document.getElementById(type+'-cancel-'+id);
|
383
|
+
box.className = 'smoke-base';
|
384
|
+
|
385
|
+
if (okButton) {
|
386
|
+
smoke.stoplistening(okButton, "click", function() {});
|
387
|
+
document.onkeyup = null;
|
388
|
+
}
|
389
|
+
|
390
|
+
if (type === 'quiz') {
|
391
|
+
var quiz_buttons = document.getElementsByClassName("quiz-button");
|
392
|
+
for (var i = 0; i < quiz_buttons.length; i++) {
|
393
|
+
smoke.stoplistening(quiz_buttons[i], "click", function() {});
|
394
|
+
document.onkeyup = null;
|
395
|
+
}
|
396
|
+
}
|
397
|
+
|
398
|
+
if (cancelButton) {
|
399
|
+
smoke.stoplistening(cancelButton, "click", function() {});
|
400
|
+
}
|
401
|
+
|
402
|
+
smoke.i = 0;
|
403
|
+
box.innerHTML = '';
|
404
|
+
},
|
405
|
+
|
406
|
+
alert: function (e, f, g) {
|
407
|
+
if (typeof g !== 'object') {
|
408
|
+
g = false;
|
409
|
+
}
|
410
|
+
|
411
|
+
var id = smoke.newdialog();
|
412
|
+
|
413
|
+
smoke.build(e, {
|
414
|
+
type: 'alert',
|
415
|
+
callback: f,
|
416
|
+
params: g,
|
417
|
+
newid: id
|
418
|
+
});
|
419
|
+
},
|
420
|
+
|
421
|
+
signal: function (e, f, g) {
|
422
|
+
if (typeof g !== 'object') {
|
423
|
+
g = false;
|
424
|
+
}
|
425
|
+
|
426
|
+
var duration = 5000;
|
427
|
+
if (g.duration !== 'undefined'){
|
428
|
+
duration = g.duration;
|
429
|
+
}
|
430
|
+
|
431
|
+
var id = smoke.newdialog();
|
432
|
+
smoke.build(e, {
|
433
|
+
type: 'signal',
|
434
|
+
callback: f,
|
435
|
+
timeout: duration,
|
436
|
+
params: g,
|
437
|
+
newid: id
|
438
|
+
});
|
439
|
+
},
|
440
|
+
|
441
|
+
confirm: function (e, f, g) {
|
442
|
+
if (typeof g !== 'object') {
|
443
|
+
g = false;
|
444
|
+
}
|
445
|
+
|
446
|
+
var id = smoke.newdialog();
|
447
|
+
smoke.build(e, {
|
448
|
+
type: 'confirm',
|
449
|
+
callback: f,
|
450
|
+
params: g,
|
451
|
+
newid: id
|
452
|
+
});
|
453
|
+
},
|
454
|
+
|
455
|
+
quiz: function (e, f, g) {
|
456
|
+
if (typeof g !== 'object') {
|
457
|
+
g = false;
|
458
|
+
}
|
459
|
+
|
460
|
+
var id = smoke.newdialog();
|
461
|
+
smoke.build(e, {
|
462
|
+
type: 'quiz',
|
463
|
+
callback: f,
|
464
|
+
params: g,
|
465
|
+
newid: id
|
466
|
+
});
|
467
|
+
},
|
468
|
+
|
469
|
+
prompt: function (e, f, g) {
|
470
|
+
if (typeof g !== 'object') {
|
471
|
+
g = false;
|
472
|
+
}
|
473
|
+
|
474
|
+
var id = smoke.newdialog();
|
475
|
+
return smoke.build(e,{type:'prompt',callback:f,params:g,newid:id});
|
476
|
+
},
|
477
|
+
|
478
|
+
listen: function (e, f, g) {
|
479
|
+
if (e.addEventListener) {
|
480
|
+
return e.addEventListener(f, g, false);
|
481
|
+
}
|
482
|
+
|
483
|
+
if (e.attachEvent) {
|
484
|
+
return e.attachEvent('on'+f, g);
|
485
|
+
}
|
486
|
+
|
487
|
+
return false;
|
488
|
+
},
|
489
|
+
|
490
|
+
stoplistening: function (e, f, g) {
|
491
|
+
if (e.removeEventListener) {
|
492
|
+
return e.removeEventListener(f, g, false);
|
493
|
+
}
|
494
|
+
|
495
|
+
if (e.detachEvent) {
|
496
|
+
return e.detachEvent('on'+f, g);
|
497
|
+
}
|
498
|
+
|
499
|
+
return false;
|
500
|
+
}
|
501
|
+
};
|
502
|
+
|
503
|
+
|
504
|
+
smoke.init = true;
|
505
|
+
|
506
|
+
if (typeof module != 'undefined' && module.exports) {
|
507
|
+
module.exports = smoke;
|
508
|
+
}
|
509
|
+
else if (typeof define === 'function' && define.amd) {
|
510
|
+
define('smoke', [], function() {
|
511
|
+
return smoke;
|
512
|
+
});
|
513
|
+
}
|
514
|
+
else {
|
515
|
+
this.smoke = smoke;
|
516
|
+
}
|
517
|
+
|
518
|
+
})(window, document);
|
@@ -0,0 +1,114 @@
|
|
1
|
+
.smoke-base {
|
2
|
+
position: fixed;
|
3
|
+
top: 0;
|
4
|
+
left: 0;
|
5
|
+
bottom: 0;
|
6
|
+
right: 0;
|
7
|
+
visibility: hidden;
|
8
|
+
opacity: 0;
|
9
|
+
}
|
10
|
+
|
11
|
+
.smoke-base.smoke-visible {
|
12
|
+
opacity: 1;
|
13
|
+
visibility: visible;
|
14
|
+
}
|
15
|
+
|
16
|
+
.smokebg {
|
17
|
+
position: fixed;
|
18
|
+
top: 0;
|
19
|
+
left: 0;
|
20
|
+
bottom: 0;
|
21
|
+
right: 0;
|
22
|
+
}
|
23
|
+
|
24
|
+
.smoke-base .dialog {
|
25
|
+
position: absolute;
|
26
|
+
}
|
27
|
+
|
28
|
+
.dialog-prompt {
|
29
|
+
margin-top: 15px;
|
30
|
+
text-align: center;
|
31
|
+
}
|
32
|
+
|
33
|
+
.dialog-buttons {
|
34
|
+
margin: 20px 0 5px 0
|
35
|
+
}
|
36
|
+
|
37
|
+
.smoke {
|
38
|
+
font-family: Menlo, 'Andale Mono', monospace;
|
39
|
+
text-align: center;
|
40
|
+
font-size: 22px;
|
41
|
+
line-height: 150%;
|
42
|
+
}
|
43
|
+
|
44
|
+
.dialog-buttons button {
|
45
|
+
display: inline-block;
|
46
|
+
vertical-align: baseline;
|
47
|
+
cursor: pointer;
|
48
|
+
font-family: Menlo, 'Andale Mono', monospace;
|
49
|
+
font-style: normal;
|
50
|
+
text-decoration: none;
|
51
|
+
border: 0;
|
52
|
+
outline: 0;
|
53
|
+
margin: 0 5px;
|
54
|
+
-webkit-background-clip: padding-box;
|
55
|
+
font-size: 13px;
|
56
|
+
line-height: 13px;
|
57
|
+
font-weight: normal;
|
58
|
+
padding: 9px 12px;
|
59
|
+
}
|
60
|
+
|
61
|
+
.dialog-prompt input {
|
62
|
+
margin: 0;
|
63
|
+
border: 0;
|
64
|
+
font-family: sans-serif;
|
65
|
+
outline: none;
|
66
|
+
font-family: Menlo, 'Andale Mono', monospace;
|
67
|
+
border: 1px solid #aaa;
|
68
|
+
width: 75%;
|
69
|
+
display: inline-block;
|
70
|
+
background-color: transparent;
|
71
|
+
font-size: 16px;
|
72
|
+
padding: 8px;
|
73
|
+
}
|
74
|
+
|
75
|
+
.smoke-base {
|
76
|
+
background: rgba(0,0,0,.3);
|
77
|
+
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#90000000,endColorstr=#900000000);
|
78
|
+
}
|
79
|
+
|
80
|
+
.smoke-base .dialog {
|
81
|
+
top: 25%;
|
82
|
+
width: 40%;
|
83
|
+
left: 50%;
|
84
|
+
margin-left: -20%;
|
85
|
+
}
|
86
|
+
|
87
|
+
.smoke-base .dialog-inner {
|
88
|
+
padding: 15px;
|
89
|
+
|
90
|
+
color:#202020;
|
91
|
+
}
|
92
|
+
|
93
|
+
.smoke {
|
94
|
+
background-color: rgba(255,255,255,0.95);
|
95
|
+
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#ffffff,endColorstr=#ffffff);
|
96
|
+
box-shadow: 0 2px 8px #666;
|
97
|
+
}
|
98
|
+
|
99
|
+
|
100
|
+
.dialog-buttons button {
|
101
|
+
background-color: rgba(0,0,0,.85);
|
102
|
+
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#222222,endColorstr=#222222);
|
103
|
+
border-radius: 0;
|
104
|
+
color: #fff;
|
105
|
+
}
|
106
|
+
|
107
|
+
button.cancel {
|
108
|
+
background-color: rgba(0,0,0,.40);
|
109
|
+
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#444444,endColorstr=#444444);
|
110
|
+
}
|
111
|
+
|
112
|
+
.queue{
|
113
|
+
display:none;
|
114
|
+
}
|
metadata
ADDED
@@ -0,0 +1,85 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: smokejs_rails
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.3
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Guinsly Mondesir
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-01-21 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.7'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.7'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
description: A Rails implementation of smokejs (http://smoke-js.com/) A stylish javascript
|
42
|
+
alert, framework-agnostic styled alert
|
43
|
+
email:
|
44
|
+
- agmond@gmx.com.br
|
45
|
+
executables: []
|
46
|
+
extensions: []
|
47
|
+
extra_rdoc_files: []
|
48
|
+
files:
|
49
|
+
- ".gitignore"
|
50
|
+
- Gemfile
|
51
|
+
- LICENSE.txt
|
52
|
+
- README.md
|
53
|
+
- Rakefile
|
54
|
+
- lib/smokejs_rails.rb
|
55
|
+
- lib/smokejs_rails/version.rb
|
56
|
+
- smokejs_rails.gemspec
|
57
|
+
- vendor/assets/javascripts/smoke.js
|
58
|
+
- vendor/assets/stylesheets/smoke.css
|
59
|
+
homepage: https://github.com/guinslym/smokejs_rails
|
60
|
+
licenses:
|
61
|
+
- MIT
|
62
|
+
metadata: {}
|
63
|
+
post_install_message:
|
64
|
+
rdoc_options: []
|
65
|
+
require_paths:
|
66
|
+
- lib
|
67
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
68
|
+
requirements:
|
69
|
+
- - ">="
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: '0'
|
72
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - ">="
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
77
|
+
requirements: []
|
78
|
+
rubyforge_project:
|
79
|
+
rubygems_version: 2.2.2
|
80
|
+
signing_key:
|
81
|
+
specification_version: 4
|
82
|
+
summary: A Rails implementation of smokejs (http://smoke-js.com/) A stylish javascript
|
83
|
+
alert, framework-agnostic styled alert
|
84
|
+
test_files: []
|
85
|
+
has_rdoc:
|