notie-rails 1.1.1
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.
- checksums.yaml +7 -0
- data/.gitignore +11 -0
- data/Gemfile +4 -0
- data/LICENSE.md +21 -0
- data/README.md +29 -0
- data/Rakefile +1 -0
- data/bin/console +14 -0
- data/bin/setup +7 -0
- data/lib/notie/rails.rb +8 -0
- data/lib/notie/rails/version.rb +5 -0
- data/notie-rails.gemspec +22 -0
- data/vendor/assets/javascripts/notie.js +448 -0
- metadata +83 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 91a2e83571c8874f18f3f555528b5a8016ede7d0
|
4
|
+
data.tar.gz: 632dec88c72342d58442588638b54a4ca1537d2e
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 62a97198b15164c1b1b1c7be9608f81534f5435f999f6fbae88f0339e35d32e8294e9235d8145ec9b7925dd3d41c30bbca8d98939ba67ab2f487a6cc490d8824
|
7
|
+
data.tar.gz: ef75fb2492a1016805179606ae8d4e1a58a0c7b3a0f0deb1b1788ff752e9117833180e5876ba7de26659dfd4405c51d0401e1e71711912bd2dcf88f2350026dc
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.md
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 Dean Silfen
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# notie-rails
|
2
|
+
|
3
|
+
## Installation
|
4
|
+
|
5
|
+
Add this line to your application's Gemfile:
|
6
|
+
|
7
|
+
```ruby
|
8
|
+
gem 'notie-rails'
|
9
|
+
```
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install notie-rails
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
See [notie.js](https://jaredreich.com/projects/notie.js/) for questions about the actual javascript library. Otherwise fill out an issue if there are rails issues and I will do my best to attend to them in a timely fashion.
|
22
|
+
|
23
|
+
## Contributing
|
24
|
+
|
25
|
+
1. Fork it ( https://github.com/djds23/notie-rails/fork )
|
26
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
27
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
28
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
29
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "notie/rails"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
data/lib/notie/rails.rb
ADDED
data/notie-rails.gemspec
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'notie/rails/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "notie-rails"
|
8
|
+
spec.version = Notie::Rails::VERSION
|
9
|
+
spec.authors = ["Dean Silfen"]
|
10
|
+
spec.email = ["dean.silfen@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{A rails asset pipeline gem for notie.js}
|
13
|
+
spec.description = %q{A rails asset pipeline gem for notie.js, see notie.js documentation for more info: https://jaredreich.com/projects/notie.js/}
|
14
|
+
|
15
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
16
|
+
spec.bindir = "exe"
|
17
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
18
|
+
spec.require_paths = ["lib"]
|
19
|
+
|
20
|
+
spec.add_development_dependency "bundler", "~> 1.9"
|
21
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
22
|
+
end
|
@@ -0,0 +1,448 @@
|
|
1
|
+
/*
|
2
|
+
* notie.js - A clean and simple notification plugin (alert/growl style) for javascript, with no dependencies.
|
3
|
+
*
|
4
|
+
* Copyright (c) 2015 Jared Reich
|
5
|
+
*
|
6
|
+
* Licensed under the MIT license:
|
7
|
+
* http://www.opensource.org/licenses/mit-license.php
|
8
|
+
*
|
9
|
+
* Project home:
|
10
|
+
* https://jaredreich.com/projects/notie.js
|
11
|
+
*
|
12
|
+
* Version: 1.1.1
|
13
|
+
*
|
14
|
+
*/
|
15
|
+
|
16
|
+
var notie = function(){
|
17
|
+
|
18
|
+
// SETTINGS
|
19
|
+
// *********************************************
|
20
|
+
|
21
|
+
// General
|
22
|
+
var shadow = true;
|
23
|
+
var font_size_small = '18px';
|
24
|
+
var font_size_big = '24px';
|
25
|
+
var font_change_screen_width = 600;
|
26
|
+
var animation_delay = 0.3;
|
27
|
+
|
28
|
+
// notie.alert colors
|
29
|
+
var alert_color_success_background = '#57BF57';
|
30
|
+
var alert_color_warning_background = '#E3B771';
|
31
|
+
var alert_color_error_background = '#E1715B';
|
32
|
+
var alert_color_info_background = '#4D82D6';
|
33
|
+
var alert_color_text = '#FFF';
|
34
|
+
|
35
|
+
// notie.confirm colors
|
36
|
+
var confirm_color_background = '#4D82D6';
|
37
|
+
var confirm_color_yes_background = '#57bf57';
|
38
|
+
var confirm_color_no_background = '#E1715B';
|
39
|
+
var confirm_color_text = '#FFF';
|
40
|
+
var confirm_color_yes_text = '#FFF';
|
41
|
+
var confirm_color_no_text = '#FFF';
|
42
|
+
|
43
|
+
// ID's for use within your own .css file (OPTIONAL)
|
44
|
+
// (Be sure to use !important to override the javascript)
|
45
|
+
// Example: #notie-alert-inner { padding: 30px !important; }
|
46
|
+
var alert_outer_id = 'notie-alert-outer';
|
47
|
+
var alert_inner_id = 'notie-alert-inner';
|
48
|
+
var alert_text_id = 'notie-alert-text';
|
49
|
+
var confirm_outer_id = 'notie-confirm-outer';
|
50
|
+
var confirm_inner_id = 'notie-confirm-inner';
|
51
|
+
var confirm_backdrop_id = 'notie-confirm-backdrop';
|
52
|
+
var confirm_yes_id = 'notie-confirm-yes';
|
53
|
+
var confirm_no_id = 'notie-confirm-no';
|
54
|
+
var confirm_text_id = 'notie-confirm-text';
|
55
|
+
var confirm_yes_text_id = 'notie-confirm-yes-text';
|
56
|
+
var confirm_no_text_id = 'notie-confirm-no-text';
|
57
|
+
|
58
|
+
// *********************************************
|
59
|
+
|
60
|
+
|
61
|
+
|
62
|
+
// NOTIE.ALERT
|
63
|
+
// *********************************************
|
64
|
+
|
65
|
+
// notie elements and styling
|
66
|
+
var alert_outer = document.createElement('div');
|
67
|
+
alert_outer.id = alert_outer_id;
|
68
|
+
alert_outer.style.position = 'fixed';
|
69
|
+
alert_outer.style.top = '0';
|
70
|
+
alert_outer.style.left = '0';
|
71
|
+
alert_outer.style.zIndex = '999999999';
|
72
|
+
alert_outer.style.height = 'auto';
|
73
|
+
alert_outer.style.width = '100%';
|
74
|
+
alert_outer.style.display = 'none';
|
75
|
+
alert_outer.style.textAlign = 'center';
|
76
|
+
alert_outer.style.cursor = 'default';
|
77
|
+
alert_outer.style.MozTransition = '';
|
78
|
+
alert_outer.style.WebkitTransition = '';
|
79
|
+
alert_outer.style.transition = '';
|
80
|
+
alert_outer.style.cursor = 'pointer';
|
81
|
+
alert_outer.addEventListener('click', function() {
|
82
|
+
clearTimeout(alert_timeout_1);
|
83
|
+
clearTimeout(alert_timeout_2);
|
84
|
+
alert_hide();
|
85
|
+
});
|
86
|
+
var alert_inner = document.createElement('div');
|
87
|
+
alert_inner.id = alert_inner_id;
|
88
|
+
alert_inner.style.padding = '20px';
|
89
|
+
alert_inner.style.display = 'table-cell';
|
90
|
+
alert_inner.style.verticalAlign = 'middle';
|
91
|
+
alert_outer.appendChild(alert_inner);
|
92
|
+
|
93
|
+
// Initialize notie text
|
94
|
+
var alert_text = document.createElement('span');
|
95
|
+
alert_text.id = alert_text_id;
|
96
|
+
alert_text.style.color = alert_color_text;
|
97
|
+
if (window.innerWidth <= font_change_screen_width) { alert_text.style.fontSize = font_size_small; }
|
98
|
+
else { alert_text.style.fontSize = font_size_big; }
|
99
|
+
window.addEventListener('resize', function(){
|
100
|
+
if (window.innerWidth <= font_change_screen_width) { alert_text.style.fontSize = font_size_small; }
|
101
|
+
else { alert_text.style.fontSize = font_size_big; }
|
102
|
+
}, true);
|
103
|
+
alert_inner.appendChild(alert_text);
|
104
|
+
|
105
|
+
// Attach notie to the body element
|
106
|
+
document.body.appendChild(alert_outer);
|
107
|
+
|
108
|
+
// Declare variables
|
109
|
+
var height = 0;
|
110
|
+
var is_showing = false;
|
111
|
+
var alert_timeout_1;
|
112
|
+
var alert_timeout_2;
|
113
|
+
var was_clicked_counter = 0;
|
114
|
+
|
115
|
+
function alert(type, message, seconds) {
|
116
|
+
|
117
|
+
was_clicked_counter++;
|
118
|
+
|
119
|
+
setTimeout(function() {
|
120
|
+
was_clicked_counter--;
|
121
|
+
}, (animation_delay * 1000 + 10));
|
122
|
+
|
123
|
+
if (was_clicked_counter == 1) {
|
124
|
+
|
125
|
+
if (is_showing) {
|
126
|
+
|
127
|
+
clearTimeout(alert_timeout_1);
|
128
|
+
clearTimeout(alert_timeout_2);
|
129
|
+
|
130
|
+
alert_hide(function() {
|
131
|
+
alert_show(type, message, seconds);
|
132
|
+
});
|
133
|
+
|
134
|
+
}
|
135
|
+
else {
|
136
|
+
alert_show(type, message, seconds);
|
137
|
+
}
|
138
|
+
|
139
|
+
}
|
140
|
+
|
141
|
+
}
|
142
|
+
|
143
|
+
function alert_show(type, message, seconds) {
|
144
|
+
|
145
|
+
is_showing = true;
|
146
|
+
|
147
|
+
var duration = 0;
|
148
|
+
if (typeof seconds == 'undefined') {
|
149
|
+
var duration = 3000;
|
150
|
+
}
|
151
|
+
else if (seconds < 1) {
|
152
|
+
duration = 1000;
|
153
|
+
}
|
154
|
+
else {
|
155
|
+
duration = seconds * 1000;
|
156
|
+
}
|
157
|
+
|
158
|
+
// Set notie type (background color)
|
159
|
+
switch(type) {
|
160
|
+
case 1:
|
161
|
+
alert_outer.style.backgroundColor = alert_color_success_background;
|
162
|
+
break;
|
163
|
+
case 2:
|
164
|
+
alert_outer.style.backgroundColor = alert_color_warning_background;
|
165
|
+
break;
|
166
|
+
case 3:
|
167
|
+
alert_outer.style.backgroundColor = alert_color_error_background;
|
168
|
+
break;
|
169
|
+
case 4:
|
170
|
+
alert_outer.style.backgroundColor = alert_color_info_background;
|
171
|
+
break;
|
172
|
+
}
|
173
|
+
|
174
|
+
// Set notie text
|
175
|
+
alert_text.innerHTML = message;
|
176
|
+
|
177
|
+
// Get notie's height
|
178
|
+
alert_outer.style.top = '-10000px';
|
179
|
+
alert_outer.style.display = 'table';
|
180
|
+
alert_outer.style.top = '-' + alert_outer.offsetHeight - 5 + 'px';
|
181
|
+
|
182
|
+
alert_timeout_1 = setTimeout(function() {
|
183
|
+
|
184
|
+
if (shadow) { alert_outer.style.boxShadow = '0px 0px 10px 0px rgba(0,0,0,0.5)'; }
|
185
|
+
alert_outer.style.MozTransition = 'all ' + animation_delay + 's ease';
|
186
|
+
alert_outer.style.WebkitTransition = 'all ' + animation_delay + 's ease';
|
187
|
+
alert_outer.style.transition = 'all ' + animation_delay + 's ease';
|
188
|
+
|
189
|
+
alert_outer.style.top = 0;
|
190
|
+
|
191
|
+
alert_timeout_2 = setTimeout(function() {
|
192
|
+
|
193
|
+
alert_hide(function() {
|
194
|
+
// Nothing
|
195
|
+
});
|
196
|
+
|
197
|
+
}, duration);
|
198
|
+
|
199
|
+
}, 20);
|
200
|
+
|
201
|
+
}
|
202
|
+
|
203
|
+
function alert_hide(callback) {
|
204
|
+
|
205
|
+
alert_outer.style.top = '-' + alert_outer.offsetHeight - 5 + 'px';
|
206
|
+
|
207
|
+
setTimeout(function() {
|
208
|
+
|
209
|
+
if (shadow) { alert_outer.style.boxShadow = ''; }
|
210
|
+
alert_outer.style.MozTransition = '';
|
211
|
+
alert_outer.style.WebkitTransition = '';
|
212
|
+
alert_outer.style.transition = '';
|
213
|
+
|
214
|
+
alert_outer.style.top = '-10000px';
|
215
|
+
|
216
|
+
is_showing = false;
|
217
|
+
|
218
|
+
callback();
|
219
|
+
|
220
|
+
}, (animation_delay * 1000 + 10));
|
221
|
+
|
222
|
+
}
|
223
|
+
|
224
|
+
|
225
|
+
|
226
|
+
// NOTIE.CONFIRM
|
227
|
+
// *********************************************
|
228
|
+
|
229
|
+
// confirm elements and styling
|
230
|
+
var confirm_outer = document.createElement('div');
|
231
|
+
confirm_outer.id = confirm_outer_id;
|
232
|
+
confirm_outer.style.position = 'fixed';
|
233
|
+
confirm_outer.style.top = '0';
|
234
|
+
confirm_outer.style.left = '0';
|
235
|
+
confirm_outer.style.zIndex = '999999998';
|
236
|
+
confirm_outer.style.height = 'auto';
|
237
|
+
confirm_outer.style.width = '100%';
|
238
|
+
confirm_outer.style.display = 'none';
|
239
|
+
confirm_outer.style.textAlign = 'center';
|
240
|
+
confirm_outer.style.MozTransition = '';
|
241
|
+
confirm_outer.style.WebkitTransition = '';
|
242
|
+
confirm_outer.style.transition = '';
|
243
|
+
|
244
|
+
var confirm_backdrop = document.createElement('div');
|
245
|
+
confirm_backdrop.id = confirm_backdrop_id;
|
246
|
+
confirm_backdrop.style.position = 'fixed';
|
247
|
+
confirm_backdrop.style.top = '0';
|
248
|
+
confirm_backdrop.style.left = '0';
|
249
|
+
confirm_backdrop.style.zIndex = '999999997';
|
250
|
+
confirm_backdrop.style.height = '100%';
|
251
|
+
confirm_backdrop.style.width = '100%';
|
252
|
+
confirm_backdrop.style.display = 'none';
|
253
|
+
confirm_backdrop.style.backgroundColor = 'white';
|
254
|
+
confirm_backdrop.style.MozTransition = 'all ' + animation_delay + 's ease';
|
255
|
+
confirm_backdrop.style.WebkitTransition = 'all ' + animation_delay + 's ease';
|
256
|
+
confirm_backdrop.style.transition = 'all ' + animation_delay + 's ease';
|
257
|
+
confirm_backdrop.style.opacity = '0';
|
258
|
+
confirm_backdrop.onclick = function() { confirm_hide(); }
|
259
|
+
|
260
|
+
var confirm_inner = document.createElement('div');
|
261
|
+
confirm_inner.id = confirm_inner_id;
|
262
|
+
confirm_inner.style.boxSizing = 'border-box';
|
263
|
+
confirm_inner.style.width = '100%';
|
264
|
+
confirm_inner.style.padding = '20px';
|
265
|
+
confirm_inner.style.display = 'block';
|
266
|
+
confirm_inner.style.cursor = 'default';
|
267
|
+
confirm_inner.style.backgroundColor = confirm_color_background;
|
268
|
+
confirm_outer.appendChild(confirm_inner);
|
269
|
+
|
270
|
+
var confirm_yes = document.createElement('div');
|
271
|
+
confirm_yes.id = confirm_yes_id;
|
272
|
+
confirm_yes.style.cssFloat = 'left';
|
273
|
+
confirm_yes.style.height = '50px';
|
274
|
+
confirm_yes.style.lineHeight = '50px';
|
275
|
+
confirm_yes.style.width = '50%';
|
276
|
+
confirm_yes.style.cursor = 'pointer';
|
277
|
+
confirm_yes.style.backgroundColor = confirm_color_yes_background;
|
278
|
+
confirm_outer.appendChild(confirm_yes);
|
279
|
+
|
280
|
+
var confirm_no = document.createElement('div');
|
281
|
+
confirm_no.id = confirm_no_id;
|
282
|
+
confirm_no.style.cssFloat = 'right';
|
283
|
+
confirm_no.style.height = '50px';
|
284
|
+
confirm_no.style.lineHeight = '50px';
|
285
|
+
confirm_no.style.width = '50%';
|
286
|
+
confirm_no.style.cursor = 'pointer';
|
287
|
+
confirm_no.style.backgroundColor = confirm_color_no_background;
|
288
|
+
confirm_no.onclick = function() { confirm_hide(); }
|
289
|
+
confirm_outer.appendChild(confirm_no);
|
290
|
+
|
291
|
+
// Initialize confirm text
|
292
|
+
var confirm_text = document.createElement('span');
|
293
|
+
confirm_text.id = confirm_text_id;
|
294
|
+
confirm_text.style.color = confirm_color_text;
|
295
|
+
if (window.innerWidth <= font_change_screen_width) { confirm_text.style.fontSize = font_size_small; }
|
296
|
+
else { confirm_text.style.fontSize = font_size_big; }
|
297
|
+
window.addEventListener('resize', function(){
|
298
|
+
if (window.innerWidth <= font_change_screen_width) { confirm_text.style.fontSize = font_size_small; }
|
299
|
+
else { confirm_text.style.fontSize = font_size_big; }
|
300
|
+
}, true);
|
301
|
+
confirm_inner.appendChild(confirm_text);
|
302
|
+
|
303
|
+
var confirm_yes_text = document.createElement('span');
|
304
|
+
confirm_yes_text.id = confirm_yes_text_id;
|
305
|
+
confirm_yes_text.style.color = confirm_color_yes_text;
|
306
|
+
if (window.innerWidth <= font_change_screen_width) { confirm_yes_text.style.fontSize = font_size_small; }
|
307
|
+
else { confirm_yes_text.style.fontSize = font_size_big; }
|
308
|
+
window.addEventListener('resize', function(){
|
309
|
+
if (window.innerWidth <= font_change_screen_width) { confirm_yes_text.style.fontSize = font_size_small; }
|
310
|
+
else { confirm_yes_text.style.fontSize = font_size_big; }
|
311
|
+
}, true);
|
312
|
+
confirm_yes.appendChild(confirm_yes_text);
|
313
|
+
|
314
|
+
var confirm_no_text = document.createElement('span');
|
315
|
+
confirm_no_text.id = confirm_no_text_id;
|
316
|
+
confirm_no_text.style.color = confirm_color_no_text;
|
317
|
+
if (window.innerWidth <= font_change_screen_width) { confirm_no_text.style.fontSize = font_size_small; }
|
318
|
+
else { confirm_no_text.style.fontSize = font_size_big; }
|
319
|
+
window.addEventListener('resize', function(){
|
320
|
+
if (window.innerWidth <= font_change_screen_width) { confirm_no_text.style.fontSize = font_size_small; }
|
321
|
+
else { confirm_no_text.style.fontSize = font_size_big; }
|
322
|
+
}, true);
|
323
|
+
confirm_no.appendChild(confirm_no_text);
|
324
|
+
|
325
|
+
// Attach confirm elements to the body element
|
326
|
+
document.body.appendChild(confirm_outer);
|
327
|
+
document.body.appendChild(confirm_backdrop);
|
328
|
+
|
329
|
+
// Declare variables
|
330
|
+
var confirm_height = 0;
|
331
|
+
var confirm_is_showing = false;
|
332
|
+
|
333
|
+
function confirm(title, yes_text, no_text, yes_callback) {
|
334
|
+
|
335
|
+
confirm_show(title, yes_text, no_text, yes_callback);
|
336
|
+
|
337
|
+
// Hide notie.alert
|
338
|
+
clearTimeout(alert_timeout_1);
|
339
|
+
clearTimeout(alert_timeout_2);
|
340
|
+
alert_hide();
|
341
|
+
|
342
|
+
}
|
343
|
+
function confirm_show(title, yes_text, no_text, yes_callback) {
|
344
|
+
|
345
|
+
scroll_disable();
|
346
|
+
|
347
|
+
// Yes callback function
|
348
|
+
confirm_yes.onclick = function() {
|
349
|
+
confirm_hide();
|
350
|
+
setTimeout(function() {
|
351
|
+
yes_callback();
|
352
|
+
}, (animation_delay * 1000 + 10));
|
353
|
+
}
|
354
|
+
|
355
|
+
function confirm_show_inner() {
|
356
|
+
|
357
|
+
// Set confirm text
|
358
|
+
confirm_text.innerHTML = title;
|
359
|
+
confirm_yes_text.innerHTML = yes_text;
|
360
|
+
confirm_no_text.innerHTML = no_text;
|
361
|
+
|
362
|
+
// Get confirm's height
|
363
|
+
confirm_outer.style.top = '-10000px';
|
364
|
+
confirm_outer.style.display = 'table';
|
365
|
+
confirm_outer.style.top = '-' + confirm_outer.offsetHeight - 5 + 'px';
|
366
|
+
confirm_backdrop.style.display = 'block';
|
367
|
+
|
368
|
+
setTimeout(function() {
|
369
|
+
|
370
|
+
if (shadow) { confirm_outer.style.boxShadow = '0px 0px 10px 0px rgba(0,0,0,0.5)'; }
|
371
|
+
confirm_outer.style.MozTransition = 'all ' + animation_delay + 's ease';
|
372
|
+
confirm_outer.style.WebkitTransition = 'all ' + animation_delay + 's ease';
|
373
|
+
confirm_outer.style.transition = 'all ' + animation_delay + 's ease';
|
374
|
+
|
375
|
+
confirm_outer.style.top = 0;
|
376
|
+
confirm_backdrop.style.opacity = '0.75';
|
377
|
+
|
378
|
+
setTimeout(function() {
|
379
|
+
confirm_is_showing = true;
|
380
|
+
}, (animation_delay * 1000 + 10));
|
381
|
+
|
382
|
+
}, 20);
|
383
|
+
|
384
|
+
}
|
385
|
+
|
386
|
+
if (confirm_is_showing) {
|
387
|
+
confirm_hide();
|
388
|
+
setTimeout(function() {
|
389
|
+
confirm_show_inner();
|
390
|
+
}, (animation_delay * 1000 + 10));
|
391
|
+
}
|
392
|
+
else {
|
393
|
+
confirm_show_inner();
|
394
|
+
}
|
395
|
+
|
396
|
+
}
|
397
|
+
|
398
|
+
function confirm_hide() {
|
399
|
+
|
400
|
+
confirm_outer.style.top = '-' + confirm_outer.offsetHeight - 5 + 'px';
|
401
|
+
confirm_backdrop.style.opacity = '0';
|
402
|
+
|
403
|
+
setTimeout(function() {
|
404
|
+
|
405
|
+
if (shadow) { confirm_outer.style.boxShadow = ''; }
|
406
|
+
confirm_outer.style.MozTransition = '';
|
407
|
+
confirm_outer.style.WebkitTransition = '';
|
408
|
+
confirm_outer.style.transition = '';
|
409
|
+
confirm_backdrop.style.display = 'none';
|
410
|
+
|
411
|
+
confirm_outer.style.top = '-10000px';
|
412
|
+
|
413
|
+
scroll_enable();
|
414
|
+
|
415
|
+
confirm_is_showing = false;
|
416
|
+
|
417
|
+
}, (animation_delay * 1000 + 10));
|
418
|
+
|
419
|
+
}
|
420
|
+
|
421
|
+
|
422
|
+
// SCROLL DISABLE AND ENABLE FOR NOTIE.CONFIRM
|
423
|
+
// *********************************************
|
424
|
+
var original_body_height, original_body_overflow;
|
425
|
+
function scroll_disable() {
|
426
|
+
original_body_height = document.body.style.height;
|
427
|
+
original_body_overflow = document.body.style.overflow;
|
428
|
+
document.body.style.height = '100%;';
|
429
|
+
document.body.style.overflow = 'hidden';
|
430
|
+
}
|
431
|
+
function scroll_enable() {
|
432
|
+
document.body.style.height = original_body_height;
|
433
|
+
document.body.style.overflow = original_body_overflow;
|
434
|
+
}
|
435
|
+
|
436
|
+
|
437
|
+
|
438
|
+
|
439
|
+
return {
|
440
|
+
alert: alert,
|
441
|
+
confirm: confirm
|
442
|
+
};
|
443
|
+
|
444
|
+
}();
|
445
|
+
|
446
|
+
if (module) {
|
447
|
+
module.exports = notie;
|
448
|
+
}
|
metadata
ADDED
@@ -0,0 +1,83 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: notie-rails
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.1.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Dean Silfen
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-11-16 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.9'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.9'
|
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 asset pipeline gem for notie.js, see notie.js documentation
|
42
|
+
for more info: https://jaredreich.com/projects/notie.js/'
|
43
|
+
email:
|
44
|
+
- dean.silfen@gmail.com
|
45
|
+
executables: []
|
46
|
+
extensions: []
|
47
|
+
extra_rdoc_files: []
|
48
|
+
files:
|
49
|
+
- ".gitignore"
|
50
|
+
- Gemfile
|
51
|
+
- LICENSE.md
|
52
|
+
- README.md
|
53
|
+
- Rakefile
|
54
|
+
- bin/console
|
55
|
+
- bin/setup
|
56
|
+
- lib/notie/rails.rb
|
57
|
+
- lib/notie/rails/version.rb
|
58
|
+
- notie-rails.gemspec
|
59
|
+
- vendor/assets/javascripts/notie.js
|
60
|
+
homepage:
|
61
|
+
licenses: []
|
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.4.8
|
80
|
+
signing_key:
|
81
|
+
specification_version: 4
|
82
|
+
summary: A rails asset pipeline gem for notie.js
|
83
|
+
test_files: []
|