magnific-popup-rails 0.8.4 → 0.8.5
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3e36e33baa530cfa85c5791ad6c3a9d8171157df
|
4
|
+
data.tar.gz: 2e4b2d7fb1ad27c59cd2fa06ce9311bb56d3601b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1a7b819ce7c4821cafaa1a3e36fd3a7e8e36c2d304bee5f385f38b4e31df35be11dfb0321ee03e9fad8e476145f2de546bd877fb54c6708776be90c15efe9549
|
7
|
+
data.tar.gz: 281780d1b21c88b4ee949ee032163956666b7454675894f8963b3cd1ba0e00a3568b2ece032654351b325b7f0ce9327db112de7f2d69d5b99bec5247ff96d483
|
@@ -1,4 +1,4 @@
|
|
1
|
-
/*! Magnific Popup - v0.8.
|
1
|
+
/*! Magnific Popup - v0.8.5 - 2013-05-15
|
2
2
|
* http://dimsemenov.com/plugins/magnific-popup/
|
3
3
|
* Copyright (c) 2013 Dmitry Semenov; */
|
4
4
|
;(function($) {
|
@@ -91,6 +91,38 @@ var _mfpOn = function(name, f) {
|
|
91
91
|
mfp.init();
|
92
92
|
$.magnificPopup.instance = mfp;
|
93
93
|
}
|
94
|
+
},
|
95
|
+
// Check to close popup or not
|
96
|
+
// "target" is an element that was clicked
|
97
|
+
_checkIfClose = function(target) {
|
98
|
+
|
99
|
+
if($(target).hasClass(PREVENT_CLOSE_CLASS)) {
|
100
|
+
return;
|
101
|
+
}
|
102
|
+
|
103
|
+
var closeOnContent = mfp.st.closeOnContentClick;
|
104
|
+
var closeOnBg = mfp.st.closeOnBgClick;
|
105
|
+
|
106
|
+
if(closeOnContent && closeOnBg) {
|
107
|
+
return true;
|
108
|
+
} else {
|
109
|
+
|
110
|
+
// We close the popup if click is on close button or on preloader. Or if there is no content.
|
111
|
+
if(!mfp.content || $(target).hasClass('mfp-close') || (mfp.preloader && target === mfp.preloader[0]) ) {
|
112
|
+
return true;
|
113
|
+
}
|
114
|
+
|
115
|
+
// if click is outside the content
|
116
|
+
if( (target !== mfp.content[0] && !$.contains(mfp.content[0], target)) ) {
|
117
|
+
if(closeOnBg) {
|
118
|
+
return true;
|
119
|
+
}
|
120
|
+
} else if(closeOnContent) {
|
121
|
+
return true;
|
122
|
+
}
|
123
|
+
|
124
|
+
}
|
125
|
+
return false;
|
94
126
|
};
|
95
127
|
|
96
128
|
|
@@ -109,9 +141,10 @@ MagnificPopup.prototype = {
|
|
109
141
|
init: function() {
|
110
142
|
var appVersion = navigator.appVersion;
|
111
143
|
mfp.isIE7 = appVersion.indexOf("MSIE 7.") !== -1;
|
144
|
+
mfp.isIE8 = appVersion.indexOf("MSIE 8.") !== -1,
|
145
|
+
mfp.isLowIE = mfp.isIE7 || mfp.isIE8;
|
112
146
|
mfp.isAndroid = (/android/gi).test(appVersion);
|
113
147
|
mfp.isIOS = (/iphone|ipad|ipod/gi).test(appVersion);
|
114
|
-
|
115
148
|
// We disable fixed positioned lightbox on devices that don't handle it nicely.
|
116
149
|
// If you know a better way of detecting this - let me know.
|
117
150
|
mfp.probablyMobile = (mfp.isAndroid || mfp.isIOS || /(Opera Mini)|Kindle|webOS|BlackBerry|(Opera Mobi)|(Windows Phone)|IEMobile/i.test(navigator.userAgent) );
|
@@ -186,22 +219,8 @@ MagnificPopup.prototype = {
|
|
186
219
|
});
|
187
220
|
|
188
221
|
mfp.wrap = _getEl('wrap').attr('tabindex', -1).on('click'+EVENT_NS, function(e) {
|
189
|
-
|
190
|
-
var target = e.target;
|
191
|
-
if($(target).hasClass(PREVENT_CLOSE_CLASS)) {
|
192
|
-
return;
|
193
|
-
}
|
194
|
-
|
195
|
-
if(mfp.st.closeOnContentClick) {
|
222
|
+
if(_checkIfClose(e.target)) {
|
196
223
|
mfp.close();
|
197
|
-
} else {
|
198
|
-
// close popup if click is not on a content, on close button, or content does not exist
|
199
|
-
if( !mfp.content ||
|
200
|
-
$(target).hasClass('mfp-close') ||
|
201
|
-
(mfp.preloader && e.target === mfp.preloader[0]) ||
|
202
|
-
(target !== mfp.content[0] && !$.contains(mfp.content[0], target)) ) {
|
203
|
-
mfp.close();
|
204
|
-
}
|
205
224
|
}
|
206
225
|
});
|
207
226
|
|
@@ -287,7 +306,7 @@ MagnificPopup.prototype = {
|
|
287
306
|
|
288
307
|
var bodyStyles = {};
|
289
308
|
|
290
|
-
if( mfp.fixedContentPos
|
309
|
+
if( mfp.fixedContentPos ) {
|
291
310
|
var s = mfp._getScrollbarSize();
|
292
311
|
if(s) {
|
293
312
|
bodyStyles.paddingRight = s;
|
@@ -364,7 +383,7 @@ MagnificPopup.prototype = {
|
|
364
383
|
|
365
384
|
mfp.isOpen = false;
|
366
385
|
// for CSS3 animation
|
367
|
-
if(mfp.st.removalDelay) {
|
386
|
+
if(mfp.st.removalDelay && !mfp.isLowIE) {
|
368
387
|
mfp._addClassToMFP(REMOVING_CLASS);
|
369
388
|
setTimeout(function() {
|
370
389
|
mfp._close();
|
@@ -419,7 +438,8 @@ MagnificPopup.prototype = {
|
|
419
438
|
|
420
439
|
if(mfp._lastFocusedEl) {
|
421
440
|
$(mfp._lastFocusedEl).focus(); // put tab focus back
|
422
|
-
}
|
441
|
+
}
|
442
|
+
mfp.currItem = null;
|
423
443
|
mfp.content = null;
|
424
444
|
mfp.currTemplate = null;
|
425
445
|
mfp.prevHeight = 0;
|
@@ -456,10 +476,19 @@ MagnificPopup.prototype = {
|
|
456
476
|
if(!item.parsed) {
|
457
477
|
item = mfp.parseEl( mfp.index );
|
458
478
|
}
|
479
|
+
|
480
|
+
var type = item.type;
|
481
|
+
|
482
|
+
_mfpTrigger('BeforeChange', [mfp.currItem ? mfp.currItem.type : '', type]);
|
483
|
+
// BeforeChange event works like so:
|
484
|
+
// _mfpOn('BeforeChange', function(e, prevType, newType) { });
|
459
485
|
|
460
486
|
mfp.currItem = item;
|
461
487
|
|
462
|
-
|
488
|
+
|
489
|
+
|
490
|
+
|
491
|
+
|
463
492
|
if(!mfp.currTemplate[type]) {
|
464
493
|
var markup = mfp.st[type] ? mfp.st[type].markup : false;
|
465
494
|
|
@@ -488,6 +517,8 @@ MagnificPopup.prototype = {
|
|
488
517
|
|
489
518
|
// Append container back after its content changed
|
490
519
|
mfp.container.prepend(mfp.contentContainer);
|
520
|
+
|
521
|
+
_mfpTrigger('AfterChange');
|
491
522
|
},
|
492
523
|
|
493
524
|
|
@@ -779,6 +810,8 @@ $.magnificPopup = {
|
|
779
810
|
|
780
811
|
closeOnContentClick: false,
|
781
812
|
|
813
|
+
closeOnBgClick: true,
|
814
|
+
|
782
815
|
closeBtnInside: true,
|
783
816
|
|
784
817
|
alignTop: false,
|
@@ -1074,15 +1107,22 @@ $.magnificPopup.registerModule('image', {
|
|
1074
1107
|
_window.off('resize' + EVENT_NS);
|
1075
1108
|
});
|
1076
1109
|
|
1077
|
-
_mfpOn('Resize'+ns,
|
1078
|
-
|
1079
|
-
|
1110
|
+
_mfpOn('Resize'+ns, mfp.resizeImage);
|
1111
|
+
if(mfp.isLowIE) {
|
1112
|
+
_mfpOn('AfterChange', mfp.resizeImage);
|
1113
|
+
}
|
1080
1114
|
},
|
1081
1115
|
resizeImage: function() {
|
1082
1116
|
var item = mfp.currItem;
|
1083
1117
|
if(!item.img) return;
|
1118
|
+
|
1084
1119
|
if(mfp.st.image.verticalFit) {
|
1085
|
-
|
1120
|
+
var decr = 0;
|
1121
|
+
// fix box-sizing in ie7/8
|
1122
|
+
if(mfp.isLowIE) {
|
1123
|
+
decr = parseInt(item.img.css('padding-top'), 10) + parseInt(item.img.css('padding-bottom'),10);
|
1124
|
+
}
|
1125
|
+
item.img.css('max-height', mfp.wH-decr);
|
1086
1126
|
}
|
1087
1127
|
},
|
1088
1128
|
_onImageHasSize: function(item) {
|
@@ -1249,13 +1289,21 @@ $.magnificPopup.registerModule('image', {
|
|
1249
1289
|
/*>>iframe*/
|
1250
1290
|
|
1251
1291
|
var IFRAME_NS = 'iframe',
|
1292
|
+
_emptyPage = '//about:blank',
|
1293
|
+
|
1294
|
+
_fixIframeBugs = function(isShowing) {
|
1295
|
+
if(mfp.currTemplate[IFRAME_NS]) {
|
1296
|
+
var el = mfp.currTemplate[IFRAME_NS].find('iframe');
|
1297
|
+
if(el.length) {
|
1298
|
+
// reset src after the popup is closed to avoid "video keeps playing after popup is closed" bug
|
1299
|
+
if(!isShowing) {
|
1300
|
+
el[0].src = _emptyPage;
|
1301
|
+
}
|
1252
1302
|
|
1253
|
-
|
1254
|
-
|
1255
|
-
|
1256
|
-
|
1257
|
-
if(el.length) {
|
1258
|
-
el.css('display', show ? 'block' : 'none');
|
1303
|
+
// IE8 black screen bug fix
|
1304
|
+
if(mfp.isIE8) {
|
1305
|
+
el.css('display', isShowing ? 'block' : 'none');
|
1306
|
+
}
|
1259
1307
|
}
|
1260
1308
|
}
|
1261
1309
|
};
|
@@ -1265,7 +1313,7 @@ $.magnificPopup.registerModule(IFRAME_NS, {
|
|
1265
1313
|
options: {
|
1266
1314
|
markup: '<div class="mfp-iframe-scaler">'+
|
1267
1315
|
'<div class="mfp-close"></div>'+
|
1268
|
-
'<iframe class="mfp-iframe" frameborder="0" allowfullscreen></iframe>'+
|
1316
|
+
'<iframe class="mfp-iframe" src="//about:blank" frameborder="0" allowfullscreen></iframe>'+
|
1269
1317
|
'</div>',
|
1270
1318
|
|
1271
1319
|
srcAction: 'iframe_src',
|
@@ -1292,10 +1340,20 @@ $.magnificPopup.registerModule(IFRAME_NS, {
|
|
1292
1340
|
proto: {
|
1293
1341
|
initIframe: function() {
|
1294
1342
|
mfp.types.push(IFRAME_NS);
|
1295
|
-
|
1296
|
-
_mfpOn(
|
1297
|
-
|
1343
|
+
|
1344
|
+
_mfpOn('BeforeChange', function(e, prevType, newType) {
|
1345
|
+
if(prevType !== newType) {
|
1346
|
+
if(prevType === IFRAME_NS) {
|
1347
|
+
_fixIframeBugs(); // iframe if removed
|
1348
|
+
} else if(newType === IFRAME_NS) {
|
1349
|
+
_fixIframeBugs(true); // iframe is showing
|
1350
|
+
}
|
1351
|
+
}// else {
|
1352
|
+
// iframe source is switched, don't do anything
|
1353
|
+
//}
|
1298
1354
|
});
|
1355
|
+
|
1356
|
+
_mfpOn(CLOSE_EVENT + '.' + IFRAME_NS, _fixIframeBugs);
|
1299
1357
|
},
|
1300
1358
|
|
1301
1359
|
getIframe: function(item, template) {
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: magnific-popup-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joshua Jansen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-05-
|
11
|
+
date: 2013-05-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|