Include updated, "customized" build of MagnificPopup.
Also adds missing test to Modernizr build. References #85
This commit is contained in:
parent
49ce068117
commit
6b8f893299
@ -1,4 +1,4 @@
|
||||
/*! Magnific Popup - v0.9.2 - 2013-07-05
|
||||
/*! Magnific Popup - v0.9.9 - 2013-12-27
|
||||
* http://dimsemenov.com/plugins/magnific-popup/
|
||||
* Copyright (c) 2013 Dmitry Semenov; */
|
||||
;(function($) {
|
||||
@ -76,9 +76,6 @@ var _mfpOn = function(name, f) {
|
||||
}
|
||||
}
|
||||
},
|
||||
_setFocus = function() {
|
||||
(mfp.st.focus ? mfp.content.find(mfp.st.focus).eq(0) : mfp.wrap).trigger('focus');
|
||||
},
|
||||
_getCloseBtn = function(type) {
|
||||
if(type !== _currPopupType || !mfp.currTemplate.closeBtn) {
|
||||
mfp.currTemplate.closeBtn = $( mfp.st.closeMarkup.replace('%title%', mfp.st.tClose ) );
|
||||
@ -94,38 +91,6 @@ var _mfpOn = function(name, f) {
|
||||
$.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) {
|
||||
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
|
||||
@ -169,7 +134,6 @@ MagnificPopup.prototype = {
|
||||
// We disable fixed positioned lightbox on devices that don't handle it nicely.
|
||||
// If you know a better way of detecting this - let me know.
|
||||
mfp.probablyMobile = (mfp.isAndroid || mfp.isIOS || /(Opera Mini)|Kindle|webOS|BlackBerry|(Opera Mobi)|(Windows Phone)|IEMobile/i.test(navigator.userAgent) );
|
||||
_body = $(document.body);
|
||||
_document = $(document);
|
||||
|
||||
mfp.popupsCache = {};
|
||||
@ -181,6 +145,10 @@ MagnificPopup.prototype = {
|
||||
*/
|
||||
open: function(data) {
|
||||
|
||||
if(!_body) {
|
||||
_body = $(document.body);
|
||||
}
|
||||
|
||||
var i;
|
||||
|
||||
if(data.isObj === false) {
|
||||
@ -251,7 +219,7 @@ MagnificPopup.prototype = {
|
||||
});
|
||||
|
||||
mfp.wrap = _getEl('wrap').attr('tabindex', -1).on('click'+EVENT_NS, function(e) {
|
||||
if(_checkIfClose(e.target)) {
|
||||
if(mfp._checkIfClose(e.target)) {
|
||||
mfp.close();
|
||||
}
|
||||
});
|
||||
@ -346,7 +314,7 @@ MagnificPopup.prototype = {
|
||||
if(mfp._hasScrollBar(windowHeight)){
|
||||
var s = mfp._getScrollbarSize();
|
||||
if(s) {
|
||||
windowStyles.paddingRight = s;
|
||||
windowStyles.marginRight = s;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -375,14 +343,11 @@ MagnificPopup.prototype = {
|
||||
|
||||
_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 );
|
||||
|
||||
|
||||
mfp.bgOverlay.add(mfp.wrap).prependTo( mfp.st.prependTo || _body );
|
||||
|
||||
// Save last focused element
|
||||
mfp._lastFocusedEl = document.activeElement;
|
||||
@ -392,25 +357,22 @@ MagnificPopup.prototype = {
|
||||
|
||||
if(mfp.content) {
|
||||
mfp._addClassToMFP(READY_CLASS);
|
||||
_setFocus();
|
||||
mfp._setFocus();
|
||||
} else {
|
||||
// if content is not defined (not loaded e.t.c) we add class only for BG
|
||||
mfp.bgOverlay.addClass(READY_CLASS);
|
||||
}
|
||||
|
||||
// Trap the focus in popup
|
||||
_document.on('focusin' + EVENT_NS, function (e) {
|
||||
if( e.target !== mfp.wrap[0] && !$.contains(mfp.wrap[0], e.target) ) {
|
||||
_setFocus();
|
||||
return false;
|
||||
}
|
||||
});
|
||||
_document.on('focusin' + EVENT_NS, mfp._onFocusIn);
|
||||
|
||||
}, 16);
|
||||
|
||||
mfp.isOpen = true;
|
||||
mfp.updateSize(windowHeight);
|
||||
_mfpTrigger(OPEN_EVENT);
|
||||
|
||||
return data;
|
||||
},
|
||||
|
||||
/**
|
||||
@ -451,7 +413,7 @@ MagnificPopup.prototype = {
|
||||
mfp._removeClassFromMFP(classesToRemove);
|
||||
|
||||
if(mfp.fixedContentPos) {
|
||||
var windowStyles = {paddingRight: ''};
|
||||
var windowStyles = {marginRight: ''};
|
||||
if(mfp.isIE7) {
|
||||
$('body, html').css('overflow', '');
|
||||
} else {
|
||||
@ -477,7 +439,7 @@ MagnificPopup.prototype = {
|
||||
|
||||
|
||||
if(mfp._lastFocusedEl) {
|
||||
$(mfp._lastFocusedEl).trigger('focus'); // put tab focus back
|
||||
$(mfp._lastFocusedEl).focus(); // put tab focus back
|
||||
}
|
||||
mfp.currItem = null;
|
||||
mfp.content = null;
|
||||
@ -533,8 +495,6 @@ MagnificPopup.prototype = {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if(!mfp.currTemplate[type]) {
|
||||
var markup = mfp.st[type] ? mfp.st[type].markup : false;
|
||||
|
||||
@ -596,18 +556,18 @@ MagnificPopup.prototype = {
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Creates Magnific Popup data object based on given data
|
||||
* @param {int} index Index of item to parse
|
||||
*/
|
||||
parseEl: function(index) {
|
||||
var item = mfp.items[index],
|
||||
type = item.type;
|
||||
type;
|
||||
|
||||
if(item.tagName) {
|
||||
item = { el: $(item) };
|
||||
} else {
|
||||
type = item.type;
|
||||
item = { data: item, src: item.src };
|
||||
}
|
||||
|
||||
@ -746,6 +706,41 @@ MagnificPopup.prototype = {
|
||||
/*
|
||||
"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);
|
||||
@ -757,6 +752,15 @@ MagnificPopup.prototype = {
|
||||
_hasScrollBar: function(winHeight) {
|
||||
return ( (mfp.isIE7 ? _document.height() : document.body.scrollHeight) > (winHeight || _window.height()) );
|
||||
},
|
||||
_setFocus: function() {
|
||||
(mfp.st.focus ? mfp.content.find(mfp.st.focus).eq(0) : mfp.wrap).focus();
|
||||
},
|
||||
_onFocusIn: function(e) {
|
||||
if( e.target !== mfp.wrap[0] && !$.contains(mfp.wrap[0], e.target) ) {
|
||||
mfp._setFocus();
|
||||
return false;
|
||||
}
|
||||
},
|
||||
_parseMarkup: function(template, values, item) {
|
||||
var arr;
|
||||
if(item.data) {
|
||||
@ -824,8 +828,12 @@ $.magnificPopup = {
|
||||
open: function(options, index) {
|
||||
_checkInstance();
|
||||
|
||||
if(!options)
|
||||
if(!options) {
|
||||
options = {};
|
||||
} else {
|
||||
options = $.extend(true, {}, options);
|
||||
}
|
||||
|
||||
|
||||
options.isObj = true;
|
||||
options.index = index || 0;
|
||||
@ -833,7 +841,7 @@ $.magnificPopup = {
|
||||
},
|
||||
|
||||
close: function() {
|
||||
return $.magnificPopup.instance.close();
|
||||
return $.magnificPopup.instance && $.magnificPopup.instance.close();
|
||||
},
|
||||
|
||||
registerModule: function(name, module) {
|
||||
@ -877,6 +885,8 @@ $.magnificPopup = {
|
||||
|
||||
removalDelay: 0,
|
||||
|
||||
prependTo: null,
|
||||
|
||||
fixedContentPos: 'auto',
|
||||
|
||||
fixedBgPos: 'auto',
|
||||
@ -923,6 +933,8 @@ $.fn.magnificPopup = function(options) {
|
||||
}
|
||||
|
||||
} else {
|
||||
// clone options obj
|
||||
options = $.extend(true, {}, options);
|
||||
|
||||
/*
|
||||
* As Zepto doesn't support .data() method for objects
|
||||
@ -1033,90 +1045,7 @@ $.magnificPopup.registerModule(INLINE_NS, {
|
||||
|
||||
/*>>inline*/
|
||||
|
||||
/*>>ajax*/
|
||||
var AJAX_NS = 'ajax',
|
||||
_ajaxCur,
|
||||
_removeAjaxCursor = function() {
|
||||
if(_ajaxCur) {
|
||||
_body.removeClass(_ajaxCur);
|
||||
}
|
||||
};
|
||||
|
||||
$.magnificPopup.registerModule(AJAX_NS, {
|
||||
|
||||
options: {
|
||||
settings: null,
|
||||
cursor: 'mfp-ajax-cur',
|
||||
tError: '<a href="%url%">The content</a> could not be loaded.'
|
||||
},
|
||||
|
||||
proto: {
|
||||
initAjax: function() {
|
||||
mfp.types.push(AJAX_NS);
|
||||
_ajaxCur = mfp.st.ajax.cursor;
|
||||
|
||||
_mfpOn(CLOSE_EVENT+'.'+AJAX_NS, function() {
|
||||
_removeAjaxCursor();
|
||||
if(mfp.req) {
|
||||
mfp.req.abort();
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
getAjax: function(item) {
|
||||
|
||||
if(_ajaxCur)
|
||||
_body.addClass(_ajaxCur);
|
||||
|
||||
mfp.updateStatus('loading');
|
||||
|
||||
var opts = $.extend({
|
||||
url: item.src,
|
||||
success: function(data, textStatus, jqXHR) {
|
||||
var temp = {
|
||||
data:data,
|
||||
xhr:jqXHR
|
||||
};
|
||||
|
||||
_mfpTrigger('ParseAjax', temp);
|
||||
|
||||
mfp.appendContent( $(temp.data), AJAX_NS );
|
||||
|
||||
item.finished = true;
|
||||
|
||||
_removeAjaxCursor();
|
||||
|
||||
_setFocus();
|
||||
|
||||
setTimeout(function() {
|
||||
mfp.wrap.addClass(READY_CLASS);
|
||||
}, 16);
|
||||
|
||||
mfp.updateStatus('ready');
|
||||
|
||||
_mfpTrigger('AjaxContentAdded');
|
||||
},
|
||||
error: function() {
|
||||
_removeAjaxCursor();
|
||||
item.finished = item.loadError = true;
|
||||
mfp.updateStatus('error', mfp.st.ajax.tError.replace('%url%', item.src));
|
||||
}
|
||||
}, mfp.st.ajax.settings);
|
||||
|
||||
mfp.req = $.ajax(opts);
|
||||
|
||||
return '';
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*>>ajax*/
|
||||
|
||||
/*>>image*/
|
||||
var _imgInterval,
|
||||
@ -1141,11 +1070,15 @@ $.magnificPopup.registerModule('image', {
|
||||
options: {
|
||||
markup: '<div class="mfp-figure">'+
|
||||
'<div class="mfp-close"></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',
|
||||
@ -1180,7 +1113,7 @@ $.magnificPopup.registerModule('image', {
|
||||
},
|
||||
resizeImage: function() {
|
||||
var item = mfp.currItem;
|
||||
if(!item.img) return;
|
||||
if(!item || !item.img) return;
|
||||
|
||||
if(mfp.st.image.verticalFit) {
|
||||
var decr = 0;
|
||||
@ -1304,7 +1237,7 @@ $.magnificPopup.registerModule('image', {
|
||||
|
||||
var el = template.find('.mfp-img');
|
||||
if(el.length) {
|
||||
var img = new Image();
|
||||
var img = document.createElement('img');
|
||||
img.className = 'mfp-img';
|
||||
item.img = $(img).on('load.mfploader', onLoadComplete).on('error.mfploader', onLoadError);
|
||||
img.src = item.src;
|
||||
@ -1314,8 +1247,12 @@ $.magnificPopup.registerModule('image', {
|
||||
if(el.is('img')) {
|
||||
item.img = item.img.clone();
|
||||
}
|
||||
if(item.img[0].naturalWidth > 0) {
|
||||
|
||||
img = item.img[0];
|
||||
if(img.naturalWidth > 0) {
|
||||
item.hasSize = true;
|
||||
} else if(!img.width) {
|
||||
item.hasSize = false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1381,7 +1318,8 @@ $.magnificPopup.registerModule('zoom', {
|
||||
|
||||
initZoom: function() {
|
||||
var zoomSt = mfp.st.zoom,
|
||||
ns = '.zoom';
|
||||
ns = '.zoom',
|
||||
image;
|
||||
|
||||
if(!zoomSt.enabled || !mfp.supportsTransition) {
|
||||
return;
|
||||
@ -1485,6 +1423,7 @@ $.magnificPopup.registerModule('zoom', {
|
||||
if(animatedImg) {
|
||||
animatedImg.remove();
|
||||
}
|
||||
image = null;
|
||||
}
|
||||
});
|
||||
},
|
||||
@ -1651,372 +1590,9 @@ $.magnificPopup.registerModule(IFRAME_NS, {
|
||||
|
||||
/*>>iframe*/
|
||||
|
||||
/*>>gallery*/
|
||||
/**
|
||||
* Get looped index depending on number of slides
|
||||
*/
|
||||
var _getLoopedId = function(index) {
|
||||
var numSlides = mfp.items.length;
|
||||
if(index > numSlides - 1) {
|
||||
return index - numSlides;
|
||||
} else if(index < 0) {
|
||||
return numSlides + index;
|
||||
}
|
||||
return index;
|
||||
},
|
||||
_replaceCurrTotal = function(text, curr, total) {
|
||||
return text.replace('%curr%', curr + 1).replace('%total%', total);
|
||||
};
|
||||
|
||||
$.magnificPopup.registerModule('gallery', {
|
||||
|
||||
options: {
|
||||
enabled: false,
|
||||
arrowMarkup: '<button title="%title%" type="button" class="mfp-arrow mfp-arrow-%dir%"></button>',
|
||||
preload: [0,2],
|
||||
navigateByImgClick: true,
|
||||
arrows: true,
|
||||
|
||||
tPrev: 'Previous (Left arrow key)',
|
||||
tNext: 'Next (Right arrow key)',
|
||||
tCounter: '%curr% of %total%'
|
||||
},
|
||||
|
||||
proto: {
|
||||
initGallery: function() {
|
||||
|
||||
var gSt = mfp.st.gallery,
|
||||
ns = '.mfp-gallery',
|
||||
supportsFastClick = Boolean($.fn.mfpFastClick);
|
||||
|
||||
mfp.direction = true; // true - next, false - prev
|
||||
|
||||
if(!gSt || !gSt.enabled ) return false;
|
||||
|
||||
_wrapClasses += ' mfp-gallery';
|
||||
|
||||
_mfpOn(OPEN_EVENT+ns, function() {
|
||||
|
||||
if(gSt.navigateByImgClick) {
|
||||
mfp.wrap.on('click'+ns, '.mfp-img', function() {
|
||||
if(mfp.items.length > 1) {
|
||||
mfp.next();
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
_document.on('keydown'+ns, function(e) {
|
||||
if (e.keyCode === 37) {
|
||||
mfp.prev();
|
||||
} else if (e.keyCode === 39) {
|
||||
mfp.next();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
_mfpOn('UpdateStatus'+ns, function(e, data) {
|
||||
if(data.text) {
|
||||
data.text = _replaceCurrTotal(data.text, mfp.currItem.index, mfp.items.length);
|
||||
}
|
||||
});
|
||||
|
||||
_mfpOn(MARKUP_PARSE_EVENT+ns, function(e, element, values, item) {
|
||||
var l = mfp.items.length;
|
||||
values.counter = l > 1 ? _replaceCurrTotal(gSt.tCounter, item.index, l) : '';
|
||||
});
|
||||
|
||||
_mfpOn('BuildControls' + ns, function() {
|
||||
if(mfp.items.length > 1 && gSt.arrows && !mfp.arrowLeft) {
|
||||
var markup = gSt.arrowMarkup,
|
||||
arrowLeft = mfp.arrowLeft = $( markup.replace('%title%', gSt.tPrev).replace('%dir%', 'left') ).addClass(PREVENT_CLOSE_CLASS),
|
||||
arrowRight = mfp.arrowRight = $( markup.replace('%title%', gSt.tNext).replace('%dir%', 'right') ).addClass(PREVENT_CLOSE_CLASS);
|
||||
|
||||
var eName = supportsFastClick ? 'mfpFastClick' : 'click';
|
||||
arrowLeft[eName](function() {
|
||||
mfp.prev();
|
||||
});
|
||||
arrowRight[eName](function() {
|
||||
mfp.next();
|
||||
});
|
||||
|
||||
// Polyfill for :before and :after (adds elements with classes mfp-a and mfp-b)
|
||||
if(mfp.isIE7) {
|
||||
_getEl('b', arrowLeft[0], false, true);
|
||||
_getEl('a', arrowLeft[0], false, true);
|
||||
_getEl('b', arrowRight[0], false, true);
|
||||
_getEl('a', arrowRight[0], false, true);
|
||||
}
|
||||
|
||||
mfp.container.append(arrowLeft.add(arrowRight));
|
||||
}
|
||||
});
|
||||
|
||||
_mfpOn(CHANGE_EVENT+ns, function() {
|
||||
if(mfp._preloadTimeout) clearTimeout(mfp._preloadTimeout);
|
||||
|
||||
mfp._preloadTimeout = setTimeout(function() {
|
||||
mfp.preloadNearbyImages();
|
||||
mfp._preloadTimeout = null;
|
||||
}, 16);
|
||||
});
|
||||
|
||||
|
||||
_mfpOn(CLOSE_EVENT+ns, function() {
|
||||
_document.off(ns);
|
||||
mfp.wrap.off('click'+ns);
|
||||
|
||||
if(mfp.arrowLeft && supportsFastClick) {
|
||||
mfp.arrowLeft.add(mfp.arrowRight).destroyMfpFastClick();
|
||||
}
|
||||
mfp.arrowRight = mfp.arrowLeft = null;
|
||||
});
|
||||
|
||||
},
|
||||
next: function() {
|
||||
mfp.direction = true;
|
||||
mfp.index = _getLoopedId(mfp.index + 1);
|
||||
mfp.updateItemHTML();
|
||||
},
|
||||
prev: function() {
|
||||
mfp.direction = false;
|
||||
mfp.index = _getLoopedId(mfp.index - 1);
|
||||
mfp.updateItemHTML();
|
||||
},
|
||||
goTo: function(newIndex) {
|
||||
mfp.direction = (newIndex >= mfp.index);
|
||||
mfp.index = newIndex;
|
||||
mfp.updateItemHTML();
|
||||
},
|
||||
preloadNearbyImages: function() {
|
||||
var p = mfp.st.gallery.preload,
|
||||
preloadBefore = Math.min(p[0], mfp.items.length),
|
||||
preloadAfter = Math.min(p[1], mfp.items.length),
|
||||
i;
|
||||
|
||||
for(i = 1; i <= (mfp.direction ? preloadAfter : preloadBefore); i++) {
|
||||
mfp._preloadItem(mfp.index+i);
|
||||
}
|
||||
for(i = 1; i <= (mfp.direction ? preloadBefore : preloadAfter); i++) {
|
||||
mfp._preloadItem(mfp.index-i);
|
||||
}
|
||||
},
|
||||
_preloadItem: function(index) {
|
||||
index = _getLoopedId(index);
|
||||
|
||||
if(mfp.items[index].preloaded) {
|
||||
return;
|
||||
}
|
||||
|
||||
var item = mfp.items[index];
|
||||
if(!item.parsed) {
|
||||
item = mfp.parseEl( index );
|
||||
}
|
||||
|
||||
_mfpTrigger('LazyLoad', item);
|
||||
|
||||
if(item.type === 'image') {
|
||||
item.img = $('<img class="mfp-img" />').on('load.mfploader', function() {
|
||||
item.hasSize = true;
|
||||
}).on('error.mfploader', function() {
|
||||
item.hasSize = true;
|
||||
item.loadError = true;
|
||||
}).attr('src', item.src);
|
||||
}
|
||||
|
||||
|
||||
item.preloaded = true;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
/*
|
||||
Touch Support that might be implemented some day
|
||||
|
||||
addSwipeGesture: function() {
|
||||
var startX,
|
||||
moved,
|
||||
multipleTouches;
|
||||
|
||||
return;
|
||||
|
||||
var namespace = '.mfp',
|
||||
addEventNames = function(pref, down, move, up, cancel) {
|
||||
mfp._tStart = pref + down + namespace;
|
||||
mfp._tMove = pref + move + namespace;
|
||||
mfp._tEnd = pref + up + namespace;
|
||||
mfp._tCancel = pref + cancel + namespace;
|
||||
};
|
||||
|
||||
if(window.navigator.msPointerEnabled) {
|
||||
addEventNames('MSPointer', 'Down', 'Move', 'Up', 'Cancel');
|
||||
} else if('ontouchstart' in window) {
|
||||
addEventNames('touch', 'start', 'move', 'end', 'cancel');
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
_window.on(mfp._tStart, function(e) {
|
||||
var oE = e.originalEvent;
|
||||
multipleTouches = moved = false;
|
||||
startX = oE.pageX || oE.changedTouches[0].pageX;
|
||||
}).on(mfp._tMove, function(e) {
|
||||
if(e.originalEvent.touches.length > 1) {
|
||||
multipleTouches = e.originalEvent.touches.length;
|
||||
} else {
|
||||
//e.preventDefault();
|
||||
moved = true;
|
||||
}
|
||||
}).on(mfp._tEnd + ' ' + mfp._tCancel, function(e) {
|
||||
if(moved && !multipleTouches) {
|
||||
var oE = e.originalEvent,
|
||||
diff = startX - (oE.pageX || oE.changedTouches[0].pageX);
|
||||
|
||||
if(diff > 20) {
|
||||
mfp.next();
|
||||
} else if(diff < -20) {
|
||||
mfp.prev();
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
*/
|
||||
|
||||
|
||||
/*>>gallery*/
|
||||
|
||||
/*>>retina*/
|
||||
|
||||
var RETINA_NS = 'retina';
|
||||
|
||||
$.magnificPopup.registerModule(RETINA_NS, {
|
||||
options: {
|
||||
replaceSrc: function(item) {
|
||||
return item.src.replace(/\.\w+$/, function(m) { return '@2x' + m; });
|
||||
},
|
||||
ratio: 1 // Function or number. Set to 1 to disable.
|
||||
},
|
||||
proto: {
|
||||
initRetina: function() {
|
||||
if(window.devicePixelRatio > 1) {
|
||||
|
||||
var st = mfp.st.retina,
|
||||
ratio = st.ratio;
|
||||
|
||||
ratio = !isNaN(ratio) ? ratio : ratio();
|
||||
|
||||
if(ratio > 1) {
|
||||
_mfpOn('ImageHasSize' + '.' + RETINA_NS, function(e, item) {
|
||||
item.img.css({
|
||||
'max-width': item.img[0].naturalWidth / ratio,
|
||||
'width': '100%'
|
||||
});
|
||||
});
|
||||
_mfpOn('ElementParse' + '.' + RETINA_NS, function(e, item) {
|
||||
item.src = st.replaceSrc(item, ratio);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
/*>>retina*/
|
||||
|
||||
/*>>fastclick*/
|
||||
/**
|
||||
* FastClick event implementation. (removes 300ms delay on touch devices)
|
||||
* Based on https://developers.google.com/mobile/articles/fast_buttons
|
||||
*
|
||||
* You may use it outside the Magnific Popup by calling just:
|
||||
*
|
||||
* $('.your-el').mfpFastClick(function() {
|
||||
* console.log('Clicked!');
|
||||
* });
|
||||
*
|
||||
* To unbind:
|
||||
* $('.your-el').destroyMfpFastClick();
|
||||
*
|
||||
*
|
||||
* Note that it's a very basic and simple implementation, it blocks ghost click on the same element where it was bound.
|
||||
* If you need something more advanced, use plugin by FT Labs https://github.com/ftlabs/fastclick
|
||||
*
|
||||
*/
|
||||
|
||||
(function() {
|
||||
var ghostClickDelay = 1000,
|
||||
supportsTouch = 'ontouchstart' in window,
|
||||
unbindTouchMove = function() {
|
||||
_window.off('touchmove'+ns+' touchend'+ns);
|
||||
},
|
||||
eName = 'mfpFastClick',
|
||||
ns = '.'+eName;
|
||||
|
||||
|
||||
// As Zepto.js doesn't have an easy way to add custom events (like jQuery), so we implement it in this way
|
||||
$.fn.mfpFastClick = function(callback) {
|
||||
|
||||
return $(this).each(function() {
|
||||
|
||||
var elem = $(this),
|
||||
lock;
|
||||
|
||||
if( supportsTouch ) {
|
||||
|
||||
var timeout,
|
||||
startX,
|
||||
startY,
|
||||
pointerMoved,
|
||||
point,
|
||||
numPointers;
|
||||
|
||||
elem.on('touchstart' + ns, function(e) {
|
||||
pointerMoved = false;
|
||||
numPointers = 1;
|
||||
|
||||
point = e.originalEvent ? e.originalEvent.touches[0] : e.touches[0];
|
||||
startX = point.clientX;
|
||||
startY = point.clientY;
|
||||
|
||||
_window.on('touchmove'+ns, function(e) {
|
||||
point = e.originalEvent ? e.originalEvent.touches : e.touches;
|
||||
numPointers = point.length;
|
||||
point = point[0];
|
||||
if (Math.abs(point.clientX - startX) > 10 ||
|
||||
Math.abs(point.clientY - startY) > 10) {
|
||||
pointerMoved = true;
|
||||
unbindTouchMove();
|
||||
}
|
||||
}).on('touchend'+ns, function(e) {
|
||||
unbindTouchMove();
|
||||
if(pointerMoved || numPointers > 1) {
|
||||
return;
|
||||
}
|
||||
lock = true;
|
||||
e.preventDefault();
|
||||
clearTimeout(timeout);
|
||||
timeout = setTimeout(function() {
|
||||
lock = false;
|
||||
}, ghostClickDelay);
|
||||
callback();
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
elem.on('click' + ns, function() {
|
||||
if(!lock) {
|
||||
callback();
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
$.fn.destroyMfpFastClick = function() {
|
||||
$(this).off('touchstart' + ns + ' click' + ns);
|
||||
if(supportsTouch) _window.off('touchmove'+ns+' touchend'+ns);
|
||||
};
|
||||
})();
|
||||
|
||||
/*>>fastclick*/
|
||||
})(window.jQuery || window.Zepto);
|
||||
_checkInstance(); })(window.jQuery || window.Zepto);
|
File diff suppressed because one or more lines are too long
@ -2267,16 +2267,14 @@ input[name="serendipity[filter][fileCategory]"] {
|
||||
text-align: left;
|
||||
z-index: 1045; }
|
||||
|
||||
.mfp-inline-holder .mfp-content,
|
||||
.mfp-ajax-holder .mfp-content {
|
||||
.mfp-inline-holder .mfp-content, .mfp-ajax-holder .mfp-content {
|
||||
width: 100%;
|
||||
cursor: auto; }
|
||||
|
||||
.mfp-ajax-cur {
|
||||
cursor: progress; }
|
||||
|
||||
.mfp-zoom-out-cur,
|
||||
.mfp-zoom-out-cur .mfp-image-holder .mfp-close {
|
||||
.mfp-zoom-out-cur, .mfp-zoom-out-cur .mfp-image-holder .mfp-close {
|
||||
cursor: -moz-zoom-out;
|
||||
cursor: -webkit-zoom-out;
|
||||
cursor: zoom-out; }
|
||||
@ -2290,10 +2288,7 @@ input[name="serendipity[filter][fileCategory]"] {
|
||||
.mfp-auto-cursor .mfp-content {
|
||||
cursor: auto; }
|
||||
|
||||
.mfp-close,
|
||||
.mfp-arrow,
|
||||
.mfp-preloader,
|
||||
.mfp-counter {
|
||||
.mfp-close, .mfp-arrow, .mfp-preloader, .mfp-counter {
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
user-select: none; }
|
||||
@ -2314,10 +2309,8 @@ input[name="serendipity[filter][fileCategory]"] {
|
||||
left: 8px;
|
||||
right: 8px;
|
||||
z-index: 1044; }
|
||||
|
||||
.mfp-preloader a {
|
||||
color: #cccccc; }
|
||||
|
||||
.mfp-preloader a:hover {
|
||||
color: white; }
|
||||
|
||||
@ -2327,17 +2320,18 @@ input[name="serendipity[filter][fileCategory]"] {
|
||||
.mfp-s-error .mfp-content {
|
||||
display: none; }
|
||||
|
||||
button.mfp-close,
|
||||
button.mfp-arrow {
|
||||
button.mfp-close, button.mfp-arrow {
|
||||
overflow: visible;
|
||||
cursor: pointer;
|
||||
background: transparent;
|
||||
border: 0;
|
||||
-webkit-appearance: none;
|
||||
display: block;
|
||||
outline: none;
|
||||
padding: 0;
|
||||
z-index: 1046; }
|
||||
|
||||
z-index: 1046;
|
||||
-webkit-box-shadow: none;
|
||||
box-shadow: none; }
|
||||
button::-moz-focus-inner {
|
||||
padding: 0;
|
||||
border: 0; }
|
||||
@ -2352,21 +2346,22 @@ button::-moz-focus-inner {
|
||||
text-decoration: none;
|
||||
text-align: center;
|
||||
opacity: 0.65;
|
||||
filter: alpha(opacity=65);
|
||||
padding: 0 0 18px 10px;
|
||||
color: white;
|
||||
font-style: normal;
|
||||
font-size: 28px;
|
||||
font-family: Arial, Baskerville, monospace; }
|
||||
.mfp-close:hover, .mfp-close:focus {
|
||||
opacity: 1; }
|
||||
opacity: 1;
|
||||
filter: alpha(opacity=100); }
|
||||
.mfp-close:active {
|
||||
top: 1px; }
|
||||
|
||||
.mfp-close-btn-in .mfp-close {
|
||||
color: #333333; }
|
||||
|
||||
.mfp-image-holder .mfp-close,
|
||||
.mfp-iframe-holder .mfp-close {
|
||||
.mfp-image-holder .mfp-close, .mfp-iframe-holder .mfp-close {
|
||||
color: white;
|
||||
right: -6px;
|
||||
text-align: right;
|
||||
@ -2384,6 +2379,7 @@ button::-moz-focus-inner {
|
||||
.mfp-arrow {
|
||||
position: absolute;
|
||||
opacity: 0.65;
|
||||
filter: alpha(opacity=65);
|
||||
margin: 0;
|
||||
top: 50%;
|
||||
margin-top: -55px;
|
||||
@ -2391,17 +2387,12 @@ button::-moz-focus-inner {
|
||||
width: 90px;
|
||||
height: 110px;
|
||||
-webkit-tap-highlight-color: rgba(0, 0, 0, 0); }
|
||||
|
||||
.mfp-arrow:active {
|
||||
margin-top: -54px; }
|
||||
|
||||
.mfp-arrow:hover,
|
||||
.mfp-arrow:focus {
|
||||
opacity: 1; }
|
||||
|
||||
.mfp-arrow:before, .mfp-arrow:after,
|
||||
.mfp-arrow .mfp-b,
|
||||
.mfp-arrow .mfp-a {
|
||||
.mfp-arrow:hover, .mfp-arrow:focus {
|
||||
opacity: 1;
|
||||
filter: alpha(opacity=100); }
|
||||
.mfp-arrow:before, .mfp-arrow:after, .mfp-arrow .mfp-b, .mfp-arrow .mfp-a {
|
||||
content: '';
|
||||
display: block;
|
||||
width: 0;
|
||||
@ -2411,53 +2402,48 @@ button::-moz-focus-inner {
|
||||
top: 0;
|
||||
margin-top: 35px;
|
||||
margin-left: 35px;
|
||||
border: solid transparent; }
|
||||
.mfp-arrow:after,
|
||||
.mfp-arrow .mfp-a {
|
||||
border: medium inset transparent; }
|
||||
.mfp-arrow:after, .mfp-arrow .mfp-a {
|
||||
border-top-width: 13px;
|
||||
border-bottom-width: 13px;
|
||||
top: 8px; }
|
||||
.mfp-arrow:before,
|
||||
.mfp-arrow .mfp-b {
|
||||
.mfp-arrow:before, .mfp-arrow .mfp-b {
|
||||
border-top-width: 21px;
|
||||
border-bottom-width: 21px; }
|
||||
border-bottom-width: 21px;
|
||||
opacity: 0.7; }
|
||||
|
||||
.mfp-arrow-left {
|
||||
left: 0; }
|
||||
.mfp-arrow-left:after,
|
||||
.mfp-arrow-left .mfp-a {
|
||||
.mfp-arrow-left:after, .mfp-arrow-left .mfp-a {
|
||||
border-right: 17px solid white;
|
||||
margin-left: 31px; }
|
||||
.mfp-arrow-left:before,
|
||||
.mfp-arrow-left .mfp-b {
|
||||
.mfp-arrow-left:before, .mfp-arrow-left .mfp-b {
|
||||
margin-left: 25px;
|
||||
border-right: 27px solid #3f3f3f; }
|
||||
|
||||
.mfp-arrow-right {
|
||||
right: 0; }
|
||||
.mfp-arrow-right:after,
|
||||
.mfp-arrow-right .mfp-a {
|
||||
.mfp-arrow-right:after, .mfp-arrow-right .mfp-a {
|
||||
border-left: 17px solid white;
|
||||
margin-left: 39px; }
|
||||
.mfp-arrow-right:before,
|
||||
.mfp-arrow-right .mfp-b {
|
||||
.mfp-arrow-right:before, .mfp-arrow-right .mfp-b {
|
||||
border-left: 27px solid #3f3f3f; }
|
||||
|
||||
.mfp-iframe-holder {
|
||||
padding-top: 40px;
|
||||
padding-bottom: 40px; }
|
||||
|
||||
.mfp-iframe-holder .mfp-content {
|
||||
line-height: 0;
|
||||
width: 100%;
|
||||
max-width: 900px; }
|
||||
.mfp-iframe-holder .mfp-close {
|
||||
top: -40px; }
|
||||
|
||||
.mfp-iframe-scaler {
|
||||
width: 100%;
|
||||
height: 0;
|
||||
overflow: hidden;
|
||||
padding-top: 56.25%; }
|
||||
|
||||
.mfp-iframe-scaler iframe {
|
||||
position: absolute;
|
||||
display: block;
|
||||
@ -2468,9 +2454,6 @@ button::-moz-focus-inner {
|
||||
box-shadow: 0 0 8px rgba(0, 0, 0, 0.6);
|
||||
background: black; }
|
||||
|
||||
.mfp-iframe-holder .mfp-close {
|
||||
top: -40px; }
|
||||
|
||||
/* Main image in popup */
|
||||
img.mfp-img {
|
||||
width: auto;
|
||||
@ -2485,6 +2468,8 @@ img.mfp-img {
|
||||
margin: 0 auto; }
|
||||
|
||||
/* The shadow behind the image */
|
||||
.mfp-figure {
|
||||
line-height: 0; }
|
||||
.mfp-figure:after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
@ -2498,9 +2483,13 @@ img.mfp-img {
|
||||
z-index: -1;
|
||||
box-shadow: 0 0 8px rgba(0, 0, 0, 0.6);
|
||||
background: #444444; }
|
||||
|
||||
.mfp-figure {
|
||||
line-height: 0; }
|
||||
.mfp-figure small {
|
||||
color: #bdbdbd;
|
||||
display: block;
|
||||
font-size: 12px;
|
||||
line-height: 14px; }
|
||||
.mfp-figure figure {
|
||||
margin: 0; }
|
||||
|
||||
.mfp-bottom-bar {
|
||||
margin-top: -36px;
|
||||
@ -2514,15 +2503,9 @@ img.mfp-img {
|
||||
text-align: left;
|
||||
line-height: 18px;
|
||||
color: #f3f3f3;
|
||||
word-break: break-word;
|
||||
word-wrap: break-word;
|
||||
padding-right: 36px; }
|
||||
|
||||
.mfp-figure small {
|
||||
color: #bdbdbd;
|
||||
display: block;
|
||||
font-size: 12px;
|
||||
line-height: 14px; }
|
||||
|
||||
.mfp-image-holder .mfp-content {
|
||||
max-width: 100%; }
|
||||
|
||||
@ -2536,15 +2519,14 @@ img.mfp-img {
|
||||
.mfp-img-mobile .mfp-image-holder {
|
||||
padding-left: 0;
|
||||
padding-right: 0; }
|
||||
|
||||
.mfp-img-mobile img.mfp-img {
|
||||
padding: 0; }
|
||||
|
||||
/* The shadow behind the image */
|
||||
.mfp-img-mobile .mfp-figure:after {
|
||||
top: 0;
|
||||
bottom: 0; }
|
||||
|
||||
.mfp-img-mobile .mfp-figure small {
|
||||
display: inline;
|
||||
margin-left: 5px; }
|
||||
.mfp-img-mobile .mfp-bottom-bar {
|
||||
background: rgba(0, 0, 0, 0.6);
|
||||
bottom: 0;
|
||||
@ -2555,14 +2537,11 @@ img.mfp-img {
|
||||
-webkit-box-sizing: border-box;
|
||||
-moz-box-sizing: border-box;
|
||||
box-sizing: border-box; }
|
||||
|
||||
.mfp-img-mobile .mfp-bottom-bar:empty {
|
||||
padding: 0; }
|
||||
|
||||
.mfp-img-mobile .mfp-counter {
|
||||
right: 5px;
|
||||
top: 3px; }
|
||||
|
||||
.mfp-img-mobile .mfp-close {
|
||||
top: 0;
|
||||
right: 0;
|
||||
@ -2572,27 +2551,22 @@ img.mfp-img {
|
||||
background: rgba(0, 0, 0, 0.6);
|
||||
position: fixed;
|
||||
text-align: center;
|
||||
padding: 0; }
|
||||
padding: 0; } }
|
||||
|
||||
.mfp-img-mobile .mfp-figure small {
|
||||
display: inline;
|
||||
margin-left: 5px; } }
|
||||
@media all and (max-width: 900px) {
|
||||
.mfp-arrow {
|
||||
-webkit-transform: scale(0.75);
|
||||
transform: scale(0.75); }
|
||||
|
||||
.mfp-arrow-left {
|
||||
-webkit-transform-origin: 0;
|
||||
transform-origin: 0; }
|
||||
|
||||
.mfp-arrow-right {
|
||||
-webkit-transform-origin: 100%;
|
||||
transform-origin: 100%; }
|
||||
|
||||
.mfp-container {
|
||||
padding-left: 6px;
|
||||
padding-right: 6px; } }
|
||||
|
||||
.mfp-ie7 .mfp-img {
|
||||
padding: 0; }
|
||||
.mfp-ie7 .mfp-bottom-bar {
|
||||
|
Loading…
x
Reference in New Issue
Block a user