vendor/assets/javascripts/magnific-popup/jquery.magnific-popup.js in magnific-popup-rails-0.9.7 vs vendor/assets/javascripts/magnific-popup/jquery.magnific-popup.js in magnific-popup-rails-0.9.8
- old
+ new
@@ -1,6 +1,6 @@
-/*! Magnific Popup - v0.9.7 - 2013-10-10
+/*! Magnific Popup - v0.9.8 - 2013-10-26
* http://dimsemenov.com/plugins/magnific-popup/
* Copyright (c) 2013 Dmitry Semenov; */
;(function($) {
/*>>core*/
@@ -92,45 +92,10 @@
mfp = new MagnificPopup();
mfp.init();
$.magnificPopup.instance = mfp;
}
},
- // Check to close popup or not
- // "target" is an element that was clicked
- _checkIfClose = function(target) {
-
- if($(target).hasClass(PREVENT_CLOSE_CLASS)) {
- return;
- }
-
- var closeOnContent = mfp.st.closeOnContentClick;
- var closeOnBg = mfp.st.closeOnBgClick;
-
- if(closeOnContent && closeOnBg) {
- return true;
- } else {
-
- // We close the popup if click is on close button or on preloader. Or if there is no content.
- if(!mfp.content || $(target).hasClass('mfp-close') || (mfp.preloader && target === mfp.preloader[0]) ) {
- return true;
- }
-
- // if click is outside the content
- if( (target !== mfp.content[0] && !$.contains(mfp.content[0], target)) ) {
- if(closeOnBg) {
- // last check, if the clicked element is in DOM, (in case it's removed onclick)
- if( $.contains(document, target) ) {
- return true;
- }
- }
- } else if(closeOnContent) {
- return true;
- }
-
- }
- return false;
- },
// CSS transition detection, http://stackoverflow.com/questions/7264899/detect-css-transitions-using-javascript-and-without-modernizr
supportsTransitions = function() {
var s = document.createElement('p').style, // 's' for style. better to create an element if body yet to exist
v = ['ms','O','Moz','Webkit']; // 'v' for vendor
@@ -252,11 +217,11 @@
mfp.bgOverlay = _getEl('bg').on('click'+EVENT_NS, function() {
mfp.close();
});
mfp.wrap = _getEl('wrap').attr('tabindex', -1).on('click'+EVENT_NS, function(e) {
- if(_checkIfClose(e.target)) {
+ if(mfp._checkIfClose(e.target)) {
mfp.close();
}
});
mfp.container = _getEl('container', mfp.wrap);
@@ -347,11 +312,11 @@
if( mfp.fixedContentPos ) {
if(mfp._hasScrollBar(windowHeight)){
var s = mfp._getScrollbarSize();
if(s) {
- windowStyles.paddingRight = s;
+ windowStyles.marginRight = s;
}
}
}
if(mfp.fixedContentPos) {
@@ -377,11 +342,11 @@
mfp.updateItemHTML();
_mfpTrigger('BuildControls');
- // remove scrollbar, add padding e.t.c
+ // remove scrollbar, add margin e.t.c
$('html').css(windowStyles);
// add everything to DOM
mfp.bgOverlay.add(mfp.wrap).prependTo( document.body );
@@ -454,11 +419,11 @@
}
mfp._removeClassFromMFP(classesToRemove);
if(mfp.fixedContentPos) {
- var windowStyles = {paddingRight: ''};
+ var windowStyles = {marginRight: ''};
if(mfp.isIE7) {
$('body, html').css('overflow', '');
} else {
windowStyles.overflow = '';
}
@@ -749,10 +714,45 @@
/*
"Private" helpers that aren't private at all
*/
+ // Check to close popup or not
+ // "target" is an element that was clicked
+ _checkIfClose: function(target) {
+
+ if($(target).hasClass(PREVENT_CLOSE_CLASS)) {
+ return;
+ }
+
+ var closeOnContent = mfp.st.closeOnContentClick;
+ var closeOnBg = mfp.st.closeOnBgClick;
+
+ if(closeOnContent && closeOnBg) {
+ return true;
+ } else {
+
+ // We close the popup if click is on close button or on preloader. Or if there is no content.
+ if(!mfp.content || $(target).hasClass('mfp-close') || (mfp.preloader && target === mfp.preloader[0]) ) {
+ return true;
+ }
+
+ // if click is outside the content
+ if( (target !== mfp.content[0] && !$.contains(mfp.content[0], target)) ) {
+ if(closeOnBg) {
+ // last check, if the clicked element is in DOM, (in case it's removed onclick)
+ if( $.contains(document, target) ) {
+ return true;
+ }
+ }
+ } else if(closeOnContent) {
+ return true;
+ }
+
+ }
+ return false;
+ },
_addClassToMFP: function(cName) {
mfp.bgOverlay.addClass(cName);
mfp.wrap.addClass(cName);
},
_removeClassFromMFP: function(cName) {
@@ -1151,14 +1151,18 @@
$.magnificPopup.registerModule('image', {
options: {
markup: '<div class="mfp-figure">'+
'<div class="mfp-close"></div>'+
- '<div class="mfp-img"></div>'+
- '<div class="mfp-bottom-bar">'+
- '<div class="mfp-title"></div>'+
- '<div class="mfp-counter"></div>'+
- '</div>'+
+ '<figure>'+
+ '<div class="mfp-img"></div>'+
+ '<figcaption>'+
+ '<div class="mfp-bottom-bar">'+
+ '<div class="mfp-title"></div>'+
+ '<div class="mfp-counter"></div>'+
+ '</div>'+
+ '</figcaption>'+
+ '</figure>'+
'</div>',
cursor: 'mfp-zoom-out-cur',
titleSrc: 'title',
verticalFit: true,
tError: '<a href="%url%">The image</a> could not be loaded.'
\ No newline at end of file