post_reorder 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/Rakefile +37 -0
- data/app/assets/javascripts/plugins/post_reorder/noty/jquery.noty.js +502 -0
- data/app/assets/javascripts/plugins/post_reorder/noty/layouts/topCenter.js +41 -0
- data/app/assets/javascripts/plugins/post_reorder/noty/layouts/topLeft.js +43 -0
- data/app/assets/javascripts/plugins/post_reorder/noty/layouts/topRight.js +43 -0
- data/app/assets/javascripts/plugins/post_reorder/noty/themes/default.js +155 -0
- data/app/assets/javascripts/plugins/post_reorder/post_reorder.js +69 -0
- data/app/assets/javascripts/plugins/post_reorder/reorder.js +5 -0
- data/app/assets/stylesheets/plugins/post_reorder/reorder.css +6 -0
- data/app/controllers/plugins/post_reorder/admin_controller.rb +35 -0
- data/app/controllers/plugins/post_reorder/front_controller.rb +14 -0
- data/app/helpers/plugins/post_reorder/main_helper.rb +22 -0
- data/app/helpers/plugins/post_reorder/post_reorder_helper.rb +57 -0
- data/app/models/plugins/post_reorder/post_reorder.rb +12 -0
- data/app/views/plugins/post_reorder/admin/settings.html.erb +37 -0
- data/app/views/plugins/post_reorder/front/index.html.erb +1 -0
- data/app/views/plugins/post_reorder/layouts/readme.txt +2 -0
- data/config/camaleon_plugin.json +30 -0
- data/config/locales/translation.yml +16 -0
- data/config/routes.rb +12 -0
- data/lib/post_reorder.rb +4 -0
- data/lib/post_reorder/engine.rb +4 -0
- data/lib/post_reorder/version.rb +3 -0
- data/lib/tasks/post_reorder_tasks.rake +4 -0
- data/test/dummy/README.rdoc +28 -0
- data/test/dummy/Rakefile +6 -0
- data/test/dummy/app/assets/javascripts/application.js +13 -0
- data/test/dummy/app/assets/stylesheets/application.css +15 -0
- data/test/dummy/app/controllers/application_controller.rb +5 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/views/layouts/application.html.erb +14 -0
- data/test/dummy/bin/bundle +3 -0
- data/test/dummy/bin/rails +4 -0
- data/test/dummy/bin/rake +4 -0
- data/test/dummy/bin/setup +29 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/config/application.rb +26 -0
- data/test/dummy/config/boot.rb +5 -0
- data/test/dummy/config/database.yml +25 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +41 -0
- data/test/dummy/config/environments/production.rb +79 -0
- data/test/dummy/config/environments/test.rb +42 -0
- data/test/dummy/config/initializers/assets.rb +11 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/cookies_serializer.rb +3 -0
- data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/test/dummy/config/initializers/inflections.rb +16 -0
- data/test/dummy/config/initializers/mime_types.rb +4 -0
- data/test/dummy/config/initializers/session_store.rb +3 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +23 -0
- data/test/dummy/config/routes.rb +56 -0
- data/test/dummy/config/secrets.yml +22 -0
- data/test/dummy/public/404.html +67 -0
- data/test/dummy/public/422.html +67 -0
- data/test/dummy/public/500.html +66 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/integration/navigation_test.rb +8 -0
- data/test/post_reorder_test.rb +7 -0
- data/test/test_helper.rb +20 -0
- metadata +171 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: f028da135c3691880f4a5e4db75946d0ac2ffefc
|
4
|
+
data.tar.gz: 93f1a4cf42f5c67b56384bd0325ddd96a70b305b
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 22bf998d3178346595cd70283b777aa8fd24ac9e73c4ae928504f69e416bc698f4191529b1f30475e15f89521fe5bb6b05f9e81b1ab3058dbb509cc2425cc203
|
7
|
+
data.tar.gz: 23c6ee7870605b48fa6ec8641c1f3a46a01a86c3dd6e48c76300adb725913275db33d7bc95db75fbb01aa6d41e71126f0e0b47ca4eec7801066ad08c31e855c2
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2015 Owen
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
begin
|
2
|
+
require 'bundler/setup'
|
3
|
+
rescue LoadError
|
4
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
5
|
+
end
|
6
|
+
|
7
|
+
require 'rdoc/task'
|
8
|
+
|
9
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
10
|
+
rdoc.rdoc_dir = 'rdoc'
|
11
|
+
rdoc.title = 'PostReorder'
|
12
|
+
rdoc.options << '--line-numbers'
|
13
|
+
rdoc.rdoc_files.include('README.rdoc')
|
14
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
15
|
+
end
|
16
|
+
|
17
|
+
APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
|
18
|
+
load 'rails/tasks/engine.rake'
|
19
|
+
|
20
|
+
|
21
|
+
load 'rails/tasks/statistics.rake'
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
Bundler::GemHelper.install_tasks
|
26
|
+
|
27
|
+
require 'rake/testtask'
|
28
|
+
|
29
|
+
Rake::TestTask.new(:test) do |t|
|
30
|
+
t.libs << 'lib'
|
31
|
+
t.libs << 'test'
|
32
|
+
t.pattern = 'test/**/*_test.rb'
|
33
|
+
t.verbose = false
|
34
|
+
end
|
35
|
+
|
36
|
+
|
37
|
+
task default: :test
|
@@ -0,0 +1,502 @@
|
|
1
|
+
/*!
|
2
|
+
@package noty - jQuery Notification Plugin
|
3
|
+
@version version: 2.2.7
|
4
|
+
@contributors https://github.com/needim/noty/graphs/contributors
|
5
|
+
|
6
|
+
@documentation Examples and Documentation - http://needim.github.com/noty/
|
7
|
+
|
8
|
+
@license Licensed under the MIT licenses: http://www.opensource.org/licenses/mit-license.php
|
9
|
+
*/
|
10
|
+
|
11
|
+
if(typeof Object.create !== 'function') {
|
12
|
+
Object.create = function(o) {
|
13
|
+
function F() {
|
14
|
+
}
|
15
|
+
|
16
|
+
F.prototype = o;
|
17
|
+
return new F();
|
18
|
+
};
|
19
|
+
}
|
20
|
+
|
21
|
+
(function($) {
|
22
|
+
|
23
|
+
var NotyObject = {
|
24
|
+
|
25
|
+
init: function(options) {
|
26
|
+
|
27
|
+
// Mix in the passed in options with the default options
|
28
|
+
this.options = $.extend({}, $.noty.defaults, options);
|
29
|
+
|
30
|
+
this.options.layout = (this.options.custom) ? $.noty.layouts['inline'] : $.noty.layouts[this.options.layout];
|
31
|
+
|
32
|
+
if($.noty.themes[this.options.theme])
|
33
|
+
this.options.theme = $.noty.themes[this.options.theme];
|
34
|
+
else
|
35
|
+
options.themeClassName = this.options.theme;
|
36
|
+
|
37
|
+
delete options.layout;
|
38
|
+
delete options.theme;
|
39
|
+
|
40
|
+
this.options = $.extend({}, this.options, this.options.layout.options);
|
41
|
+
this.options.id = 'noty_' + (new Date().getTime() * Math.floor(Math.random() * 1000000));
|
42
|
+
|
43
|
+
this.options = $.extend({}, this.options, options);
|
44
|
+
|
45
|
+
// Build the noty dom initial structure
|
46
|
+
this._build();
|
47
|
+
|
48
|
+
// return this so we can chain/use the bridge with less code.
|
49
|
+
return this;
|
50
|
+
}, // end init
|
51
|
+
|
52
|
+
_build: function() {
|
53
|
+
|
54
|
+
// Generating noty bar
|
55
|
+
var $bar = $('<div class="noty_bar noty_type_' + this.options.type + '"></div>').attr('id', this.options.id);
|
56
|
+
$bar.append(this.options.template).find('.noty_text').html(this.options.text);
|
57
|
+
|
58
|
+
this.$bar = (this.options.layout.parent.object !== null) ? $(this.options.layout.parent.object).css(this.options.layout.parent.css).append($bar) : $bar;
|
59
|
+
|
60
|
+
if(this.options.themeClassName)
|
61
|
+
this.$bar.addClass(this.options.themeClassName).addClass('noty_container_type_' + this.options.type);
|
62
|
+
|
63
|
+
// Set buttons if available
|
64
|
+
if(this.options.buttons) {
|
65
|
+
|
66
|
+
// If we have button disable closeWith & timeout options
|
67
|
+
this.options.closeWith = [];
|
68
|
+
this.options.timeout = false;
|
69
|
+
|
70
|
+
var $buttons = $('<div/>').addClass('noty_buttons');
|
71
|
+
|
72
|
+
(this.options.layout.parent.object !== null) ? this.$bar.find('.noty_bar').append($buttons) : this.$bar.append($buttons);
|
73
|
+
|
74
|
+
var self = this;
|
75
|
+
|
76
|
+
$.each(this.options.buttons, function(i, button) {
|
77
|
+
var $button = $('<button/>').addClass((button.addClass) ? button.addClass : 'gray').html(button.text).attr('id', button.id ? button.id : 'button-' + i)
|
78
|
+
.appendTo(self.$bar.find('.noty_buttons'))
|
79
|
+
.on('click', function() {
|
80
|
+
if($.isFunction(button.onClick)) {
|
81
|
+
button.onClick.call($button, self);
|
82
|
+
}
|
83
|
+
});
|
84
|
+
});
|
85
|
+
}
|
86
|
+
|
87
|
+
// For easy access
|
88
|
+
this.$message = this.$bar.find('.noty_message');
|
89
|
+
this.$closeButton = this.$bar.find('.noty_close');
|
90
|
+
this.$buttons = this.$bar.find('.noty_buttons');
|
91
|
+
|
92
|
+
$.noty.store[this.options.id] = this; // store noty for api
|
93
|
+
|
94
|
+
}, // end _build
|
95
|
+
|
96
|
+
show: function() {
|
97
|
+
|
98
|
+
var self = this;
|
99
|
+
|
100
|
+
(self.options.custom) ? self.options.custom.find(self.options.layout.container.selector).append(self.$bar) : $(self.options.layout.container.selector).append(self.$bar);
|
101
|
+
|
102
|
+
if(self.options.theme && self.options.theme.style)
|
103
|
+
self.options.theme.style.apply(self);
|
104
|
+
|
105
|
+
($.type(self.options.layout.css) === 'function') ? this.options.layout.css.apply(self.$bar) : self.$bar.css(this.options.layout.css || {});
|
106
|
+
|
107
|
+
self.$bar.addClass(self.options.layout.addClass);
|
108
|
+
|
109
|
+
self.options.layout.container.style.apply($(self.options.layout.container.selector));
|
110
|
+
|
111
|
+
self.showing = true;
|
112
|
+
|
113
|
+
if(self.options.theme && self.options.theme.style)
|
114
|
+
self.options.theme.callback.onShow.apply(this);
|
115
|
+
|
116
|
+
if($.inArray('click', self.options.closeWith) > -1)
|
117
|
+
self.$bar.css('cursor', 'pointer').one('click', function(evt) {
|
118
|
+
self.stopPropagation(evt);
|
119
|
+
if(self.options.callback.onCloseClick) {
|
120
|
+
self.options.callback.onCloseClick.apply(self);
|
121
|
+
}
|
122
|
+
self.close();
|
123
|
+
});
|
124
|
+
|
125
|
+
if($.inArray('hover', self.options.closeWith) > -1)
|
126
|
+
self.$bar.one('mouseenter', function() {
|
127
|
+
self.close();
|
128
|
+
});
|
129
|
+
|
130
|
+
if($.inArray('button', self.options.closeWith) > -1)
|
131
|
+
self.$closeButton.one('click', function(evt) {
|
132
|
+
self.stopPropagation(evt);
|
133
|
+
self.close();
|
134
|
+
});
|
135
|
+
|
136
|
+
if($.inArray('button', self.options.closeWith) == -1)
|
137
|
+
self.$closeButton.remove();
|
138
|
+
|
139
|
+
if(self.options.callback.onShow)
|
140
|
+
self.options.callback.onShow.apply(self);
|
141
|
+
|
142
|
+
self.$bar.animate(
|
143
|
+
self.options.animation.open,
|
144
|
+
self.options.animation.speed,
|
145
|
+
self.options.animation.easing,
|
146
|
+
function() {
|
147
|
+
if(self.options.callback.afterShow) self.options.callback.afterShow.apply(self);
|
148
|
+
self.showing = false;
|
149
|
+
self.shown = true;
|
150
|
+
});
|
151
|
+
|
152
|
+
// If noty is have a timeout option
|
153
|
+
if(self.options.timeout)
|
154
|
+
self.$bar.delay(self.options.timeout).promise().done(function() {
|
155
|
+
self.close();
|
156
|
+
});
|
157
|
+
|
158
|
+
return this;
|
159
|
+
|
160
|
+
}, // end show
|
161
|
+
|
162
|
+
close: function() {
|
163
|
+
|
164
|
+
if(this.closed) return;
|
165
|
+
if(this.$bar && this.$bar.hasClass('i-am-closing-now')) return;
|
166
|
+
|
167
|
+
var self = this;
|
168
|
+
|
169
|
+
if(this.showing) {
|
170
|
+
self.$bar.queue(
|
171
|
+
function() {
|
172
|
+
self.close.apply(self);
|
173
|
+
}
|
174
|
+
);
|
175
|
+
return;
|
176
|
+
}
|
177
|
+
|
178
|
+
this.$bar.dequeue();
|
179
|
+
|
180
|
+
if(!this.shown && !this.showing) { // If we are still waiting in the queue just delete from queue
|
181
|
+
var queue = [];
|
182
|
+
$.each($.noty.queue, function(i, n) {
|
183
|
+
if(n.options.id != self.options.id) {
|
184
|
+
queue.push(n);
|
185
|
+
}
|
186
|
+
});
|
187
|
+
$.noty.queue = queue;
|
188
|
+
return;
|
189
|
+
}
|
190
|
+
|
191
|
+
self.$bar.addClass('i-am-closing-now');
|
192
|
+
|
193
|
+
if(self.options.callback.onClose) {
|
194
|
+
self.options.callback.onClose.apply(self);
|
195
|
+
}
|
196
|
+
|
197
|
+
self.$bar.clearQueue().stop().animate(
|
198
|
+
self.options.animation.close,
|
199
|
+
self.options.animation.speed,
|
200
|
+
self.options.animation.easing,
|
201
|
+
function() {
|
202
|
+
if(self.options.callback.afterClose) self.options.callback.afterClose.apply(self);
|
203
|
+
})
|
204
|
+
.promise().done(function() {
|
205
|
+
|
206
|
+
// Modal Cleaning
|
207
|
+
if(self.options.modal) {
|
208
|
+
$.notyRenderer.setModalCount(-1);
|
209
|
+
if($.notyRenderer.getModalCount() == 0) $('.noty_modal').fadeOut('fast', function() {
|
210
|
+
$(this).remove();
|
211
|
+
});
|
212
|
+
}
|
213
|
+
|
214
|
+
// Layout Cleaning
|
215
|
+
$.notyRenderer.setLayoutCountFor(self, -1);
|
216
|
+
if($.notyRenderer.getLayoutCountFor(self) == 0) $(self.options.layout.container.selector).remove();
|
217
|
+
|
218
|
+
// Make sure self.$bar has not been removed before attempting to remove it
|
219
|
+
if(typeof self.$bar !== 'undefined' && self.$bar !== null) {
|
220
|
+
self.$bar.remove();
|
221
|
+
self.$bar = null;
|
222
|
+
self.closed = true;
|
223
|
+
}
|
224
|
+
|
225
|
+
delete $.noty.store[self.options.id]; // deleting noty from store
|
226
|
+
|
227
|
+
if(self.options.theme.callback && self.options.theme.callback.onClose) {
|
228
|
+
self.options.theme.callback.onClose.apply(self);
|
229
|
+
}
|
230
|
+
|
231
|
+
if(!self.options.dismissQueue) {
|
232
|
+
// Queue render
|
233
|
+
$.noty.ontap = true;
|
234
|
+
|
235
|
+
$.notyRenderer.render();
|
236
|
+
}
|
237
|
+
|
238
|
+
if(self.options.maxVisible > 0 && self.options.dismissQueue) {
|
239
|
+
$.notyRenderer.render();
|
240
|
+
}
|
241
|
+
})
|
242
|
+
|
243
|
+
}, // end close
|
244
|
+
|
245
|
+
setText: function(text) {
|
246
|
+
if(!this.closed) {
|
247
|
+
this.options.text = text;
|
248
|
+
this.$bar.find('.noty_text').html(text);
|
249
|
+
}
|
250
|
+
return this;
|
251
|
+
},
|
252
|
+
|
253
|
+
setType: function(type) {
|
254
|
+
if(!this.closed) {
|
255
|
+
this.options.type = type;
|
256
|
+
this.options.theme.style.apply(this);
|
257
|
+
this.options.theme.callback.onShow.apply(this);
|
258
|
+
}
|
259
|
+
return this;
|
260
|
+
},
|
261
|
+
|
262
|
+
setTimeout: function(time) {
|
263
|
+
if(!this.closed) {
|
264
|
+
var self = this;
|
265
|
+
this.options.timeout = time;
|
266
|
+
self.$bar.delay(self.options.timeout).promise().done(function() {
|
267
|
+
self.close();
|
268
|
+
});
|
269
|
+
}
|
270
|
+
return this;
|
271
|
+
},
|
272
|
+
|
273
|
+
stopPropagation: function(evt) {
|
274
|
+
evt = evt || window.event;
|
275
|
+
if(typeof evt.stopPropagation !== "undefined") {
|
276
|
+
evt.stopPropagation();
|
277
|
+
}
|
278
|
+
else {
|
279
|
+
evt.cancelBubble = true;
|
280
|
+
}
|
281
|
+
},
|
282
|
+
|
283
|
+
closed : false,
|
284
|
+
showing: false,
|
285
|
+
shown : false
|
286
|
+
|
287
|
+
}; // end NotyObject
|
288
|
+
|
289
|
+
$.notyRenderer = {};
|
290
|
+
|
291
|
+
$.notyRenderer.init = function(options) {
|
292
|
+
|
293
|
+
// Renderer creates a new noty
|
294
|
+
var notification = Object.create(NotyObject).init(options);
|
295
|
+
|
296
|
+
if(notification.options.killer)
|
297
|
+
$.noty.closeAll();
|
298
|
+
|
299
|
+
(notification.options.force) ? $.noty.queue.unshift(notification) : $.noty.queue.push(notification);
|
300
|
+
|
301
|
+
$.notyRenderer.render();
|
302
|
+
|
303
|
+
return ($.noty.returns == 'object') ? notification : notification.options.id;
|
304
|
+
};
|
305
|
+
|
306
|
+
$.notyRenderer.render = function() {
|
307
|
+
|
308
|
+
var instance = $.noty.queue[0];
|
309
|
+
|
310
|
+
if($.type(instance) === 'object') {
|
311
|
+
if(instance.options.dismissQueue) {
|
312
|
+
if(instance.options.maxVisible > 0) {
|
313
|
+
if($(instance.options.layout.container.selector + ' li').length < instance.options.maxVisible) {
|
314
|
+
$.notyRenderer.show($.noty.queue.shift());
|
315
|
+
}
|
316
|
+
else {
|
317
|
+
|
318
|
+
}
|
319
|
+
}
|
320
|
+
else {
|
321
|
+
$.notyRenderer.show($.noty.queue.shift());
|
322
|
+
}
|
323
|
+
}
|
324
|
+
else {
|
325
|
+
if($.noty.ontap) {
|
326
|
+
$.notyRenderer.show($.noty.queue.shift());
|
327
|
+
$.noty.ontap = false;
|
328
|
+
}
|
329
|
+
}
|
330
|
+
}
|
331
|
+
else {
|
332
|
+
$.noty.ontap = true; // Queue is over
|
333
|
+
}
|
334
|
+
|
335
|
+
};
|
336
|
+
|
337
|
+
$.notyRenderer.show = function(notification) {
|
338
|
+
|
339
|
+
if(notification.options.modal) {
|
340
|
+
$.notyRenderer.createModalFor(notification);
|
341
|
+
$.notyRenderer.setModalCount(+1);
|
342
|
+
}
|
343
|
+
|
344
|
+
// Where is the container?
|
345
|
+
if(notification.options.custom) {
|
346
|
+
if(notification.options.custom.find(notification.options.layout.container.selector).length == 0) {
|
347
|
+
notification.options.custom.append($(notification.options.layout.container.object).addClass('i-am-new'));
|
348
|
+
}
|
349
|
+
else {
|
350
|
+
notification.options.custom.find(notification.options.layout.container.selector).removeClass('i-am-new');
|
351
|
+
}
|
352
|
+
}
|
353
|
+
else {
|
354
|
+
if($(notification.options.layout.container.selector).length == 0) {
|
355
|
+
$('body').append($(notification.options.layout.container.object).addClass('i-am-new'));
|
356
|
+
}
|
357
|
+
else {
|
358
|
+
$(notification.options.layout.container.selector).removeClass('i-am-new');
|
359
|
+
}
|
360
|
+
}
|
361
|
+
|
362
|
+
$.notyRenderer.setLayoutCountFor(notification, +1);
|
363
|
+
|
364
|
+
notification.show();
|
365
|
+
};
|
366
|
+
|
367
|
+
$.notyRenderer.createModalFor = function(notification) {
|
368
|
+
if($('.noty_modal').length == 0) {
|
369
|
+
var modal = $('<div/>').addClass('noty_modal').addClass(notification.options.theme).data('noty_modal_count', 0);
|
370
|
+
|
371
|
+
if(notification.options.theme.modal && notification.options.theme.modal.css)
|
372
|
+
modal.css(notification.options.theme.modal.css);
|
373
|
+
|
374
|
+
modal.prependTo($('body')).fadeIn('fast');
|
375
|
+
|
376
|
+
if($.inArray('backdrop', notification.options.closeWith) > -1)
|
377
|
+
modal.on('click', function(e) {
|
378
|
+
$.noty.closeAll();
|
379
|
+
});
|
380
|
+
}
|
381
|
+
};
|
382
|
+
|
383
|
+
$.notyRenderer.getLayoutCountFor = function(notification) {
|
384
|
+
return $(notification.options.layout.container.selector).data('noty_layout_count') || 0;
|
385
|
+
};
|
386
|
+
|
387
|
+
$.notyRenderer.setLayoutCountFor = function(notification, arg) {
|
388
|
+
return $(notification.options.layout.container.selector).data('noty_layout_count', $.notyRenderer.getLayoutCountFor(notification) + arg);
|
389
|
+
};
|
390
|
+
|
391
|
+
$.notyRenderer.getModalCount = function() {
|
392
|
+
return $('.noty_modal').data('noty_modal_count') || 0;
|
393
|
+
};
|
394
|
+
|
395
|
+
$.notyRenderer.setModalCount = function(arg) {
|
396
|
+
return $('.noty_modal').data('noty_modal_count', $.notyRenderer.getModalCount() + arg);
|
397
|
+
};
|
398
|
+
|
399
|
+
// This is for custom container
|
400
|
+
$.fn.noty = function(options) {
|
401
|
+
options.custom = $(this);
|
402
|
+
return $.notyRenderer.init(options);
|
403
|
+
};
|
404
|
+
|
405
|
+
$.noty = {};
|
406
|
+
$.noty.queue = [];
|
407
|
+
$.noty.ontap = true;
|
408
|
+
$.noty.layouts = {};
|
409
|
+
$.noty.themes = {};
|
410
|
+
$.noty.returns = 'object';
|
411
|
+
$.noty.store = {};
|
412
|
+
|
413
|
+
$.noty.get = function(id) {
|
414
|
+
return $.noty.store.hasOwnProperty(id) ? $.noty.store[id] : false;
|
415
|
+
};
|
416
|
+
|
417
|
+
$.noty.close = function(id) {
|
418
|
+
return $.noty.get(id) ? $.noty.get(id).close() : false;
|
419
|
+
};
|
420
|
+
|
421
|
+
$.noty.setText = function(id, text) {
|
422
|
+
return $.noty.get(id) ? $.noty.get(id).setText(text) : false;
|
423
|
+
};
|
424
|
+
|
425
|
+
$.noty.setType = function(id, type) {
|
426
|
+
return $.noty.get(id) ? $.noty.get(id).setType(type) : false;
|
427
|
+
};
|
428
|
+
|
429
|
+
$.noty.clearQueue = function() {
|
430
|
+
$.noty.queue = [];
|
431
|
+
};
|
432
|
+
|
433
|
+
$.noty.closeAll = function() {
|
434
|
+
$.noty.clearQueue();
|
435
|
+
$.each($.noty.store, function(id, noty) {
|
436
|
+
noty.close();
|
437
|
+
});
|
438
|
+
};
|
439
|
+
|
440
|
+
var windowAlert = window.alert;
|
441
|
+
|
442
|
+
$.noty.consumeAlert = function(options) {
|
443
|
+
window.alert = function(text) {
|
444
|
+
if(options)
|
445
|
+
options.text = text;
|
446
|
+
else
|
447
|
+
options = {text: text};
|
448
|
+
|
449
|
+
$.notyRenderer.init(options);
|
450
|
+
};
|
451
|
+
};
|
452
|
+
|
453
|
+
$.noty.stopConsumeAlert = function() {
|
454
|
+
window.alert = windowAlert;
|
455
|
+
};
|
456
|
+
|
457
|
+
$.noty.defaults = {
|
458
|
+
layout : 'top',
|
459
|
+
theme : 'defaultTheme',
|
460
|
+
type : 'alert',
|
461
|
+
text : '',
|
462
|
+
dismissQueue: true,
|
463
|
+
template : '<div class="noty_message"><span class="noty_text"></span><div class="noty_close"></div></div>',
|
464
|
+
animation : {
|
465
|
+
open : {opacity: 'toggle'},
|
466
|
+
close : {height: 'toggle'},
|
467
|
+
easing: 'linear',
|
468
|
+
speed : 100
|
469
|
+
},
|
470
|
+
timeout : false,
|
471
|
+
force : false,
|
472
|
+
modal : false,
|
473
|
+
maxVisible : 5,
|
474
|
+
killer : false,
|
475
|
+
closeWith : ['click'],
|
476
|
+
callback : {
|
477
|
+
onShow : function() {
|
478
|
+
},
|
479
|
+
afterShow : function() {
|
480
|
+
},
|
481
|
+
onClose : function() {
|
482
|
+
},
|
483
|
+
afterClose : function() {
|
484
|
+
},
|
485
|
+
onCloseClick: function() {
|
486
|
+
}
|
487
|
+
},
|
488
|
+
buttons : false
|
489
|
+
};
|
490
|
+
|
491
|
+
$(window).on('resize', function() {
|
492
|
+
$.each($.noty.layouts, function(index, layout) {
|
493
|
+
layout.container.style.apply($(layout.container.selector));
|
494
|
+
});
|
495
|
+
});
|
496
|
+
|
497
|
+
})(jQuery);
|
498
|
+
|
499
|
+
// Helpers
|
500
|
+
window.noty = function noty(options) {
|
501
|
+
return jQuery.notyRenderer.init(options);
|
502
|
+
};
|