Remove trailing whitespace

This commit is contained in:
Craig Dodd
2015-04-17 11:43:36 +01:00
parent 3d685a192f
commit f06b4c163d
31 changed files with 345 additions and 345 deletions

View File

@@ -5,9 +5,9 @@
/*>>core*/
/**
*
*
* Magnific Popup Core JS file
*
*
*/
@@ -29,7 +29,7 @@ var CLOSE_EVENT = 'Close',
/**
* Private vars
* Private vars
*/
var mfp, // As we have only one instance of MagnificPopup object, we define it locally to not to use 'this'
MagnificPopup = function(){},
@@ -97,15 +97,15 @@ var _mfpOn = function(name, f) {
v = ['ms','O','Moz','Webkit']; // 'v' for vendor
if( s['transition'] !== undefined ) {
return true;
return true;
}
while( v.length ) {
if( v.pop() + 'Transition' in s ) {
return true;
}
}
return false;
};
@@ -119,12 +119,12 @@ MagnificPopup.prototype = {
constructor: MagnificPopup,
/**
* Initializes Magnific Popup plugin.
* Initializes Magnific Popup plugin.
* This function is triggered only once when $.fn.magnificPopup or $.magnificPopup is executed
*/
init: function() {
var appVersion = navigator.appVersion;
mfp.isIE7 = appVersion.indexOf("MSIE 7.") !== -1;
mfp.isIE7 = appVersion.indexOf("MSIE 7.") !== -1;
mfp.isIE8 = appVersion.indexOf("MSIE 8.") !== -1;
mfp.isLowIE = mfp.isIE7 || mfp.isIE8;
mfp.isAndroid = (/android/gi).test(appVersion);
@@ -151,7 +151,7 @@ MagnificPopup.prototype = {
var i;
if(data.isObj === false) {
if(data.isObj === false) {
// convert jQuery collection to array to avoid conflicts later
mfp.items = data.items.toArray();
@@ -178,8 +178,8 @@ MagnificPopup.prototype = {
mfp.updateItemHTML();
return;
}
mfp.types = [];
mfp.types = [];
_wrapClasses = '';
if(data.mainEl && data.mainEl.length) {
mfp.ev = data.mainEl.eq(0);
@@ -198,7 +198,7 @@ MagnificPopup.prototype = {
mfp.st = $.extend(true, {}, $.magnificPopup.defaults, data );
mfp.st = $.extend(true, {}, $.magnificPopup.defaults, data );
mfp.fixedContentPos = mfp.st.fixedContentPos === 'auto' ? !mfp.probablyMobile : mfp.st.fixedContentPos;
if(mfp.st.modal) {
@@ -207,7 +207,7 @@ MagnificPopup.prototype = {
mfp.st.showCloseBtn = false;
mfp.st.enableEscapeKey = false;
}
// Building markup
// main containers are created only once
@@ -259,7 +259,7 @@ MagnificPopup.prototype = {
_wrapClasses += ' mfp-align-top';
}
if(mfp.fixedContentPos) {
mfp.wrap.css({
@@ -268,7 +268,7 @@ MagnificPopup.prototype = {
overflowY: mfp.st.overflowY
});
} else {
mfp.wrap.css({
mfp.wrap.css({
top: _window.scrollTop(),
position: 'absolute'
});
@@ -280,7 +280,7 @@ MagnificPopup.prototype = {
});
}
if(mfp.st.enableEscapeKey) {
// Close on ESC key
@@ -299,7 +299,7 @@ MagnificPopup.prototype = {
if(!mfp.st.closeOnContentClick) {
_wrapClasses += ' mfp-auto-cursor';
}
if(_wrapClasses)
mfp.wrap.addClass(_wrapClasses);
@@ -307,7 +307,7 @@ MagnificPopup.prototype = {
// this triggers recalculation of layout, so we get it once to not to trigger twice
var windowHeight = mfp.wH = _window.height();
var windowStyles = {};
if( mfp.fixedContentPos ) {
@@ -328,8 +328,8 @@ MagnificPopup.prototype = {
}
}
var classesToadd = mfp.st.mainClass;
if(mfp.isIE7) {
classesToadd += ' mfp-ie7';
@@ -345,16 +345,16 @@ MagnificPopup.prototype = {
// remove scrollbar, add margin e.t.c
$('html').css(windowStyles);
// add everything to DOM
mfp.bgOverlay.add(mfp.wrap).prependTo( mfp.st.prependTo || _body );
// Save last focused element
mfp._lastFocusedEl = document.activeElement;
// Wait for next cycle to allow CSS transition
setTimeout(function() {
if(mfp.content) {
mfp._addClassToMFP(READY_CLASS);
mfp._setFocus();
@@ -362,7 +362,7 @@ MagnificPopup.prototype = {
// 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, mfp._onFocusIn);
@@ -421,7 +421,7 @@ MagnificPopup.prototype = {
}
$('html').css(windowStyles);
}
_document.off('keyup' + EVENT_NS + ' focusin' + EVENT_NS);
mfp.ev.off(EVENT_NS);
@@ -441,14 +441,14 @@ MagnificPopup.prototype = {
if(mfp._lastFocusedEl) {
$(mfp._lastFocusedEl).focus(); // put tab focus back
}
mfp.currItem = null;
mfp.currItem = null;
mfp.content = null;
mfp.currTemplate = null;
mfp.prevHeight = 0;
_mfpTrigger(AFTER_CLOSE_EVENT);
},
updateSize: function(winHeight) {
if(mfp.isIOS) {
@@ -485,17 +485,17 @@ MagnificPopup.prototype = {
item = mfp.parseEl( mfp.index );
}
var type = item.type;
var type = item.type;
_mfpTrigger('BeforeChange', [mfp.currItem ? mfp.currItem.type : '', type]);
// BeforeChange event works like so:
// _mfpOn('BeforeChange', function(e, prevType, newType) { });
mfp.currItem = item;
if(!mfp.currTemplate[type]) {
var markup = mfp.st[type] ? mfp.st[type].markup : false;
@@ -514,7 +514,7 @@ MagnificPopup.prototype = {
if(_prevContentType && _prevContentType !== item.type) {
mfp.container.removeClass('mfp-'+_prevContentType+'-holder');
}
var newContent = mfp['get' + type.charAt(0).toUpperCase() + type.slice(1)](item, mfp.currTemplate[type]);
mfp.appendContent(newContent, type);
@@ -522,7 +522,7 @@ MagnificPopup.prototype = {
_mfpTrigger(CHANGE_EVENT, item);
_prevContentType = item.type;
// Append container back after its content changed
mfp.container.prepend(mfp.contentContainer);
@@ -535,7 +535,7 @@ MagnificPopup.prototype = {
*/
appendContent: function(newContent, type) {
mfp.content = newContent;
if(newContent) {
if(mfp.st.showCloseBtn && mfp.st.closeBtnInside &&
mfp.currTemplate[type] === true) {
@@ -558,7 +558,7 @@ MagnificPopup.prototype = {
/**
* Creates Magnific Popup data object based on given data
* @param {int} index Index of item to parse
@@ -612,11 +612,11 @@ MagnificPopup.prototype = {
if(!options) {
options = {};
}
}
var eName = 'click.magnificPopup';
options.mainEl = el;
if(options.items) {
options.isObj = true;
el.off(eName).on(eName, eHandler);
@@ -651,7 +651,7 @@ MagnificPopup.prototype = {
}
}
}
if(e.type) {
e.preventDefault();
@@ -660,7 +660,7 @@ MagnificPopup.prototype = {
e.stopPropagation();
}
}
options.el = $(e.mfpEl);
if(options.delegate) {
@@ -829,14 +829,14 @@ $.magnificPopup = {
modules: [],
open: function(options, index) {
_checkInstance();
_checkInstance();
if(!options) {
options = {};
} else {
options = $.extend(true, {}, options);
}
options.isObj = true;
options.index = index || 0;
@@ -851,16 +851,16 @@ $.magnificPopup = {
if(module.options) {
$.magnificPopup.defaults[name] = module.options;
}
$.extend(this.proto, module.proto);
$.extend(this.proto, module.proto);
this.modules.push(name);
},
defaults: {
defaults: {
// Info about options is in docs:
// http://dimsemenov.com/plugins/magnific-popup/documentation.html#options
disableOn: 0,
disableOn: 0,
key: null,
@@ -871,12 +871,12 @@ $.magnificPopup = {
preloader: true,
focus: '', // CSS selector of input to focus after popup is opened
closeOnContentClick: false,
closeOnBgClick: true,
closeBtnInside: true,
closeBtnInside: true,
showCloseBtn: true,
@@ -885,13 +885,13 @@ $.magnificPopup = {
modal: false,
alignTop: false,
removalDelay: 0,
prependTo: null,
fixedContentPos: 'auto',
fixedContentPos: 'auto',
fixedBgPos: 'auto',
overflowY: 'auto',
@@ -938,9 +938,9 @@ $.fn.magnificPopup = function(options) {
} else {
// clone options obj
options = $.extend(true, {}, options);
/*
* As Zepto doesn't support .data() method for objects
* As Zepto doesn't support .data() method for objects
* and it works only in normal browsers
* we assign "options" object directly to the DOM element. FTW!
*/
@@ -982,7 +982,7 @@ console.log('Test #2:', performance.now() - start);
var INLINE_NS = 'inline',
_hiddenClass,
_inlinePlaceholder,
_inlinePlaceholder,
_lastInlineElement,
_putInlineElementsBack = function() {
if(_lastInlineElement) {
@@ -1130,14 +1130,14 @@ $.magnificPopup.registerModule(AJAX_NS, {
/*>>ajax*/
/*>>image*/
var _imgInterval,
_getTitle = function(item) {
if(item.data && item.data.title !== undefined)
if(item.data && item.data.title !== undefined)
return item.data.title;
var src = mfp.st.image.titleSrc;
@@ -1168,7 +1168,7 @@ $.magnificPopup.registerModule('image', {
'</figure>'+
'</div>',
cursor: 'mfp-zoom-out-cur',
titleSrc: 'title',
titleSrc: 'title',
verticalFit: true,
tError: '<a href="%url%">The image</a> could not be loaded.'
},
@@ -1213,13 +1213,13 @@ $.magnificPopup.registerModule('image', {
},
_onImageHasSize: function(item) {
if(item.img) {
item.hasSize = true;
if(_imgInterval) {
clearInterval(_imgInterval);
}
item.isCheckingImgSize = false;
_mfpTrigger('ImageHasSize', item);
@@ -1227,7 +1227,7 @@ $.magnificPopup.registerModule('image', {
if(item.imgHidden) {
if(mfp.content)
mfp.content.removeClass('mfp-loading');
item.imgHidden = false;
}
@@ -1280,7 +1280,7 @@ $.magnificPopup.registerModule('image', {
if(item) {
if (item.img[0].complete) {
item.img.off('.mfploader');
if(item === mfp.currItem){
mfp._onImageHasSize(item);
@@ -1291,7 +1291,7 @@ $.magnificPopup.registerModule('image', {
item.loaded = true;
_mfpTrigger('ImageLoadComplete');
}
else {
// if image complete check fails 200 times (20 sec), we assume that there was an error.
@@ -1338,7 +1338,7 @@ $.magnificPopup.registerModule('image', {
img = item.img[0];
if(img.naturalWidth > 0) {
item.hasSize = true;
} else if(!img.width) {
} else if(!img.width) {
item.hasSize = false;
}
}
@@ -1370,7 +1370,7 @@ $.magnificPopup.registerModule('image', {
item.imgHidden = true;
template.addClass('mfp-loading');
mfp.findImageSize(item);
}
}
return template;
}
@@ -1387,7 +1387,7 @@ var hasMozTransform,
if(hasMozTransform === undefined) {
hasMozTransform = document.createElement('p').style.MozTransform !== undefined;
}
return hasMozTransform;
return hasMozTransform;
};
$.magnificPopup.registerModule('zoom', {
@@ -1407,7 +1407,7 @@ $.magnificPopup.registerModule('zoom', {
var zoomSt = mfp.st.zoom,
ns = '.zoom',
image;
if(!zoomSt.enabled || !mfp.supportsTransition) {
return;
}
@@ -1443,7 +1443,7 @@ $.magnificPopup.registerModule('zoom', {
mfp.content.css('visibility', 'hidden');
// Basically, all code below does is clones existing image, puts in on top of the current one and animated it
image = mfp._getItemToZoom();
if(!image) {
@@ -1451,8 +1451,8 @@ $.magnificPopup.registerModule('zoom', {
return;
}
animatedImg = getElToAnimate(image);
animatedImg = getElToAnimate(image);
animatedImg.css( mfp._getOffset() );
mfp.wrap.append(animatedImg);
@@ -1467,7 +1467,7 @@ $.magnificPopup.registerModule('zoom', {
animatedImg.remove();
image = animatedImg = null;
_mfpTrigger('ZoomAnimationEnded');
}, 16); // avoid blink when switching images
}, 16); // avoid blink when switching images
}, duration); // this timeout equals animation duration
@@ -1491,12 +1491,12 @@ $.magnificPopup.registerModule('zoom', {
}
animatedImg = getElToAnimate(image);
}
animatedImg.css( mfp._getOffset(true) );
mfp.wrap.append(animatedImg);
mfp.content.css('visibility', 'hidden');
setTimeout(function() {
animatedImg.css( mfp._getOffset() );
}, 16);
@@ -1511,7 +1511,7 @@ $.magnificPopup.registerModule('zoom', {
animatedImg.remove();
}
image = null;
}
}
});
},
@@ -1543,7 +1543,7 @@ $.magnificPopup.registerModule('zoom', {
/*
Animating left + top + width/height looks glitchy in Firefox, but perfect in Chrome. And vice-versa.
*/
@@ -1574,11 +1574,11 @@ $.magnificPopup.registerModule('zoom', {
var IFRAME_NS = 'iframe',
_emptyPage = '//about:blank',
_fixIframeBugs = function(isShowing) {
if(mfp.currTemplate[IFRAME_NS]) {
var el = mfp.currTemplate[IFRAME_NS].find('iframe');
if(el.length) {
if(el.length) {
// reset src after the popup is closed to avoid "video keeps playing after popup is closed" bug
if(!isShowing) {
el[0].src = _emptyPage;
@@ -1605,8 +1605,8 @@ $.magnificPopup.registerModule(IFRAME_NS, {
// we don't care and support only one default type of URL by default
patterns: {
youtube: {
index: 'youtube.com',
id: 'v=',
index: 'youtube.com',
id: 'v=',
src: '//www.youtube.com/embed/%id%?autoplay=1'
},
vimeo: {
@@ -1631,7 +1631,7 @@ $.magnificPopup.registerModule(IFRAME_NS, {
_fixIframeBugs(); // iframe if removed
} else if(newType === IFRAME_NS) {
_fixIframeBugs(true); // iframe is showing
}
}
}// else {
// iframe source is switched, don't do anything
//}
@@ -1645,7 +1645,7 @@ $.magnificPopup.registerModule(IFRAME_NS, {
getIframe: function(item, template) {
var embedSrc = item.src;
var iframeSt = mfp.st.iframe;
$.each(iframeSt.patterns, function() {
if(embedSrc.indexOf( this.index ) > -1) {
if(this.id) {
@@ -1659,7 +1659,7 @@ $.magnificPopup.registerModule(IFRAME_NS, {
return false; // break;
}
});
var dataObj = {};
if(iframeSt.srcAction) {
dataObj[iframeSt.srcAction] = embedSrc;
@@ -1716,7 +1716,7 @@ $.magnificPopup.registerModule('gallery', {
supportsFastClick = Boolean($.fn.mfpFastClick);
mfp.direction = true; // true - next, false - prev
if(!gSt || !gSt.enabled ) return false;
_wrapClasses += ' mfp-gallery';
@@ -1755,16 +1755,16 @@ $.magnificPopup.registerModule('gallery', {
_mfpOn('BuildControls' + ns, function() {
if(mfp.items.length > 1 && gSt.arrows && !mfp.arrowLeft) {
var markup = gSt.arrowMarkup,
arrowLeft = mfp.arrowLeft = $( markup.replace(/%title%/gi, gSt.tPrev).replace(/%dir%/gi, 'left') ).addClass(PREVENT_CLOSE_CLASS),
arrowLeft = mfp.arrowLeft = $( markup.replace(/%title%/gi, gSt.tPrev).replace(/%dir%/gi, 'left') ).addClass(PREVENT_CLOSE_CLASS),
arrowRight = mfp.arrowRight = $( markup.replace(/%title%/gi, gSt.tNext).replace(/%dir%/gi, '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) {
@@ -1784,21 +1784,21 @@ $.magnificPopup.registerModule('gallery', {
mfp._preloadTimeout = setTimeout(function() {
mfp.preloadNearbyImages();
mfp._preloadTimeout = null;
}, 16);
}, 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);
@@ -1963,11 +1963,11 @@ $.magnificPopup.registerModule(RETINA_NS, {
*
* 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() {
@@ -2046,4 +2046,4 @@ $.magnificPopup.registerModule(RETINA_NS, {
})();
/*>>fastclick*/
_checkInstance(); })(window.jQuery || window.Zepto);
_checkInstance(); })(window.jQuery || window.Zepto);