izimodal 1.2.0 → 1.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/izimodal/version.rb +1 -1
- data/vendor/assets/javascripts/iziModal.js +670 -239
- data/vendor/assets/stylesheets/iziModal.css +672 -98
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: faff0444533a06c88d606685821ef554f5cd4ba0
|
4
|
+
data.tar.gz: 900dfa5d9192d9c87f25c3948720cb146f633ded
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9f2fc417ff60a8e97974486d91f4b54b8d711297ceb46d7055094b47c6b120a0ac652a894bf9762ebb95fb30f78f12da8ccd70e594a93fd336fa47269fea14ca
|
7
|
+
data.tar.gz: 8fb9d8f91e7117d1754cbfa2e93af3099b087ef3487dd065d8c3d7eb48fb56fe865332ea4ccb27949de90a09b401e23db66f953ce3a7005cad92353e8d86fdbd
|
data/lib/izimodal/version.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
/*
|
2
|
-
* iziModal | v1.2
|
2
|
+
* iziModal | v1.3.2
|
3
3
|
* http://izimodal.marcelodolce.com
|
4
4
|
* by Marcelo Dolce.
|
5
5
|
*/
|
@@ -7,6 +7,9 @@
|
|
7
7
|
|
8
8
|
"use strict";
|
9
9
|
|
10
|
+
var $window = $(window);
|
11
|
+
var $document = $(document);
|
12
|
+
|
10
13
|
var PLUGIN_NAME = 'iziModal';
|
11
14
|
|
12
15
|
var STATES = {
|
@@ -34,11 +37,8 @@
|
|
34
37
|
}
|
35
38
|
}
|
36
39
|
var animationEvent = whichAnimationEvent();
|
37
|
-
|
38
|
-
var
|
39
|
-
if (/Mobi/.test(navigator.userAgent)) {
|
40
|
-
isMobile = true;
|
41
|
-
}
|
40
|
+
var isMobile = (/Mobi/.test(navigator.userAgent)) ? true : false;
|
41
|
+
var autoOpenModal = 0;
|
42
42
|
|
43
43
|
var iziModal = function (element, options) {
|
44
44
|
this.init(element, options);
|
@@ -54,44 +54,65 @@
|
|
54
54
|
|
55
55
|
this.$element = $(element);
|
56
56
|
this.id = this.$element.attr('id');
|
57
|
+
this.content = this.$element.html();
|
57
58
|
this.state = STATES.CLOSED;
|
58
59
|
this.options = options;
|
60
|
+
this.width = 0;
|
59
61
|
this.timer = null;
|
60
62
|
this.timerTimeout = null;
|
63
|
+
this.progressBar = null;
|
64
|
+
this.isPaused = false;
|
61
65
|
this.isFullscreen = false;
|
62
66
|
this.headerHeight = 0;
|
63
|
-
|
67
|
+
this.modalHeight = 0;
|
64
68
|
this.$overlay = $('<div class="'+PLUGIN_NAME+'-overlay" style="background-color:'+options.overlayColor+'"></div>');
|
69
|
+
this.$navigate = $('<div class="'+PLUGIN_NAME+'-navigate"><div class="'+PLUGIN_NAME+'-navigate-caption">Use</div><button class="'+PLUGIN_NAME+'-navigate-prev"></button><button class="'+PLUGIN_NAME+'-navigate-next"></button></div>');
|
70
|
+
this.group = {
|
71
|
+
name: this.$element.attr('data-'+PLUGIN_NAME+'-group'),
|
72
|
+
index: null,
|
73
|
+
ids: []
|
74
|
+
};
|
75
|
+
if(this.group.name === undefined && options.group !== ""){
|
76
|
+
this.group.name = options.group;
|
77
|
+
this.$element.attr('data-'+PLUGIN_NAME+'-group', options.group);
|
78
|
+
}
|
79
|
+
if(this.$element.attr('data-'+PLUGIN_NAME+'-title') !== undefined){
|
80
|
+
options.title = this.$element.attr('data-'+PLUGIN_NAME+'-title');
|
81
|
+
}
|
82
|
+
if(this.$element.attr('data-'+PLUGIN_NAME+'-subtitle') !== undefined){
|
83
|
+
options.subtitle = this.$element.attr('data-'+PLUGIN_NAME+'-subtitle');
|
84
|
+
}
|
85
|
+
if(this.$element.attr('data-'+PLUGIN_NAME+'-icon') !== undefined){
|
86
|
+
options.icon = this.$element.attr('data-'+PLUGIN_NAME+'-icon');
|
87
|
+
}
|
88
|
+
if(this.options.loop === true){
|
89
|
+
this.$element.attr('data-'+PLUGIN_NAME+'-loop', true);
|
90
|
+
}
|
65
91
|
|
92
|
+
this.$header = $('<div class="'+PLUGIN_NAME+'-header"><h2 class="'+PLUGIN_NAME+'-header-title">' + options.title + '</h2><p class="'+PLUGIN_NAME+'-header-subtitle">' + options.subtitle + '</p><a href="javascript:void(0)" class="'+PLUGIN_NAME+'-button '+PLUGIN_NAME+'-button-close" data-'+PLUGIN_NAME+'-close></a></div>');
|
93
|
+
|
66
94
|
if (options.fullscreen === true) {
|
67
95
|
this.$header.append('<a href="javascript:void(0)" class="'+PLUGIN_NAME+'-button '+PLUGIN_NAME+'-button-fullscreen" data-'+PLUGIN_NAME+'-fullscreen></a>');
|
68
96
|
this.$header.css('padding-right', '76px');
|
69
97
|
}
|
70
98
|
|
71
|
-
if (options.timeoutProgressbar === true && !isNaN(options.timeout) && options.timeout !== false && options.timeout !== 0) {
|
99
|
+
if (options.timeoutProgressbar === true && !isNaN(parseInt(options.timeout)) && options.timeout !== false && options.timeout !== 0) {
|
72
100
|
this.$header.prepend('<div class="'+PLUGIN_NAME+'-progressbar"><div style="background-color:'+options.timeoutProgressbarColor+'"></div></div>');
|
73
101
|
}
|
74
102
|
|
75
|
-
if (options.subtitle === '') {
|
76
|
-
this.$header.addClass(PLUGIN_NAME+'-noSubtitle');
|
77
|
-
}
|
78
|
-
|
79
103
|
if (options.iframe === true) {
|
80
|
-
this.$element.html('<div class="'+PLUGIN_NAME+'-wrap"><div class="'+PLUGIN_NAME+'-content
|
104
|
+
this.$element.html('<div class="'+PLUGIN_NAME+'-wrap"><div class="'+PLUGIN_NAME+'-content"><iframe class="'+PLUGIN_NAME+'-iframe"></iframe>' + this.content + "</div></div>");
|
81
105
|
|
82
106
|
if (options.iframeHeight !== null) {
|
83
107
|
this.$element.find('.'+PLUGIN_NAME+'-iframe').css('height', options.iframeHeight);
|
84
108
|
}
|
85
|
-
|
86
109
|
} else {
|
87
|
-
this.$element.html('<div class="'+PLUGIN_NAME+'-wrap"><div class="'+PLUGIN_NAME+'-content">' + this
|
110
|
+
this.$element.html('<div class="'+PLUGIN_NAME+'-wrap"><div class="'+PLUGIN_NAME+'-content">' + this.content + '</div></div>');
|
88
111
|
}
|
89
|
-
|
90
|
-
$(document.body).find('style[rel='+this.id+']').remove();
|
91
|
-
|
92
|
-
if(typeof options.padding !== 'undefined' || options.padding !== 0)
|
93
|
-
this.$element.find('.'+PLUGIN_NAME+'-content').css('padding', options.padding);
|
94
112
|
|
113
|
+
if (options.subtitle === '') {
|
114
|
+
this.$header.addClass(PLUGIN_NAME+'-noSubtitle');
|
115
|
+
}
|
95
116
|
|
96
117
|
if (options.title !== "" || options.subtitle !== "") {
|
97
118
|
|
@@ -99,66 +120,105 @@
|
|
99
120
|
this.$element.css('border-bottom', '3px solid ' + options.headerColor + '');
|
100
121
|
this.$header.css('background', this.options.headerColor);
|
101
122
|
}
|
102
|
-
if (options.
|
103
|
-
this.$header.prepend('<i class="'+PLUGIN_NAME+'-header-icon ' + options.
|
104
|
-
this.$header.find(
|
123
|
+
if (options.icon !== null) {
|
124
|
+
this.$header.prepend('<i class="'+PLUGIN_NAME+'-header-icon ' + options.icon + '"></i>');
|
125
|
+
this.$header.find('.'+PLUGIN_NAME+'-header-icon').css('color', options.iconColor);
|
105
126
|
}
|
106
|
-
this.$element.prepend(this.$header);
|
127
|
+
this.$element.css('overflow', 'hidden').prepend(this.$header);
|
107
128
|
}
|
108
129
|
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
wClear = String(wClear).split(",")[0];
|
114
|
-
|
115
|
-
if(isNaN(options.width)){
|
116
|
-
if( String(options.width).indexOf("%") != -1){
|
117
|
-
medida = "%";
|
118
|
-
} else {
|
119
|
-
medida = w.slice("-2");
|
120
|
-
}
|
130
|
+
if(options.zindex !== null && !isNaN(parseInt(options.zindex)) ){
|
131
|
+
this.$element.css('z-index', options.zindex);
|
132
|
+
this.$navigate.css('z-index', options.zindex-1);
|
133
|
+
this.$overlay.css('z-index', options.zindex-2);
|
121
134
|
}
|
122
135
|
|
123
|
-
|
124
|
-
'
|
125
|
-
|
126
|
-
|
136
|
+
if(options.radius !== ""){
|
137
|
+
this.$element.css('border-radius', options.radius);
|
138
|
+
}
|
139
|
+
|
140
|
+
if(options.padding !== ""){
|
141
|
+
this.$element.find('.'+PLUGIN_NAME+'-content').css('padding', options.padding);
|
142
|
+
}
|
127
143
|
|
128
|
-
|
129
|
-
|
144
|
+
if(options.theme !== ""){
|
145
|
+
this.$element.addClass(options.theme);
|
146
|
+
}
|
130
147
|
|
131
|
-
this.$element.addClass(PLUGIN_NAME
|
148
|
+
this.$element.addClass(PLUGIN_NAME);
|
132
149
|
|
133
150
|
if(options.openFullscreen === true){
|
134
|
-
|
135
|
-
|
151
|
+
this.isFullscreen = true;
|
152
|
+
this.$element.addClass('isFullscreen');
|
136
153
|
}
|
137
154
|
|
138
|
-
|
139
|
-
|
155
|
+
if(options.attached === 'top' || this.$element.attr('data-'+PLUGIN_NAME+'-attached') == 'top' ){
|
156
|
+
this.$element.addClass('isAttachedTop');
|
157
|
+
}
|
140
158
|
|
141
|
-
|
142
|
-
|
143
|
-
|
159
|
+
if(options.attached === 'bottom' || this.$element.attr('data-'+PLUGIN_NAME+'-attached') == 'bottom'){
|
160
|
+
this.$element.addClass('isAttachedBottom');
|
161
|
+
}
|
144
162
|
|
145
|
-
|
146
|
-
this.$element.on('click', '[data-'+PLUGIN_NAME+'-close]', function (e) {
|
147
|
-
e.preventDefault();
|
148
|
-
that.close();
|
149
|
-
});
|
163
|
+
(function setPositioning(){
|
150
164
|
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
165
|
+
$(document.body).find('style[rel='+that.id+']').remove();
|
166
|
+
|
167
|
+
var separators = /%|px|em|cm/,
|
168
|
+
wClear = String(options.width).split(separators),
|
169
|
+
w = String(options.width),
|
170
|
+
medida = "px";
|
171
|
+
wClear = String(wClear).split(",")[0];
|
172
|
+
|
173
|
+
|
174
|
+
if(isNaN(options.width)){
|
175
|
+
|
176
|
+
if( String(options.width).indexOf("%") != -1){
|
177
|
+
medida = "%";
|
178
|
+
} else {
|
179
|
+
medida = w.slice("-2");
|
180
|
+
}
|
181
|
+
}
|
182
|
+
that.$element.css({
|
183
|
+
'margin-left': -(wClear / 2) + medida,
|
184
|
+
'max-width': parseInt(wClear) + medida
|
185
|
+
});
|
186
|
+
|
187
|
+
that.width = that.$element.outerWidth();
|
188
|
+
|
189
|
+
that.mediaQueries = '<style rel="' + that.id + '">@media handheld, only screen and (max-width: ' + that.width + 'px) { #' + that.id + '{ width: 100% !important; max-width: 100% !important; margin-left: 0 !important; left: 0 !important; border-radius:0!important} #' + that.id + ' .'+PLUGIN_NAME+'-header{border-radius:0!important} }</style>';
|
190
|
+
|
191
|
+
$(document.body).append(that.mediaQueries);
|
192
|
+
|
193
|
+
// Adjusting vertical positioning
|
194
|
+
that.$element.css('margin-top', parseInt(-(that.$element.innerHeight() / 2)) + 'px');
|
195
|
+
})();
|
196
|
+
},
|
197
|
+
|
198
|
+
setGroup: function(groupName){
|
199
|
+
|
200
|
+
var that = this,
|
201
|
+
group = this.group.name || groupName;
|
202
|
+
this.group.ids = [];
|
203
|
+
|
204
|
+
if( groupName !== undefined && groupName !== this.group.name){
|
205
|
+
group = groupName;
|
206
|
+
this.group.name = group;
|
207
|
+
this.$element.attr('data-'+PLUGIN_NAME+'-group', group);
|
208
|
+
}
|
209
|
+
if(group !== undefined && group !== ""){
|
210
|
+
|
211
|
+
var count = 0;
|
212
|
+
$.each( $('.'+PLUGIN_NAME+'[data-'+PLUGIN_NAME+'-group='+group+']') , function(index, val) {
|
213
|
+
|
214
|
+
that.group.ids.push($(this).attr('id'));
|
215
|
+
|
216
|
+
if(that.id == $(this).attr('id')){
|
217
|
+
that.group.index = count;
|
218
|
+
}
|
219
|
+
count++;
|
220
|
+
});
|
221
|
+
}
|
162
222
|
},
|
163
223
|
|
164
224
|
toggle: function () {
|
@@ -176,154 +236,270 @@
|
|
176
236
|
|
177
237
|
var that = this;
|
178
238
|
|
179
|
-
|
180
|
-
|
181
|
-
|
239
|
+
function opened(){
|
240
|
+
|
241
|
+
// console.info('[ '+PLUGIN_NAME+' | '+that.id+' ] Opened.');
|
182
242
|
|
183
|
-
|
243
|
+
that.$element.trigger(STATES.OPENED);
|
244
|
+
that.state = STATES.OPENED;
|
245
|
+
if (that.options.onOpened && typeof(that.options.onOpened) === "function") {
|
246
|
+
that.options.onOpened(that);
|
247
|
+
}
|
248
|
+
}
|
184
249
|
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
250
|
+
function bindEvents(){
|
251
|
+
|
252
|
+
// Close when button pressed
|
253
|
+
that.$element.off('click', '[data-'+PLUGIN_NAME+'-close]').on('click', '[data-'+PLUGIN_NAME+'-close]', function (e) {
|
254
|
+
e.preventDefault();
|
255
|
+
|
256
|
+
var transition = $(e.currentTarget).attr('data-'+PLUGIN_NAME+'-transitionOut');
|
257
|
+
|
258
|
+
if(transition !== undefined){
|
259
|
+
that.close({transition:transition});
|
260
|
+
} else {
|
261
|
+
that.close();
|
262
|
+
}
|
263
|
+
});
|
264
|
+
|
265
|
+
// Expand when button pressed
|
266
|
+
that.$element.off('click', '[data-'+PLUGIN_NAME+'-fullscreen]').on('click', '[data-'+PLUGIN_NAME+'-fullscreen]', function (e) {
|
267
|
+
e.preventDefault();
|
268
|
+
if(that.isFullscreen === true){
|
269
|
+
that.isFullscreen = false;
|
270
|
+
that.$element.removeClass('isFullscreen');
|
271
|
+
} else {
|
272
|
+
that.isFullscreen = true;
|
273
|
+
that.$element.addClass('isFullscreen');
|
274
|
+
}
|
275
|
+
if (that.options.onFullscreen && typeof(that.options.onFullscreen) === "function") {
|
276
|
+
that.options.onFullscreen(that);
|
277
|
+
}
|
278
|
+
that.$element.trigger('fullscreen', that);
|
279
|
+
});
|
280
|
+
|
281
|
+
// Next modal
|
282
|
+
that.$navigate.off('click', '.'+PLUGIN_NAME+'-navigate-next').on('click', '.'+PLUGIN_NAME+'-navigate-next', function (e) {
|
283
|
+
that.next(e);
|
284
|
+
});
|
285
|
+
that.$element.off('click', '[data-'+PLUGIN_NAME+'-next]').on('click', '[data-'+PLUGIN_NAME+'-next]', function (e) {
|
286
|
+
that.next(e);
|
287
|
+
});
|
288
|
+
|
289
|
+
// Previous modal
|
290
|
+
that.$navigate.off('click', '.'+PLUGIN_NAME+'-navigate-prev').on('click', '.'+PLUGIN_NAME+'-navigate-prev', function (e) {
|
291
|
+
that.prev(e);
|
292
|
+
});
|
293
|
+
that.$element.off('click', '[data-'+PLUGIN_NAME+'-prev]').on('click', '[data-'+PLUGIN_NAME+'-prev]', function (e) {
|
294
|
+
that.prev(e);
|
295
|
+
});
|
296
|
+
}
|
297
|
+
|
298
|
+
if(this.state == STATES.CLOSED){
|
299
|
+
|
300
|
+
bindEvents();
|
301
|
+
|
302
|
+
this.$element.trigger(STATES.OPENING);
|
303
|
+
this.state = STATES.OPENING;
|
304
|
+
this.setGroup();
|
305
|
+
|
306
|
+
// console.info('[ '+PLUGIN_NAME+' | '+this.id+' ] Opening...');
|
307
|
+
|
308
|
+
if(this.options.iframe === true){
|
309
|
+
|
310
|
+
this.$element.find('.'+PLUGIN_NAME+'-content').addClass(PLUGIN_NAME+'-content-loader');
|
311
|
+
|
312
|
+
this.$element.find('.'+PLUGIN_NAME+'-iframe').on('load', function(){
|
313
|
+
$(this).parent().removeClass(PLUGIN_NAME+'-content-loader');
|
314
|
+
});
|
315
|
+
|
316
|
+
var href = null;
|
189
317
|
try {
|
190
|
-
href = param.
|
191
|
-
if(href !== undefined){
|
192
|
-
href = param.target.href;
|
193
|
-
}
|
318
|
+
href = $(param.currentTarget).attr('href') !== "" ? $(param.currentTarget).attr('href') : null;
|
194
319
|
} catch(e) {
|
195
320
|
console.warn(e);
|
196
321
|
}
|
322
|
+
if( (this.options.iframeURL !== null) && (href === null || href === undefined)){
|
323
|
+
href = this.options.iframeURL;
|
324
|
+
}
|
325
|
+
if(href === null || href === undefined){
|
326
|
+
alert("Failed to find iframe URL.");
|
327
|
+
}
|
328
|
+
this.$element.find('.'+PLUGIN_NAME+'-iframe').attr('src', href);
|
197
329
|
}
|
198
|
-
this.$element.find('.'+PLUGIN_NAME+'-iframe').attr('src', href);
|
199
|
-
}
|
200
|
-
|
201
|
-
this.$element.trigger(STATES.OPENING);
|
202
|
-
this.state = STATES.OPENING;
|
203
330
|
|
204
|
-
|
331
|
+
if (this.options.bodyOverflow || isMobile){
|
332
|
+
$(document.body).css('overflow', 'hidden');
|
333
|
+
}
|
205
334
|
|
206
|
-
|
207
|
-
|
208
|
-
|
335
|
+
if (that.options.onOpening && typeof(that.options.onOpening) === "function") {
|
336
|
+
that.options.onOpening(this);
|
337
|
+
}
|
338
|
+
(function open(){
|
209
339
|
|
210
|
-
|
211
|
-
that.options.onOpening(this);
|
212
|
-
}
|
340
|
+
if(that.group.ids.length > 1 ){
|
213
341
|
|
214
|
-
|
215
|
-
|
216
|
-
that.state = STATES.OPENED;
|
342
|
+
that.$navigate.appendTo('body');
|
343
|
+
that.$navigate.addClass(that.options.transitionInOverlay);
|
217
344
|
|
218
|
-
|
345
|
+
if(that.options.navigateCaption === true){
|
346
|
+
that.$navigate.find('.'+PLUGIN_NAME+'-navigate-caption').show();
|
347
|
+
}
|
219
348
|
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
349
|
+
if(that.options.navigateArrows === true || that.options.navigateArrows === 'closeToModal'){
|
350
|
+
that.$navigate.find('.'+PLUGIN_NAME+'-navigate-prev').css('margin-left', -((that.width/2)+84));
|
351
|
+
that.$navigate.find('.'+PLUGIN_NAME+'-navigate-next').css('margin-right', -((that.width/2)+84));
|
352
|
+
} else {
|
353
|
+
that.$navigate.find('.'+PLUGIN_NAME+'-navigate-prev').css('left', 0);
|
354
|
+
that.$navigate.find('.'+PLUGIN_NAME+'-navigate-next').css('right', 0);
|
355
|
+
}
|
356
|
+
|
357
|
+
var loop;
|
358
|
+
if(that.group.index === 0){
|
224
359
|
|
225
|
-
|
360
|
+
loop = $('.'+PLUGIN_NAME+'[data-'+PLUGIN_NAME+'-group="'+that.group.name+'"][data-'+PLUGIN_NAME+'-loop]').length;
|
226
361
|
|
227
|
-
|
228
|
-
|
229
|
-
|
362
|
+
if(loop === 0 && that.options.loop === false)
|
363
|
+
that.$navigate.find('.'+PLUGIN_NAME+'-navigate-prev').hide();
|
364
|
+
}
|
365
|
+
if(that.group.index+1 === that.group.ids.length){
|
230
366
|
|
231
|
-
|
367
|
+
loop = $('.'+PLUGIN_NAME+'[data-'+PLUGIN_NAME+'-group="'+that.group.name+'"][data-'+PLUGIN_NAME+'-loop]').length;
|
232
368
|
|
233
|
-
|
369
|
+
if(loop === 0 && that.options.loop === false)
|
370
|
+
that.$navigate.find('.'+PLUGIN_NAME+'-navigate-next').hide();
|
371
|
+
}
|
372
|
+
}
|
234
373
|
|
235
|
-
|
374
|
+
if(that.options.overlay === true){
|
375
|
+
that.$overlay.appendTo('body');
|
376
|
+
}
|
236
377
|
|
237
|
-
|
238
|
-
|
378
|
+
if (that.options.transitionInOverlay) {
|
379
|
+
that.$overlay.addClass(that.options.transitionInOverlay);
|
380
|
+
}
|
239
381
|
|
240
|
-
|
241
|
-
});
|
382
|
+
var transitionIn = that.options.transitionIn;
|
242
383
|
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
384
|
+
if( typeof param == 'object' ){
|
385
|
+
if(param.transition !== undefined || param.transitionIn !== undefined){
|
386
|
+
transitionIn = param.transition || param.transitionIn;
|
387
|
+
}
|
388
|
+
}
|
247
389
|
|
248
|
-
|
249
|
-
|
250
|
-
if (this.options.timeoutProgressbar === true) {
|
251
|
-
|
252
|
-
var progressBar = {
|
253
|
-
hideEta: null,
|
254
|
-
maxHideTime: null,
|
255
|
-
el: this.$element.find('.'+PLUGIN_NAME+'-progressbar > div'),
|
256
|
-
updateProgress: function()
|
257
|
-
{
|
258
|
-
var percentage = ((progressBar.hideEta - (new Date().getTime())) / progressBar.maxHideTime) * 100;
|
259
|
-
progressBar.el.width(percentage + '%');
|
260
|
-
if(percentage < 0){
|
261
|
-
that.close();
|
262
|
-
}
|
263
|
-
}
|
264
|
-
};
|
265
|
-
if (this.options.timeout > 0) {
|
266
|
-
progressBar.maxHideTime = parseFloat(this.options.timeout);
|
267
|
-
progressBar.hideEta = new Date().getTime() + progressBar.maxHideTime;
|
268
|
-
this.timerTimeout = setInterval(progressBar.updateProgress, 10);
|
269
|
-
}
|
390
|
+
if (transitionIn !== '') {
|
270
391
|
|
271
|
-
|
392
|
+
that.$element.addClass("transitionIn "+transitionIn).show();
|
393
|
+
that.$element.find('.'+PLUGIN_NAME+'-wrap').one(animationEvent, function () {
|
272
394
|
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
}
|
277
|
-
}
|
395
|
+
that.$element.removeClass(transitionIn + " transitionIn");
|
396
|
+
that.$overlay.removeClass(that.options.transitionInOverlay);
|
397
|
+
that.$navigate.removeClass(that.options.transitionInOverlay);
|
278
398
|
|
279
|
-
|
280
|
-
|
281
|
-
that.$overlay.click(function () {
|
282
|
-
that.close();
|
283
|
-
});
|
284
|
-
}
|
399
|
+
opened();
|
400
|
+
});
|
285
401
|
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
that.recalculateLayout();
|
292
|
-
that.timer = setTimeout(updateTimer, 200);
|
293
|
-
})();
|
402
|
+
} else {
|
403
|
+
that.$element.show();
|
404
|
+
// ver se o overlay tbm será incluído!
|
405
|
+
opened();
|
406
|
+
}
|
294
407
|
|
295
|
-
// Close when the Escape key is pressed
|
296
|
-
$(document).keydown(function (e) {
|
297
|
-
if (that.options.closeOnEscape && e.keyCode === 27) {
|
298
|
-
that.close();
|
299
|
-
}
|
300
|
-
});
|
301
408
|
|
302
|
-
|
409
|
+
if(that.options.pauseOnHover === true && that.options.pauseOnHover === true && that.options.timeout !== false && !isNaN(parseInt(that.options.timeout)) && that.options.timeout !== false && that.options.timeout !== 0){
|
303
410
|
|
304
|
-
|
411
|
+
that.$element.off('mouseenter').on('mouseenter', function(event) {
|
412
|
+
event.preventDefault();
|
413
|
+
that.isPaused = true;
|
414
|
+
});
|
415
|
+
that.$element.off('mouseleave').on('mouseleave', function(event) {
|
416
|
+
event.preventDefault();
|
417
|
+
that.isPaused = false;
|
418
|
+
});
|
419
|
+
}
|
305
420
|
|
306
|
-
|
421
|
+
})();
|
422
|
+
|
423
|
+
|
424
|
+
if (this.options.timeout !== false && !isNaN(parseInt(this.options.timeout)) && this.options.timeout !== false && this.options.timeout !== 0) {
|
425
|
+
|
426
|
+
if (this.options.timeoutProgressbar === true) {
|
427
|
+
|
428
|
+
this.progressBar = {
|
429
|
+
hideEta: null,
|
430
|
+
maxHideTime: null,
|
431
|
+
currentTime: new Date().getTime(),
|
432
|
+
el: this.$element.find('.'+PLUGIN_NAME+'-progressbar > div'),
|
433
|
+
updateProgress: function()
|
434
|
+
{
|
435
|
+
if(!that.isPaused){
|
436
|
+
|
437
|
+
that.progressBar.currentTime = that.progressBar.currentTime+10;
|
438
|
+
|
439
|
+
var percentage = ((that.progressBar.hideEta - (that.progressBar.currentTime)) / that.progressBar.maxHideTime) * 100;
|
440
|
+
that.progressBar.el.width(percentage + '%');
|
441
|
+
if(percentage < 0){
|
442
|
+
that.close();
|
443
|
+
}
|
444
|
+
}
|
445
|
+
}
|
446
|
+
};
|
447
|
+
if (this.options.timeout > 0) {
|
448
|
+
|
449
|
+
this.progressBar.maxHideTime = parseFloat(this.options.timeout);
|
450
|
+
this.progressBar.hideEta = new Date().getTime() + this.progressBar.maxHideTime;
|
451
|
+
this.timerTimeout = setInterval(this.progressBar.updateProgress, 10);
|
452
|
+
}
|
307
453
|
|
308
|
-
|
309
|
-
param(that);
|
310
|
-
}
|
454
|
+
} else {
|
311
455
|
|
312
|
-
|
456
|
+
this.timerTimeout = setTimeout(function(){
|
457
|
+
that.close();
|
458
|
+
}, that.options.timeout);
|
459
|
+
}
|
460
|
+
}
|
313
461
|
|
314
|
-
|
315
|
-
|
316
|
-
|
462
|
+
// Close on overlay click
|
463
|
+
if (this.options.overlayClose && !this.$element.hasClass(this.options.transitionOut)) {
|
464
|
+
this.$overlay.click(function () {
|
465
|
+
that.close();
|
466
|
+
});
|
467
|
+
}
|
317
468
|
|
318
|
-
|
319
|
-
|
469
|
+
if (this.options.focusInput){
|
470
|
+
this.$element.find(':input:not(button):enabled:visible:first').focus(); // Focus on the first field
|
471
|
+
}
|
472
|
+
|
473
|
+
(function updateTimer(){
|
474
|
+
that.recalculateLayout();
|
475
|
+
that.timer = setTimeout(updateTimer, 300);
|
476
|
+
})();
|
477
|
+
|
478
|
+
(function setUrlHash(){
|
479
|
+
if(that.options.history || isMobile){
|
480
|
+
var oldTitle = document.title;
|
481
|
+
document.title = oldTitle + " - " + that.options.title;
|
482
|
+
document.location.hash = that.id;
|
483
|
+
document.title = oldTitle;
|
484
|
+
//history.pushState({}, that.options.title, "#"+that.id);
|
485
|
+
}
|
486
|
+
})();
|
320
487
|
|
321
|
-
|
322
|
-
|
488
|
+
// Close when the Escape key is pressed
|
489
|
+
$document.keydown(function (e) {
|
490
|
+
if (that.options.closeOnEscape && e.keyCode === 27) {
|
491
|
+
that.close();
|
492
|
+
}
|
493
|
+
});
|
323
494
|
}
|
324
495
|
|
325
|
-
|
496
|
+
},
|
497
|
+
|
498
|
+
close: function (param) {
|
326
499
|
|
500
|
+
var that = this;
|
501
|
+
|
502
|
+
function closed(){
|
327
503
|
if (that.options.iframe === true) {
|
328
504
|
that.$element.find('.'+PLUGIN_NAME+'-iframe').attr('src', "");
|
329
505
|
}
|
@@ -342,38 +518,153 @@
|
|
342
518
|
if (that.options.onClosed && typeof(that.options.onClosed) === "function") {
|
343
519
|
that.options.onClosed(that);
|
344
520
|
}
|
521
|
+
|
522
|
+
if(that.options.restoreDefaultContent === true){
|
523
|
+
that.$element.find('.'+PLUGIN_NAME+'-content').html( that.content );
|
524
|
+
}
|
345
525
|
}
|
346
526
|
|
347
|
-
if
|
527
|
+
if(this.state == STATES.OPENED || this.state == STATES.OPENING){
|
528
|
+
|
529
|
+
$document.off("keydown");
|
530
|
+
|
531
|
+
this.state = STATES.CLOSING;
|
532
|
+
this.$element.trigger(STATES.CLOSING);
|
533
|
+
|
534
|
+
// console.info('[ '+PLUGIN_NAME+' | '+this.id+' ] Closing...');
|
535
|
+
|
536
|
+
clearTimeout(this.timer);
|
537
|
+
clearTimeout(this.timerTimeout);
|
538
|
+
|
539
|
+
if (that.options.onClosing && typeof(that.options.onClosing) === "function") {
|
540
|
+
that.options.onClosing(this);
|
541
|
+
}
|
542
|
+
|
543
|
+
var transitionOut = this.options.transitionOut;
|
544
|
+
|
545
|
+
if( typeof param == 'object' ){
|
546
|
+
if(param.transition !== undefined || param.transitionOut !== undefined){
|
547
|
+
transitionOut = param.transition || param.transitionOut;
|
548
|
+
}
|
549
|
+
}
|
348
550
|
|
349
|
-
|
350
|
-
this.$overlay.attr('class', PLUGIN_NAME + "-overlay " + this.options.transitionOutOverlay);
|
551
|
+
if (transitionOut !== '') {
|
351
552
|
|
352
|
-
|
353
|
-
|
354
|
-
|
553
|
+
this.$element.attr('class', PLUGIN_NAME + " transitionOut " + transitionOut + " " + this.options.theme + " " + String((this.isFullscreen === true) ? 'isFullscreen' : '') + " " + String((this.options.attached === 'top') ? 'isAttachedTop' : '') + " " + String((this.options.attached === 'bottom') ? 'isAttachedBottom' : ''));
|
554
|
+
this.$overlay.attr('class', PLUGIN_NAME + "-overlay " + this.options.transitionOutOverlay);
|
555
|
+
this.$navigate.attr('class', PLUGIN_NAME + "-navigate " + this.options.transitionOutOverlay);
|
355
556
|
|
356
|
-
|
557
|
+
this.$element.one(animationEvent, function () {
|
558
|
+
|
559
|
+
if( that.$element.hasClass(transitionOut) ){
|
560
|
+
that.$element.removeClass(transitionOut + " transitionOut").hide();
|
561
|
+
}
|
357
562
|
that.$overlay.removeClass(that.options.transitionOutOverlay).remove();
|
358
|
-
|
563
|
+
that.$navigate.removeClass(that.options.transitionOutOverlay).remove();
|
359
564
|
closed();
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
565
|
+
});
|
566
|
+
}
|
567
|
+
else {
|
568
|
+
this.$element.hide();
|
569
|
+
this.$overlay.remove();
|
570
|
+
this.$navigate.remove();
|
571
|
+
closed();
|
572
|
+
}
|
368
573
|
}
|
369
574
|
},
|
370
575
|
|
576
|
+
next: function (e){
|
577
|
+
|
578
|
+
var that = this;
|
579
|
+
var transitionIn = 'fadeInRight';
|
580
|
+
var transitionOut = 'fadeOutLeft';
|
581
|
+
var modal = $('.'+PLUGIN_NAME+':visible');
|
582
|
+
var modals = {};
|
583
|
+
modals.out = this;
|
584
|
+
|
585
|
+
if(e !== undefined && typeof e !== 'object'){
|
586
|
+
e.preventDefault();
|
587
|
+
modal = $(e.currentTarget);
|
588
|
+
transitionIn = modal.attr('data-'+PLUGIN_NAME+'-transitionIn');
|
589
|
+
transitionOut = modal.attr('data-'+PLUGIN_NAME+'-transitionOut');
|
590
|
+
} else if(e !== undefined){
|
591
|
+
if(e.transitionIn !== undefined){
|
592
|
+
transitionIn = e.transitionIn;
|
593
|
+
}
|
594
|
+
if(e.transitionOut !== undefined){
|
595
|
+
transitionOut = e.transitionOut;
|
596
|
+
}
|
597
|
+
}
|
598
|
+
|
599
|
+
this.close({transition:transitionOut});
|
600
|
+
|
601
|
+
setTimeout(function(){
|
602
|
+
|
603
|
+
var loop = $('.'+PLUGIN_NAME+'[data-'+PLUGIN_NAME+'-group="'+that.group.name+'"][data-'+PLUGIN_NAME+'-loop]').length;
|
604
|
+
|
605
|
+
if((loop > 0 || that.options.loop === true) && (that.group.index+1) === that.group.ids.length){
|
606
|
+
|
607
|
+
$("#"+that.group.ids[0]).iziModal('open', { transition: transitionIn });
|
608
|
+
modals.in = $("#"+that.group.ids[0]).data().iziModal;
|
609
|
+
|
610
|
+
} else if(that.group.index+1 < that.group.ids.length){
|
611
|
+
|
612
|
+
$("#"+that.group.ids[that.group.index+1]).iziModal('open', { transition: transitionIn });
|
613
|
+
modals.in = $("#"+that.group.ids[that.group.index+1]).data().iziModal;
|
614
|
+
}
|
615
|
+
}, 200);
|
616
|
+
|
617
|
+
$(document).trigger( PLUGIN_NAME + "-group-change", modals );
|
618
|
+
},
|
619
|
+
|
620
|
+
prev: function (e){
|
621
|
+
var that = this;
|
622
|
+
var transitionIn = 'fadeInLeft';
|
623
|
+
var transitionOut = 'fadeOutRight';
|
624
|
+
var modal = $('.'+PLUGIN_NAME+':visible');
|
625
|
+
var modals = {};
|
626
|
+
modals.out = this;
|
627
|
+
|
628
|
+
if(e !== undefined && typeof e !== 'object'){
|
629
|
+
e.preventDefault();
|
630
|
+
modal = $(e.currentTarget);
|
631
|
+
transitionIn = modal.attr('data-'+PLUGIN_NAME+'-transitionIn');
|
632
|
+
transitionOut = modal.attr('data-'+PLUGIN_NAME+'-transitionOut');
|
633
|
+
} else if(e !== undefined){
|
634
|
+
if(e.transitionIn !== undefined){
|
635
|
+
transitionIn = e.transitionIn;
|
636
|
+
}
|
637
|
+
if(e.transitionOut !== undefined){
|
638
|
+
transitionOut = e.transitionOut;
|
639
|
+
}
|
640
|
+
}
|
641
|
+
|
642
|
+
this.close({transition:transitionOut});
|
643
|
+
|
644
|
+
setTimeout(function(){
|
645
|
+
var loop = $('.'+PLUGIN_NAME+'[data-'+PLUGIN_NAME+'-group="'+that.group.name+'"][data-'+PLUGIN_NAME+'-loop]').length;
|
646
|
+
|
647
|
+
if( (loop > 0 || that.options.loop === true) && that.group.index === 0){
|
648
|
+
|
649
|
+
$("#"+that.group.ids[that.group.ids.length-1]).iziModal('open', { transition: transitionIn });
|
650
|
+
modals.in = $("#"+that.group.ids[that.group.ids.length-1]).data().iziModal;
|
651
|
+
|
652
|
+
} else if(that.group.index > 0){
|
653
|
+
|
654
|
+
$("#"+that.group.ids[that.group.index-1]).iziModal('open', { transition: transitionIn });
|
655
|
+
modals.in = $("#"+that.group.ids[that.group.index-1]).data().iziModal;
|
656
|
+
}
|
657
|
+
}, 200);
|
658
|
+
|
659
|
+
$(document).trigger( PLUGIN_NAME + "-group-change", modals );
|
660
|
+
},
|
661
|
+
|
371
662
|
destroy: function () {
|
372
663
|
var e = $.Event('destroy');
|
373
664
|
|
374
665
|
this.$element.trigger(e);
|
375
666
|
|
376
|
-
$
|
667
|
+
$document.off("keydown");
|
377
668
|
|
378
669
|
clearTimeout(this.timer);
|
379
670
|
clearTimeout(this.timerTimeout);
|
@@ -383,9 +674,10 @@
|
|
383
674
|
}
|
384
675
|
this.$element.html(this.$element.find('.'+PLUGIN_NAME+'-content').html());
|
385
676
|
|
386
|
-
$
|
677
|
+
$document.find('style[rel='+this.id+']').remove();
|
387
678
|
|
388
679
|
this.$element.off('click', '[data-'+PLUGIN_NAME+'-close]');
|
680
|
+
this.$element.off('click', '[data-'+PLUGIN_NAME+'-fullscreen]');
|
389
681
|
|
390
682
|
this.$element
|
391
683
|
.off('.'+PLUGIN_NAME)
|
@@ -393,23 +685,25 @@
|
|
393
685
|
.attr('style', '');
|
394
686
|
|
395
687
|
this.$overlay.remove();
|
688
|
+
this.$navigate.remove();
|
396
689
|
this.$element.trigger(STATES.DESTROYED);
|
397
690
|
this.$element = null;
|
398
691
|
},
|
399
692
|
|
400
693
|
getState: function(){
|
401
694
|
|
402
|
-
console.info(this.state);
|
403
|
-
|
404
695
|
return this.state;
|
405
696
|
},
|
406
697
|
|
698
|
+
getGroup: function(){
|
699
|
+
|
700
|
+
return this.group;
|
701
|
+
},
|
702
|
+
|
407
703
|
setTitle: function(title){
|
408
704
|
|
409
705
|
if (this.options.title !== null) {
|
410
|
-
|
411
706
|
this.$header.find('.'+PLUGIN_NAME+'-header-title').html(title);
|
412
|
-
|
413
707
|
this.options.title = title;
|
414
708
|
}
|
415
709
|
},
|
@@ -417,33 +711,46 @@
|
|
417
711
|
setSubtitle: function(subtitle){
|
418
712
|
|
419
713
|
if (this.options.subtitle !== null) {
|
420
|
-
|
421
714
|
this.$header.find('.'+PLUGIN_NAME+'-header-subtitle').html(subtitle);
|
422
|
-
|
423
715
|
this.options.subtitle = subtitle;
|
424
716
|
}
|
425
717
|
},
|
426
718
|
|
427
|
-
|
428
|
-
|
429
|
-
if (this.options.iconClass !== null) {
|
430
|
-
|
431
|
-
this.$header.find('.'+PLUGIN_NAME+'-header-icon').attr('class', PLUGIN_NAME+'-header-icon ' + iconClass);
|
719
|
+
setIcon: function(icon){
|
432
720
|
|
433
|
-
|
721
|
+
if (this.options.icon !== null) {
|
722
|
+
this.$header.find('.'+PLUGIN_NAME+'-header-icon').attr('class', PLUGIN_NAME+'-header-icon ' + icon);
|
723
|
+
this.options.icon = icon;
|
434
724
|
}
|
435
725
|
},
|
436
726
|
|
437
727
|
setHeaderColor: function(headerColor){
|
438
728
|
|
439
|
-
|
440
|
-
|
441
|
-
|
729
|
+
this.$element.css('border-bottom', '3px solid ' + headerColor + '');
|
730
|
+
this.$header.css('background', headerColor);
|
731
|
+
this.options.headerColor = headerColor;
|
732
|
+
},
|
733
|
+
|
734
|
+
setZindex: function(zIndex){
|
442
735
|
|
443
|
-
|
736
|
+
if (!isNaN(parseInt(this.options.zindex))) {
|
737
|
+
this.options.zindex = zIndex;
|
738
|
+
this.$element.css('z-index', zIndex);
|
739
|
+
this.$navigate.css('z-index', zIndex-1);
|
740
|
+
this.$overlay.css('z-index', zIndex-2);
|
444
741
|
}
|
445
742
|
},
|
446
743
|
|
744
|
+
setTransitionIn: function(transition){
|
745
|
+
|
746
|
+
this.options.transitionIn = param.transition;
|
747
|
+
},
|
748
|
+
|
749
|
+
setTransitionOut: function(transition){
|
750
|
+
|
751
|
+
this.options.transitionOut = param.transition;
|
752
|
+
},
|
753
|
+
|
447
754
|
startLoading: function(){
|
448
755
|
if( !this.$element.find('.'+PLUGIN_NAME+'-loader').length ){
|
449
756
|
this.$element.append('<div class="'+PLUGIN_NAME+'-loader '+this.options.transitionInOverlay+'"></div>');
|
@@ -465,10 +772,19 @@
|
|
465
772
|
this.$element.css('overflow', 'hidden');
|
466
773
|
}
|
467
774
|
|
468
|
-
|
775
|
+
var windowHeight = $window.height(),
|
776
|
+
modalHeight = this.$element.outerHeight(),
|
469
777
|
contentHeight = this.$element.find('.'+PLUGIN_NAME+'-content')[0].scrollHeight,
|
470
778
|
modalMargin = parseInt(-((this.$element.innerHeight() + 1) / 2)) + 'px';
|
471
779
|
|
780
|
+
if(modalHeight !== this.modalHeight){
|
781
|
+
this.modalHeight = modalHeight;
|
782
|
+
|
783
|
+
if (this.options.onResize && typeof(this.options.onResize) === "function") {
|
784
|
+
this.options.onResize(this);
|
785
|
+
}
|
786
|
+
}
|
787
|
+
|
472
788
|
if(this.state == STATES.OPENED || this.state == STATES.OPENING){
|
473
789
|
|
474
790
|
if (this.options.iframe === true) {
|
@@ -492,13 +808,18 @@
|
|
492
808
|
|
493
809
|
} else {
|
494
810
|
|
495
|
-
if (windowHeight > (contentHeight + this.headerHeight)) {
|
811
|
+
if (windowHeight > (contentHeight + this.headerHeight) && this.isFullscreen !== true) {
|
496
812
|
$(document.body).removeClass(PLUGIN_NAME+'-attached');
|
497
813
|
this.$element.find('.'+PLUGIN_NAME+'-wrap').css({'height': 'auto'});
|
498
814
|
}
|
499
815
|
|
500
|
-
|
501
|
-
|
816
|
+
// subistuido (contentHeight + this.headerHeight) por this.$element.innerHeight()
|
817
|
+
// Se o modal é maior que a altura da janela ou
|
818
|
+
if ((contentHeight + this.headerHeight) > windowHeight || this.$element.innerHeight() < contentHeight || this.isFullscreen === true) {
|
819
|
+
|
820
|
+
if( !$(document.body).hasClass(PLUGIN_NAME+'-attached') ){
|
821
|
+
$(document.body).addClass(PLUGIN_NAME+'-attached');
|
822
|
+
}
|
502
823
|
|
503
824
|
this.$element.find('.'+PLUGIN_NAME+'-wrap').css({
|
504
825
|
'height': parseInt(windowHeight - this.headerHeight) + 'px',
|
@@ -526,55 +847,165 @@
|
|
526
847
|
|
527
848
|
};
|
528
849
|
|
529
|
-
|
530
|
-
|
531
|
-
|
532
|
-
|
533
|
-
|
850
|
+
$window.off('hashchange load').on('hashchange load', function(e) {
|
851
|
+
|
852
|
+
if(autoOpenModal === 0){
|
853
|
+
|
854
|
+
if(document.location.hash !== ""){
|
855
|
+
|
856
|
+
$.each( $('.'+PLUGIN_NAME) , function(index, modal) {
|
857
|
+
var state = $(modal).iziModal('getState');
|
858
|
+
if(state == 'opened' || state == 'opening'){
|
859
|
+
|
860
|
+
if( "#" + $(modal).attr('id') !== document.location.hash){
|
861
|
+
$(modal).iziModal('close');
|
862
|
+
}
|
863
|
+
}
|
864
|
+
});
|
865
|
+
|
866
|
+
setTimeout(function(){
|
867
|
+
$(document.location.hash).iziModal("open");
|
868
|
+
},200);
|
869
|
+
|
870
|
+
} else {
|
871
|
+
|
872
|
+
$.each( $('.'+PLUGIN_NAME) , function(index, modal) {
|
873
|
+
var state = $(modal).iziModal('getState');
|
874
|
+
if(state == 'opened' || state == 'opening'){
|
875
|
+
$(modal).iziModal('close');
|
876
|
+
}
|
877
|
+
});
|
878
|
+
|
879
|
+
}
|
880
|
+
} else {
|
881
|
+
autoOpenModal = 0;
|
882
|
+
}
|
883
|
+
});
|
884
|
+
|
885
|
+
$document.off('click', '[data-'+PLUGIN_NAME+'-open]').on('click', '[data-'+PLUGIN_NAME+'-open]', function(e) {
|
886
|
+
e.preventDefault();
|
887
|
+
|
888
|
+
var modal = $('.'+PLUGIN_NAME+':visible').attr('id');
|
889
|
+
var openModal = $(e.currentTarget).attr('data-'+PLUGIN_NAME+'-open');
|
890
|
+
var transitionIn = $(e.currentTarget).attr('data-'+PLUGIN_NAME+'-transitionIn');
|
891
|
+
var transitionOut = $(e.currentTarget).attr('data-'+PLUGIN_NAME+'-transitionOut');
|
892
|
+
|
893
|
+
if(transitionOut !== undefined){
|
894
|
+
$("#"+modal).iziModal('close', {
|
895
|
+
transition: transitionOut
|
896
|
+
});
|
897
|
+
} else {
|
898
|
+
$("#"+modal).iziModal('close');
|
899
|
+
}
|
900
|
+
|
901
|
+
setTimeout(function(){
|
902
|
+
if(transitionIn !== undefined){
|
903
|
+
$("#"+openModal).iziModal('open', {
|
904
|
+
transition: transitionIn
|
905
|
+
});
|
906
|
+
} else {
|
907
|
+
$("#"+openModal).iziModal('open');
|
908
|
+
}
|
909
|
+
}, 200);
|
910
|
+
});
|
911
|
+
|
912
|
+
$document.off('keyup').on('keyup', function(event) {
|
913
|
+
|
914
|
+
var modal = $('.'+PLUGIN_NAME+':visible').attr('id'),
|
915
|
+
group = $("#"+modal).iziModal('getGroup'),
|
916
|
+
e = event || window.event,
|
917
|
+
target = e.target || e.srcElement,
|
918
|
+
modals = {};
|
919
|
+
|
920
|
+
if(modal !== undefined && group !== undefined && !e.ctrlKey && !e.metaKey && !e.altKey && target.tagName.toUpperCase() !== 'INPUT' && target.tagName.toUpperCase() != 'TEXTAREA'){ //&& $(e.target).is('body')
|
921
|
+
|
922
|
+
if(e.keyCode === 37) { // left
|
534
923
|
|
535
|
-
|
536
|
-
$this.data(PLUGIN_NAME, (data = new iziModal(this, options)));
|
924
|
+
$("#"+modal).iziModal('prev', e);
|
537
925
|
}
|
538
|
-
if
|
539
|
-
|
926
|
+
else if(e.keyCode === 39 ) { // right
|
927
|
+
|
928
|
+
$("#"+modal).iziModal('next', e);
|
929
|
+
|
540
930
|
}
|
541
|
-
|
931
|
+
}
|
932
|
+
});
|
933
|
+
|
934
|
+
$.fn[PLUGIN_NAME] = function(option, args) {
|
935
|
+
|
936
|
+
var $this = $(this),
|
937
|
+
data = $this.data(PLUGIN_NAME),
|
938
|
+
options = $.extend({}, $.fn.iziModal.defaults, $this.data(), typeof option == 'object' && option);
|
939
|
+
|
940
|
+
if (!data && (!option || typeof option == 'object')){
|
941
|
+
|
942
|
+
$this.data(PLUGIN_NAME, (data = new iziModal(this, options)));
|
943
|
+
}
|
944
|
+
else if (typeof option == 'string' && typeof data != 'undefined'){
|
945
|
+
|
946
|
+
return data[option].apply(data, [].concat(args));
|
947
|
+
}
|
948
|
+
|
949
|
+
if (options.autoOpen){ // Automatically open the modal if autoOpen setted true
|
950
|
+
|
951
|
+
if( !isNaN(parseInt(options.autoOpen)) ){
|
952
|
+
|
953
|
+
setTimeout(function(){
|
954
|
+
data.open();
|
955
|
+
}, options.autoOpen);
|
956
|
+
|
957
|
+
} else if(options.autoOpen === true ) {
|
542
958
|
data.open();
|
543
959
|
}
|
544
|
-
|
545
|
-
|
960
|
+
autoOpenModal++;
|
961
|
+
}
|
962
|
+
return this;
|
963
|
+
};
|
546
964
|
|
547
965
|
$.fn[PLUGIN_NAME].defaults = {
|
548
966
|
title: '',
|
549
967
|
subtitle: '',
|
550
|
-
theme: '',
|
551
968
|
headerColor: '#88A0B9',
|
552
|
-
|
969
|
+
theme: '', // light
|
970
|
+
attached: '', // bottom, top
|
971
|
+
icon: '',
|
553
972
|
iconColor: '',
|
554
|
-
iconClass: null,
|
555
973
|
width: 600,
|
556
974
|
padding: 0,
|
975
|
+
radius: 3,
|
976
|
+
zindex: 999,
|
557
977
|
iframe: false,
|
558
978
|
iframeHeight: 400,
|
559
979
|
iframeURL: null,
|
560
|
-
overlayClose: true,
|
561
|
-
closeOnEscape: true,
|
562
|
-
bodyOverflow: false,
|
563
980
|
focusInput: true,
|
564
|
-
|
981
|
+
group: '',
|
982
|
+
loop: false,
|
983
|
+
navigateCaption: true,
|
984
|
+
navigateArrows: true, // closeToModal, closeScreenEdge
|
985
|
+
history: true,
|
986
|
+
restoreDefaultContent: false,
|
987
|
+
autoOpen: 0, // Boolean, Number
|
988
|
+
bodyOverflow: false,
|
565
989
|
fullscreen: false,
|
566
990
|
openFullscreen: false,
|
991
|
+
closeOnEscape: true,
|
992
|
+
overlay: true,
|
993
|
+
overlayClose: true,
|
994
|
+
overlayColor: 'rgba(0, 0, 0, 0.4)',
|
567
995
|
timeout: false,
|
568
996
|
timeoutProgressbar: false,
|
997
|
+
pauseOnHover: false,
|
569
998
|
timeoutProgressbarColor: 'rgba(255,255,255,0.5)',
|
570
|
-
|
571
|
-
|
999
|
+
transitionIn: 'comingIn', // comingIn, bounceInDown, bounceInUp, fadeInDown, fadeInUp, fadeInLeft, fadeInRight, flipInX
|
1000
|
+
transitionOut: 'comingOut', // comingOut, bounceOutDown, bounceOutUp, fadeOutDown, fadeOutUp, , fadeOutLeft, fadeOutRight, flipOutX
|
572
1001
|
transitionInOverlay: 'fadeIn',
|
573
1002
|
transitionOutOverlay: 'fadeOut',
|
574
|
-
|
575
|
-
|
576
|
-
|
577
|
-
|
1003
|
+
onFullscreen: function(){},
|
1004
|
+
onResize: function(){},
|
1005
|
+
onOpening: function(){},
|
1006
|
+
onOpened: function(){},
|
1007
|
+
onClosing: function(){},
|
1008
|
+
onClosed: function(){}
|
578
1009
|
};
|
579
1010
|
|
580
1011
|
$.fn[PLUGIN_NAME].Constructor = iziModal;
|