1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

update components

This commit is contained in:
Luke Pulverenti 2016-02-07 14:19:56 -05:00
parent f4fb963fab
commit 484e60e328
23 changed files with 494 additions and 218 deletions

View file

@ -5,7 +5,7 @@
"url": "https://github.com/nolimits4web/Swiper.git"
},
"description": "Most modern mobile touch slider and framework with hardware accelerated transitions",
"version": "3.3.0",
"version": "3.3.1",
"author": "Vladimir Kharlampidi",
"homepage": "http://www.idangero.us/swiper/",
"keywords": [
@ -45,14 +45,13 @@
"playground",
"package.json"
],
"_release": "3.3.0",
"_release": "3.3.1",
"_resolution": {
"type": "version",
"tag": "v3.3.0",
"commit": "d1b5b19c872068ebb14bfb854af838c30285cecd"
"tag": "v3.3.1",
"commit": "33101a659e579146f5462e4a9d6a7fdfd7436c35"
},
"_source": "git://github.com/nolimits4web/Swiper.git",
"_target": "~3.3.0",
"_originalSource": "swiper",
"_direct": true
"_originalSource": "swiper"
}

View file

@ -1,5 +1,14 @@
# Change Log
## Swiper 3.3.1 - Released on February 7, 2016
* New `uniqueNavElements` parameter. If enabled (by default) and navigation elements' parameters passed as the string (like `.pagination`) then Swiper will look for such elements through child elements first. Applies for pagination, prev/next buttons and scrollbar
* New `onPaginationRendered` callback. Will be fired after pagination elements generated and added to DOM
* New `.reLoop()` method, which combines `.destroyLoop()` + `.createLoop()` methods with additional positioning fixes. Useful to call after you have changed `slidesPerView` parameter, it will dynamically recreate duplicated slides required for loop
* Fixed not working mousewheel control in IE 11
* Fixed issue with lazy loading images not being recalculated after window resize
* Fixed issues when using loop with breakpoints changing `slidesPerView/Group` parameters
* Numerous minor fixes
## Swiper 3.3.0 - Released on January 10, 2016
* New 3D Flip effect. Can be enabled with `effect: 'flip' parameter
* New types of pagination with new parameters:

View file

@ -5,7 +5,7 @@
"url": "https://github.com/nolimits4web/Swiper.git"
},
"description": "Most modern mobile touch slider and framework with hardware accelerated transitions",
"version": "3.3.0",
"version": "3.3.1",
"author": "Vladimir Kharlampidi",
"homepage": "http://www.idangero.us/swiper/",
"keywords": ["swiper", "swipe", "slider", "touch", "ios", "mobile", "cordova", "phonegap", "app", "framework", "carousel", "gallery"],

View file

@ -2,7 +2,7 @@
"name": "swiper",
"repo": "https://github.com/nolimits4web/Swiper.git",
"description": "Most modern mobile touch slider and framework with hardware accelerated transitions",
"version": "3.3.0",
"version": "3.3.1",
"keywords": ["swiper", "swipe", "slider", "touch", "ios", "mobile", "cordova", "phonegap", "app", "framework", "carousel", "gallery"],
"dependencies": {
},

View file

@ -1,5 +1,5 @@
/**
* Swiper 3.3.0
* Swiper 3.3.1
* Most modern mobile touch slider and framework with hardware accelerated transitions
*
* http://www.idangero.us/swiper/
@ -10,7 +10,7 @@
*
* Licensed under MIT
*
* Released on: January 10, 2016
* Released on: February 7, 2016
*/
.swiper-container {
margin: 0 auto;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1,5 +1,5 @@
/**
* Swiper 3.3.0
* Swiper 3.3.1
* Most modern mobile touch slider and framework with hardware accelerated transitions
*
* http://www.idangero.us/swiper/
@ -10,7 +10,7 @@
*
* Licensed under MIT
*
* Released on: January 10, 2016
* Released on: February 7, 2016
*/
(function () {
'use strict';
@ -110,6 +110,8 @@
onlyExternal: false,
threshold: 0,
touchMoveStopPropagation: true,
// Unique Navigation Elements
uniqueNavElements: true,
// Pagination
pagination: null,
paginationElement: 'span',
@ -298,10 +300,14 @@
var breakpoint = s.getActiveBreakpoint();
if (breakpoint && s.currentBreakpoint !== breakpoint) {
var breakPointsParams = breakpoint in s.params.breakpoints ? s.params.breakpoints[breakpoint] : s.originalParams;
var needsReLoop = s.params.loop && (breakPointsParams.slidesPerView !== s.params.slidesPerView);
for ( var param in breakPointsParams ) {
s.params[param] = breakPointsParams[param];
}
s.currentBreakpoint = breakpoint;
if(needsReLoop && s.destroyLoop) {
s.reLoop(true);
}
}
};
// Set breakpoint on load
@ -315,10 +321,12 @@
s.container = $(container);
if (s.container.length === 0) return;
if (s.container.length > 1) {
var swipers = [];
s.container.each(function () {
new Swiper(this, params);
var container = this;
swipers.push(new Swiper(this, params));
});
return;
return swipers;
}
// Save instance in container HTML Element and in data
@ -387,6 +395,10 @@
// Pagination
if (s.params.pagination) {
s.paginationContainer = $(s.params.pagination);
if (s.params.uniqueNavElements && typeof s.params.pagination === 'string' && s.paginationContainer.length > 1 && s.container.find(s.params.pagination).length === 1) {
s.paginationContainer = s.container.find(s.params.pagination);
}
if (s.params.paginationType === 'bullets' && s.params.paginationClickable) {
s.paginationContainer.addClass('swiper-pagination-clickable');
}
@ -395,6 +407,21 @@
}
s.paginationContainer.addClass('swiper-pagination-' + s.params.paginationType);
}
// Next/Prev Buttons
if (s.params.nextButton || s.params.prevButton) {
if (s.params.nextButton) {
s.nextButton = $(s.params.nextButton);
if (s.params.uniqueNavElements && typeof s.params.nextButton === 'string' && s.nextButton.length > 1 && s.container.find(s.params.nextButton).length === 1) {
s.nextButton = s.container.find(s.params.nextButton);
}
}
if (s.params.prevButton) {
s.prevButton = $(s.params.prevButton);
if (s.params.uniqueNavElements && typeof s.params.prevButton === 'string' && s.prevButton.length > 1 && s.container.find(s.params.prevButton).length === 1) {
s.prevButton = s.container.find(s.params.prevButton);
}
}
}
// Is Horizontal
s.isHorizontal = function () {
@ -642,6 +669,7 @@
i,
prevSlideSize = 0,
index = 0;
if (typeof s.size === 'undefined') return;
if (typeof spaceBetween === 'string' && spaceBetween.indexOf('%') >= 0) {
spaceBetween = parseFloat(spaceBetween.replace('%', '')) / 100 * s.size;
}
@ -780,7 +808,7 @@
}
}
s.snapGrid = newSlidesGrid;
if (Math.floor(s.virtualSize - s.size) > Math.floor(s.snapGrid[s.snapGrid.length - 1])) {
if (Math.floor(s.virtualSize - s.size) - Math.floor(s.snapGrid[s.snapGrid.length - 1]) > 1) {
s.snapGrid.push(s.virtualSize - s.size);
}
}
@ -902,8 +930,16 @@
var activeSlide = s.slides.eq(s.activeIndex);
// Active classes
activeSlide.addClass(s.params.slideActiveClass);
activeSlide.next('.' + s.params.slideClass).addClass(s.params.slideNextClass);
activeSlide.prev('.' + s.params.slideClass).addClass(s.params.slidePrevClass);
// Next Slide
var nextSlide = activeSlide.next('.' + s.params.slideClass).addClass(s.params.slideNextClass);
if (s.params.loop && nextSlide.length === 0) {
s.slides.eq(0).addClass(s.params.slideNextClass);
}
// Prev Slide
var prevSlide = activeSlide.prev('.' + s.params.slideClass).addClass(s.params.slidePrevClass);
if (s.params.loop && prevSlide.length === 0) {
s.slides.eq(-1).addClass(s.params.slidePrevClass);
}
// Pagination
if (s.paginationContainer && s.paginationContainer.length > 0) {
@ -911,7 +947,7 @@
var current,
total = s.params.loop ? Math.ceil((s.slides.length - s.loopedSlides * 2) / s.params.slidesPerGroup) : s.snapGrid.length;
if (s.params.loop) {
current = Math.ceil(s.activeIndex - s.loopedSlides)/s.params.slidesPerGroup;
current = Math.ceil((s.activeIndex - s.loopedSlides)/s.params.slidesPerGroup);
if (current > s.slides.length - 1 - s.loopedSlides * 2) {
current = current - (s.slides.length - s.loopedSlides * 2);
}
@ -954,29 +990,30 @@
}
if (s.params.paginationType === 'custom' && s.params.paginationCustomRender) {
s.paginationContainer.html(s.params.paginationCustomRender(s, current + 1, total));
s.emit('onPaginationRendered', s, s.paginationContainer[0]);
}
}
// Next/active buttons
if (!s.params.loop) {
if (s.params.prevButton) {
if (s.params.prevButton && s.prevButton && s.prevButton.length > 0) {
if (s.isBeginning) {
$(s.params.prevButton).addClass(s.params.buttonDisabledClass);
if (s.params.a11y && s.a11y) s.a11y.disable($(s.params.prevButton));
s.prevButton.addClass(s.params.buttonDisabledClass);
if (s.params.a11y && s.a11y) s.a11y.disable(s.prevButton);
}
else {
$(s.params.prevButton).removeClass(s.params.buttonDisabledClass);
if (s.params.a11y && s.a11y) s.a11y.enable($(s.params.prevButton));
s.prevButton.removeClass(s.params.buttonDisabledClass);
if (s.params.a11y && s.a11y) s.a11y.enable(s.prevButton);
}
}
if (s.params.nextButton) {
if (s.params.nextButton && s.nextButton && s.nextButton.length > 0) {
if (s.isEnd) {
$(s.params.nextButton).addClass(s.params.buttonDisabledClass);
if (s.params.a11y && s.a11y) s.a11y.disable($(s.params.nextButton));
s.nextButton.addClass(s.params.buttonDisabledClass);
if (s.params.a11y && s.a11y) s.a11y.disable(s.nextButton);
}
else {
$(s.params.nextButton).removeClass(s.params.buttonDisabledClass);
if (s.params.a11y && s.a11y) s.a11y.enable($(s.params.nextButton));
s.nextButton.removeClass(s.params.buttonDisabledClass);
if (s.params.a11y && s.a11y) s.a11y.enable(s.nextButton);
}
}
}
@ -1026,6 +1063,9 @@
}
s.paginationContainer.html(paginationHTML);
}
if (s.params.paginationType !== 'custom') {
s.emit('onPaginationRendered', s, s.paginationContainer[0]);
}
}
};
/*=========================
@ -1097,6 +1137,7 @@
if (s.controller && s.controller.spline) {
s.controller.spline = undefined;
}
var slideChangedBySlideTo = false;
if (s.params.freeMode) {
var newTranslate = Math.min(Math.max(s.translate, s.maxTranslate()), s.minTranslate());
s.setWrapperTranslate(newTranslate);
@ -1110,12 +1151,15 @@
else {
s.updateClasses();
if ((s.params.slidesPerView === 'auto' || s.params.slidesPerView > 1) && s.isEnd && !s.params.centeredSlides) {
s.slideTo(s.slides.length - 1, 0, false, true);
slideChangedBySlideTo = s.slideTo(s.slides.length - 1, 0, false, true);
}
else {
s.slideTo(s.activeIndex, 0, false, true);
slideChangedBySlideTo = s.slideTo(s.activeIndex, 0, false, true);
}
}
if (s.params.lazyLoading && !slideChangedBySlideTo && s.lazy) {
s.lazy.load();
}
// Return locks after resize
s.params.allowSwipeToPrev = allowSwipeToPrev;
s.params.allowSwipeToNext = allowSwipeToNext;
@ -1171,23 +1215,23 @@
window[action]('resize', s.onResize);
// Next, Prev, Index
if (s.params.nextButton) {
$(s.params.nextButton)[actionDom]('click', s.onClickNext);
if (s.params.a11y && s.a11y) $(s.params.nextButton)[actionDom]('keydown', s.a11y.onEnterKey);
if (s.params.nextButton && s.nextButton && s.nextButton.length > 0) {
s.nextButton[actionDom]('click', s.onClickNext);
if (s.params.a11y && s.a11y) s.nextButton[actionDom]('keydown', s.a11y.onEnterKey);
}
if (s.params.prevButton) {
$(s.params.prevButton)[actionDom]('click', s.onClickPrev);
if (s.params.a11y && s.a11y) $(s.params.prevButton)[actionDom]('keydown', s.a11y.onEnterKey);
if (s.params.prevButton && s.prevButton && s.prevButton.length > 0) {
s.prevButton[actionDom]('click', s.onClickPrev);
if (s.params.a11y && s.a11y) s.prevButton[actionDom]('keydown', s.a11y.onEnterKey);
}
if (s.params.pagination && s.params.paginationClickable) {
$(s.paginationContainer)[actionDom]('click', '.' + s.params.bulletClass, s.onClickIndex);
if (s.params.a11y && s.a11y) $(s.paginationContainer)[actionDom]('keydown', '.' + s.params.bulletClass, s.a11y.onEnterKey);
s.paginationContainer[actionDom]('click', '.' + s.params.bulletClass, s.onClickIndex);
if (s.params.a11y && s.a11y) s.paginationContainer[actionDom]('keydown', '.' + s.params.bulletClass, s.a11y.onEnterKey);
}
// Prevent Links Clicks
if (s.params.preventClicks || s.params.preventClicksPropagation) touchEventsTarget[action]('click', s.preventClicks, true);
};
s.attachEvents = function (detach) {
s.attachEvents = function () {
s.initEvents();
};
s.detachEvents = function () {
@ -1383,7 +1427,11 @@
s.onTouchMove = function (e) {
if (e.originalEvent) e = e.originalEvent;
if (isTouchEvent && e.type === 'mousemove') return;
if (e.preventedByNestedSwiper) return;
if (e.preventedByNestedSwiper) {
s.touches.startX = e.type === 'touchmove' ? e.targetTouches[0].pageX : e.pageX;
s.touches.startY = e.type === 'touchmove' ? e.targetTouches[0].pageY : e.pageY;
return;
}
if (s.params.onlyExternal) {
// isMoved = true;
s.allowClick = false;
@ -2148,6 +2196,16 @@
s.wrapper.children('.' + s.params.slideClass + '.' + s.params.slideDuplicateClass).remove();
s.slides.removeAttr('data-swiper-slide-index');
};
s.reLoop = function (updatePosition) {
var oldIndex = s.activeIndex - s.loopedSlides;
s.destroyLoop();
s.createLoop();
s.updateSlidesSize();
if (updatePosition) {
s.slideTo(oldIndex + s.loopedSlides, 0, false);
}
};
s.fixLoop = function () {
var newIndex;
//Fix For Negative Oversliding
@ -2555,7 +2613,7 @@
srcset = _img.attr('data-srcset');
s.loadImage(_img[0], (src || background), srcset, false, function () {
if (background) {
_img.css('background-image', 'url(' + background + ')');
_img.css('background-image', 'url("' + background + '")');
_img.removeAttr('data-background');
}
else {
@ -2734,6 +2792,9 @@
if (!s.params.scrollbar) return;
var sb = s.scrollbar;
sb.track = $(s.params.scrollbar);
if (s.params.uniqueNavElements && typeof s.params.scrollbar === 'string' && sb.track.length > 1 && s.container.find(s.params.scrollbar).length === 1) {
sb.track = s.container.find(s.params.scrollbar);
}
sb.drag = sb.track.find('.swiper-scrollbar-drag');
if (sb.drag.length === 0) {
sb.drag = $('<div class="swiper-scrollbar-drag"></div>');
@ -3056,8 +3117,14 @@
try {
new window.WheelEvent('wheel');
s.mousewheel.event = 'wheel';
} catch (e) {}
} catch (e) {
if (window.WheelEvent || (s.container[0] && 'wheel' in s.container[0])) {
s.mousewheel.event = 'wheel';
}
}
if (!s.mousewheel.event && window.WheelEvent) {
}
if (!s.mousewheel.event && document.onmousewheel !== undefined) {
s.mousewheel.event = 'mousewheel';
}
@ -3070,10 +3137,9 @@
var we = s.mousewheel.event;
var delta = 0;
var rtlFactor = s.rtl ? -1 : 1;
//Opera & IE
if (e.detail) delta = -e.detail;
//WebKits
else if (we === 'mousewheel') {
if (we === 'mousewheel') {
if (s.params.mousewheelForceToAxis) {
if (s.isHorizontal()) {
if (Math.abs(e.wheelDeltaX) > Math.abs(e.wheelDeltaY)) delta = e.wheelDeltaX * rtlFactor;
@ -3383,17 +3449,15 @@
},
init: function () {
// Setup accessibility
if (s.params.nextButton) {
var nextButton = $(s.params.nextButton);
s.a11y.makeFocusable(nextButton);
s.a11y.addRole(nextButton, 'button');
s.a11y.addLabel(nextButton, s.params.nextSlideMessage);
if (s.params.nextButton && s.nextButton && s.nextButton.length > 0) {
s.a11y.makeFocusable(s.nextButton);
s.a11y.addRole(s.nextButton, 'button');
s.a11y.addLabel(s.nextButton, s.params.nextSlideMessage);
}
if (s.params.prevButton) {
var prevButton = $(s.params.prevButton);
s.a11y.makeFocusable(prevButton);
s.a11y.addRole(prevButton, 'button');
s.a11y.addLabel(prevButton, s.params.prevSlideMessage);
if (s.params.prevButton && s.prevButton && s.prevButton.length > 0) {
s.a11y.makeFocusable(s.prevButton);
s.a11y.addRole(s.prevButton, 'button');
s.a11y.addLabel(s.prevButton, s.params.prevSlideMessage);
}
$(s.container).append(s.a11y.liveRegion);
@ -3711,3 +3775,4 @@ else if (typeof define === 'function' && define.amd) {
return window.Swiper;
});
}
//# sourceMappingURL=maps/swiper.jquery.js.map

File diff suppressed because one or more lines are too long

View file

@ -1,5 +1,5 @@
/**
* Swiper 3.3.0
* Swiper 3.3.1
* Most modern mobile touch slider and framework with hardware accelerated transitions
*
* http://www.idangero.us/swiper/
@ -10,7 +10,7 @@
*
* Licensed under MIT
*
* Released on: January 10, 2016
* Released on: February 7, 2016
*/
(function (root, factory) {
'use strict';
@ -125,6 +125,8 @@
onlyExternal: false,
threshold: 0,
touchMoveStopPropagation: true,
// Unique Navigation Elements
uniqueNavElements: true,
// Pagination
pagination: null,
paginationElement: 'span',
@ -313,10 +315,14 @@
var breakpoint = s.getActiveBreakpoint();
if (breakpoint && s.currentBreakpoint !== breakpoint) {
var breakPointsParams = breakpoint in s.params.breakpoints ? s.params.breakpoints[breakpoint] : s.originalParams;
var needsReLoop = s.params.loop && (breakPointsParams.slidesPerView !== s.params.slidesPerView);
for ( var param in breakPointsParams ) {
s.params[param] = breakPointsParams[param];
}
s.currentBreakpoint = breakpoint;
if(needsReLoop && s.destroyLoop) {
s.reLoop(true);
}
}
};
// Set breakpoint on load
@ -330,10 +336,12 @@
s.container = $(container);
if (s.container.length === 0) return;
if (s.container.length > 1) {
var swipers = [];
s.container.each(function () {
new Swiper(this, params);
var container = this;
swipers.push(new Swiper(this, params));
});
return;
return swipers;
}
// Save instance in container HTML Element and in data
@ -402,6 +410,10 @@
// Pagination
if (s.params.pagination) {
s.paginationContainer = $(s.params.pagination);
if (s.params.uniqueNavElements && typeof s.params.pagination === 'string' && s.paginationContainer.length > 1 && s.container.find(s.params.pagination).length === 1) {
s.paginationContainer = s.container.find(s.params.pagination);
}
if (s.params.paginationType === 'bullets' && s.params.paginationClickable) {
s.paginationContainer.addClass('swiper-pagination-clickable');
}
@ -410,6 +422,21 @@
}
s.paginationContainer.addClass('swiper-pagination-' + s.params.paginationType);
}
// Next/Prev Buttons
if (s.params.nextButton || s.params.prevButton) {
if (s.params.nextButton) {
s.nextButton = $(s.params.nextButton);
if (s.params.uniqueNavElements && typeof s.params.nextButton === 'string' && s.nextButton.length > 1 && s.container.find(s.params.nextButton).length === 1) {
s.nextButton = s.container.find(s.params.nextButton);
}
}
if (s.params.prevButton) {
s.prevButton = $(s.params.prevButton);
if (s.params.uniqueNavElements && typeof s.params.prevButton === 'string' && s.prevButton.length > 1 && s.container.find(s.params.prevButton).length === 1) {
s.prevButton = s.container.find(s.params.prevButton);
}
}
}
// Is Horizontal
s.isHorizontal = function () {
@ -657,6 +684,7 @@
i,
prevSlideSize = 0,
index = 0;
if (typeof s.size === 'undefined') return;
if (typeof spaceBetween === 'string' && spaceBetween.indexOf('%') >= 0) {
spaceBetween = parseFloat(spaceBetween.replace('%', '')) / 100 * s.size;
}
@ -795,7 +823,7 @@
}
}
s.snapGrid = newSlidesGrid;
if (Math.floor(s.virtualSize - s.size) > Math.floor(s.snapGrid[s.snapGrid.length - 1])) {
if (Math.floor(s.virtualSize - s.size) - Math.floor(s.snapGrid[s.snapGrid.length - 1]) > 1) {
s.snapGrid.push(s.virtualSize - s.size);
}
}
@ -917,8 +945,16 @@
var activeSlide = s.slides.eq(s.activeIndex);
// Active classes
activeSlide.addClass(s.params.slideActiveClass);
activeSlide.next('.' + s.params.slideClass).addClass(s.params.slideNextClass);
activeSlide.prev('.' + s.params.slideClass).addClass(s.params.slidePrevClass);
// Next Slide
var nextSlide = activeSlide.next('.' + s.params.slideClass).addClass(s.params.slideNextClass);
if (s.params.loop && nextSlide.length === 0) {
s.slides.eq(0).addClass(s.params.slideNextClass);
}
// Prev Slide
var prevSlide = activeSlide.prev('.' + s.params.slideClass).addClass(s.params.slidePrevClass);
if (s.params.loop && prevSlide.length === 0) {
s.slides.eq(-1).addClass(s.params.slidePrevClass);
}
// Pagination
if (s.paginationContainer && s.paginationContainer.length > 0) {
@ -926,7 +962,7 @@
var current,
total = s.params.loop ? Math.ceil((s.slides.length - s.loopedSlides * 2) / s.params.slidesPerGroup) : s.snapGrid.length;
if (s.params.loop) {
current = Math.ceil(s.activeIndex - s.loopedSlides)/s.params.slidesPerGroup;
current = Math.ceil((s.activeIndex - s.loopedSlides)/s.params.slidesPerGroup);
if (current > s.slides.length - 1 - s.loopedSlides * 2) {
current = current - (s.slides.length - s.loopedSlides * 2);
}
@ -969,29 +1005,30 @@
}
if (s.params.paginationType === 'custom' && s.params.paginationCustomRender) {
s.paginationContainer.html(s.params.paginationCustomRender(s, current + 1, total));
s.emit('onPaginationRendered', s, s.paginationContainer[0]);
}
}
// Next/active buttons
if (!s.params.loop) {
if (s.params.prevButton) {
if (s.params.prevButton && s.prevButton && s.prevButton.length > 0) {
if (s.isBeginning) {
$(s.params.prevButton).addClass(s.params.buttonDisabledClass);
if (s.params.a11y && s.a11y) s.a11y.disable($(s.params.prevButton));
s.prevButton.addClass(s.params.buttonDisabledClass);
if (s.params.a11y && s.a11y) s.a11y.disable(s.prevButton);
}
else {
$(s.params.prevButton).removeClass(s.params.buttonDisabledClass);
if (s.params.a11y && s.a11y) s.a11y.enable($(s.params.prevButton));
s.prevButton.removeClass(s.params.buttonDisabledClass);
if (s.params.a11y && s.a11y) s.a11y.enable(s.prevButton);
}
}
if (s.params.nextButton) {
if (s.params.nextButton && s.nextButton && s.nextButton.length > 0) {
if (s.isEnd) {
$(s.params.nextButton).addClass(s.params.buttonDisabledClass);
if (s.params.a11y && s.a11y) s.a11y.disable($(s.params.nextButton));
s.nextButton.addClass(s.params.buttonDisabledClass);
if (s.params.a11y && s.a11y) s.a11y.disable(s.nextButton);
}
else {
$(s.params.nextButton).removeClass(s.params.buttonDisabledClass);
if (s.params.a11y && s.a11y) s.a11y.enable($(s.params.nextButton));
s.nextButton.removeClass(s.params.buttonDisabledClass);
if (s.params.a11y && s.a11y) s.a11y.enable(s.nextButton);
}
}
}
@ -1041,6 +1078,9 @@
}
s.paginationContainer.html(paginationHTML);
}
if (s.params.paginationType !== 'custom') {
s.emit('onPaginationRendered', s, s.paginationContainer[0]);
}
}
};
/*=========================
@ -1112,6 +1152,7 @@
if (s.controller && s.controller.spline) {
s.controller.spline = undefined;
}
var slideChangedBySlideTo = false;
if (s.params.freeMode) {
var newTranslate = Math.min(Math.max(s.translate, s.maxTranslate()), s.minTranslate());
s.setWrapperTranslate(newTranslate);
@ -1125,12 +1166,15 @@
else {
s.updateClasses();
if ((s.params.slidesPerView === 'auto' || s.params.slidesPerView > 1) && s.isEnd && !s.params.centeredSlides) {
s.slideTo(s.slides.length - 1, 0, false, true);
slideChangedBySlideTo = s.slideTo(s.slides.length - 1, 0, false, true);
}
else {
s.slideTo(s.activeIndex, 0, false, true);
slideChangedBySlideTo = s.slideTo(s.activeIndex, 0, false, true);
}
}
if (s.params.lazyLoading && !slideChangedBySlideTo && s.lazy) {
s.lazy.load();
}
// Return locks after resize
s.params.allowSwipeToPrev = allowSwipeToPrev;
s.params.allowSwipeToNext = allowSwipeToNext;
@ -1186,23 +1230,23 @@
window[action]('resize', s.onResize);
// Next, Prev, Index
if (s.params.nextButton) {
$(s.params.nextButton)[actionDom]('click', s.onClickNext);
if (s.params.a11y && s.a11y) $(s.params.nextButton)[actionDom]('keydown', s.a11y.onEnterKey);
if (s.params.nextButton && s.nextButton && s.nextButton.length > 0) {
s.nextButton[actionDom]('click', s.onClickNext);
if (s.params.a11y && s.a11y) s.nextButton[actionDom]('keydown', s.a11y.onEnterKey);
}
if (s.params.prevButton) {
$(s.params.prevButton)[actionDom]('click', s.onClickPrev);
if (s.params.a11y && s.a11y) $(s.params.prevButton)[actionDom]('keydown', s.a11y.onEnterKey);
if (s.params.prevButton && s.prevButton && s.prevButton.length > 0) {
s.prevButton[actionDom]('click', s.onClickPrev);
if (s.params.a11y && s.a11y) s.prevButton[actionDom]('keydown', s.a11y.onEnterKey);
}
if (s.params.pagination && s.params.paginationClickable) {
$(s.paginationContainer)[actionDom]('click', '.' + s.params.bulletClass, s.onClickIndex);
if (s.params.a11y && s.a11y) $(s.paginationContainer)[actionDom]('keydown', '.' + s.params.bulletClass, s.a11y.onEnterKey);
s.paginationContainer[actionDom]('click', '.' + s.params.bulletClass, s.onClickIndex);
if (s.params.a11y && s.a11y) s.paginationContainer[actionDom]('keydown', '.' + s.params.bulletClass, s.a11y.onEnterKey);
}
// Prevent Links Clicks
if (s.params.preventClicks || s.params.preventClicksPropagation) touchEventsTarget[action]('click', s.preventClicks, true);
};
s.attachEvents = function (detach) {
s.attachEvents = function () {
s.initEvents();
};
s.detachEvents = function () {
@ -1398,7 +1442,11 @@
s.onTouchMove = function (e) {
if (e.originalEvent) e = e.originalEvent;
if (isTouchEvent && e.type === 'mousemove') return;
if (e.preventedByNestedSwiper) return;
if (e.preventedByNestedSwiper) {
s.touches.startX = e.type === 'touchmove' ? e.targetTouches[0].pageX : e.pageX;
s.touches.startY = e.type === 'touchmove' ? e.targetTouches[0].pageY : e.pageY;
return;
}
if (s.params.onlyExternal) {
// isMoved = true;
s.allowClick = false;
@ -2163,6 +2211,16 @@
s.wrapper.children('.' + s.params.slideClass + '.' + s.params.slideDuplicateClass).remove();
s.slides.removeAttr('data-swiper-slide-index');
};
s.reLoop = function (updatePosition) {
var oldIndex = s.activeIndex - s.loopedSlides;
s.destroyLoop();
s.createLoop();
s.updateSlidesSize();
if (updatePosition) {
s.slideTo(oldIndex + s.loopedSlides, 0, false);
}
};
s.fixLoop = function () {
var newIndex;
//Fix For Negative Oversliding
@ -2570,7 +2628,7 @@
srcset = _img.attr('data-srcset');
s.loadImage(_img[0], (src || background), srcset, false, function () {
if (background) {
_img.css('background-image', 'url(' + background + ')');
_img.css('background-image', 'url("' + background + '")');
_img.removeAttr('data-background');
}
else {
@ -2749,6 +2807,9 @@
if (!s.params.scrollbar) return;
var sb = s.scrollbar;
sb.track = $(s.params.scrollbar);
if (s.params.uniqueNavElements && typeof s.params.scrollbar === 'string' && sb.track.length > 1 && s.container.find(s.params.scrollbar).length === 1) {
sb.track = s.container.find(s.params.scrollbar);
}
sb.drag = sb.track.find('.swiper-scrollbar-drag');
if (sb.drag.length === 0) {
sb.drag = $('<div class="swiper-scrollbar-drag"></div>');
@ -3071,8 +3132,14 @@
try {
new window.WheelEvent('wheel');
s.mousewheel.event = 'wheel';
} catch (e) {}
} catch (e) {
if (window.WheelEvent || (s.container[0] && 'wheel' in s.container[0])) {
s.mousewheel.event = 'wheel';
}
}
if (!s.mousewheel.event && window.WheelEvent) {
}
if (!s.mousewheel.event && document.onmousewheel !== undefined) {
s.mousewheel.event = 'mousewheel';
}
@ -3085,10 +3152,9 @@
var we = s.mousewheel.event;
var delta = 0;
var rtlFactor = s.rtl ? -1 : 1;
//Opera & IE
if (e.detail) delta = -e.detail;
//WebKits
else if (we === 'mousewheel') {
if (we === 'mousewheel') {
if (s.params.mousewheelForceToAxis) {
if (s.isHorizontal()) {
if (Math.abs(e.wheelDeltaX) > Math.abs(e.wheelDeltaY)) delta = e.wheelDeltaX * rtlFactor;
@ -3398,17 +3464,15 @@
},
init: function () {
// Setup accessibility
if (s.params.nextButton) {
var nextButton = $(s.params.nextButton);
s.a11y.makeFocusable(nextButton);
s.a11y.addRole(nextButton, 'button');
s.a11y.addLabel(nextButton, s.params.nextSlideMessage);
if (s.params.nextButton && s.nextButton && s.nextButton.length > 0) {
s.a11y.makeFocusable(s.nextButton);
s.a11y.addRole(s.nextButton, 'button');
s.a11y.addLabel(s.nextButton, s.params.nextSlideMessage);
}
if (s.params.prevButton) {
var prevButton = $(s.params.prevButton);
s.a11y.makeFocusable(prevButton);
s.a11y.addRole(prevButton, 'button');
s.a11y.addLabel(prevButton, s.params.prevSlideMessage);
if (s.params.prevButton && s.prevButton && s.prevButton.length > 0) {
s.a11y.makeFocusable(s.prevButton);
s.a11y.addRole(s.prevButton, 'button');
s.a11y.addLabel(s.prevButton, s.params.prevSlideMessage);
}
$(s.container).append(s.a11y.liveRegion);
@ -3703,3 +3767,4 @@
return Swiper;
}));
//# sourceMappingURL=maps/swiper.jquery.umd.js.map

File diff suppressed because one or more lines are too long

View file

@ -1,5 +1,5 @@
/**
* Swiper 3.3.0
* Swiper 3.3.1
* Most modern mobile touch slider and framework with hardware accelerated transitions
*
* http://www.idangero.us/swiper/
@ -10,7 +10,7 @@
*
* Licensed under MIT
*
* Released on: January 10, 2016
* Released on: February 7, 2016
*/
(function () {
'use strict';
@ -110,6 +110,8 @@
onlyExternal: false,
threshold: 0,
touchMoveStopPropagation: true,
// Unique Navigation Elements
uniqueNavElements: true,
// Pagination
pagination: null,
paginationElement: 'span',
@ -298,10 +300,14 @@
var breakpoint = s.getActiveBreakpoint();
if (breakpoint && s.currentBreakpoint !== breakpoint) {
var breakPointsParams = breakpoint in s.params.breakpoints ? s.params.breakpoints[breakpoint] : s.originalParams;
var needsReLoop = s.params.loop && (breakPointsParams.slidesPerView !== s.params.slidesPerView);
for ( var param in breakPointsParams ) {
s.params[param] = breakPointsParams[param];
}
s.currentBreakpoint = breakpoint;
if(needsReLoop && s.destroyLoop) {
s.reLoop(true);
}
}
};
// Set breakpoint on load
@ -315,10 +321,12 @@
s.container = $(container);
if (s.container.length === 0) return;
if (s.container.length > 1) {
var swipers = [];
s.container.each(function () {
new Swiper(this, params);
var container = this;
swipers.push(new Swiper(this, params));
});
return;
return swipers;
}
// Save instance in container HTML Element and in data
@ -387,6 +395,10 @@
// Pagination
if (s.params.pagination) {
s.paginationContainer = $(s.params.pagination);
if (s.params.uniqueNavElements && typeof s.params.pagination === 'string' && s.paginationContainer.length > 1 && s.container.find(s.params.pagination).length === 1) {
s.paginationContainer = s.container.find(s.params.pagination);
}
if (s.params.paginationType === 'bullets' && s.params.paginationClickable) {
s.paginationContainer.addClass('swiper-pagination-clickable');
}
@ -395,6 +407,21 @@
}
s.paginationContainer.addClass('swiper-pagination-' + s.params.paginationType);
}
// Next/Prev Buttons
if (s.params.nextButton || s.params.prevButton) {
if (s.params.nextButton) {
s.nextButton = $(s.params.nextButton);
if (s.params.uniqueNavElements && typeof s.params.nextButton === 'string' && s.nextButton.length > 1 && s.container.find(s.params.nextButton).length === 1) {
s.nextButton = s.container.find(s.params.nextButton);
}
}
if (s.params.prevButton) {
s.prevButton = $(s.params.prevButton);
if (s.params.uniqueNavElements && typeof s.params.prevButton === 'string' && s.prevButton.length > 1 && s.container.find(s.params.prevButton).length === 1) {
s.prevButton = s.container.find(s.params.prevButton);
}
}
}
// Is Horizontal
s.isHorizontal = function () {
@ -642,6 +669,7 @@
i,
prevSlideSize = 0,
index = 0;
if (typeof s.size === 'undefined') return;
if (typeof spaceBetween === 'string' && spaceBetween.indexOf('%') >= 0) {
spaceBetween = parseFloat(spaceBetween.replace('%', '')) / 100 * s.size;
}
@ -780,7 +808,7 @@
}
}
s.snapGrid = newSlidesGrid;
if (Math.floor(s.virtualSize - s.size) > Math.floor(s.snapGrid[s.snapGrid.length - 1])) {
if (Math.floor(s.virtualSize - s.size) - Math.floor(s.snapGrid[s.snapGrid.length - 1]) > 1) {
s.snapGrid.push(s.virtualSize - s.size);
}
}
@ -902,8 +930,16 @@
var activeSlide = s.slides.eq(s.activeIndex);
// Active classes
activeSlide.addClass(s.params.slideActiveClass);
activeSlide.next('.' + s.params.slideClass).addClass(s.params.slideNextClass);
activeSlide.prev('.' + s.params.slideClass).addClass(s.params.slidePrevClass);
// Next Slide
var nextSlide = activeSlide.next('.' + s.params.slideClass).addClass(s.params.slideNextClass);
if (s.params.loop && nextSlide.length === 0) {
s.slides.eq(0).addClass(s.params.slideNextClass);
}
// Prev Slide
var prevSlide = activeSlide.prev('.' + s.params.slideClass).addClass(s.params.slidePrevClass);
if (s.params.loop && prevSlide.length === 0) {
s.slides.eq(-1).addClass(s.params.slidePrevClass);
}
// Pagination
if (s.paginationContainer && s.paginationContainer.length > 0) {
@ -911,7 +947,7 @@
var current,
total = s.params.loop ? Math.ceil((s.slides.length - s.loopedSlides * 2) / s.params.slidesPerGroup) : s.snapGrid.length;
if (s.params.loop) {
current = Math.ceil(s.activeIndex - s.loopedSlides)/s.params.slidesPerGroup;
current = Math.ceil((s.activeIndex - s.loopedSlides)/s.params.slidesPerGroup);
if (current > s.slides.length - 1 - s.loopedSlides * 2) {
current = current - (s.slides.length - s.loopedSlides * 2);
}
@ -954,29 +990,30 @@
}
if (s.params.paginationType === 'custom' && s.params.paginationCustomRender) {
s.paginationContainer.html(s.params.paginationCustomRender(s, current + 1, total));
s.emit('onPaginationRendered', s, s.paginationContainer[0]);
}
}
// Next/active buttons
if (!s.params.loop) {
if (s.params.prevButton) {
if (s.params.prevButton && s.prevButton && s.prevButton.length > 0) {
if (s.isBeginning) {
$(s.params.prevButton).addClass(s.params.buttonDisabledClass);
if (s.params.a11y && s.a11y) s.a11y.disable($(s.params.prevButton));
s.prevButton.addClass(s.params.buttonDisabledClass);
if (s.params.a11y && s.a11y) s.a11y.disable(s.prevButton);
}
else {
$(s.params.prevButton).removeClass(s.params.buttonDisabledClass);
if (s.params.a11y && s.a11y) s.a11y.enable($(s.params.prevButton));
s.prevButton.removeClass(s.params.buttonDisabledClass);
if (s.params.a11y && s.a11y) s.a11y.enable(s.prevButton);
}
}
if (s.params.nextButton) {
if (s.params.nextButton && s.nextButton && s.nextButton.length > 0) {
if (s.isEnd) {
$(s.params.nextButton).addClass(s.params.buttonDisabledClass);
if (s.params.a11y && s.a11y) s.a11y.disable($(s.params.nextButton));
s.nextButton.addClass(s.params.buttonDisabledClass);
if (s.params.a11y && s.a11y) s.a11y.disable(s.nextButton);
}
else {
$(s.params.nextButton).removeClass(s.params.buttonDisabledClass);
if (s.params.a11y && s.a11y) s.a11y.enable($(s.params.nextButton));
s.nextButton.removeClass(s.params.buttonDisabledClass);
if (s.params.a11y && s.a11y) s.a11y.enable(s.nextButton);
}
}
}
@ -1026,6 +1063,9 @@
}
s.paginationContainer.html(paginationHTML);
}
if (s.params.paginationType !== 'custom') {
s.emit('onPaginationRendered', s, s.paginationContainer[0]);
}
}
};
/*=========================
@ -1097,6 +1137,7 @@
if (s.controller && s.controller.spline) {
s.controller.spline = undefined;
}
var slideChangedBySlideTo = false;
if (s.params.freeMode) {
var newTranslate = Math.min(Math.max(s.translate, s.maxTranslate()), s.minTranslate());
s.setWrapperTranslate(newTranslate);
@ -1110,12 +1151,15 @@
else {
s.updateClasses();
if ((s.params.slidesPerView === 'auto' || s.params.slidesPerView > 1) && s.isEnd && !s.params.centeredSlides) {
s.slideTo(s.slides.length - 1, 0, false, true);
slideChangedBySlideTo = s.slideTo(s.slides.length - 1, 0, false, true);
}
else {
s.slideTo(s.activeIndex, 0, false, true);
slideChangedBySlideTo = s.slideTo(s.activeIndex, 0, false, true);
}
}
if (s.params.lazyLoading && !slideChangedBySlideTo && s.lazy) {
s.lazy.load();
}
// Return locks after resize
s.params.allowSwipeToPrev = allowSwipeToPrev;
s.params.allowSwipeToNext = allowSwipeToNext;
@ -1171,23 +1215,23 @@
window[action]('resize', s.onResize);
// Next, Prev, Index
if (s.params.nextButton) {
$(s.params.nextButton)[actionDom]('click', s.onClickNext);
if (s.params.a11y && s.a11y) $(s.params.nextButton)[actionDom]('keydown', s.a11y.onEnterKey);
if (s.params.nextButton && s.nextButton && s.nextButton.length > 0) {
s.nextButton[actionDom]('click', s.onClickNext);
if (s.params.a11y && s.a11y) s.nextButton[actionDom]('keydown', s.a11y.onEnterKey);
}
if (s.params.prevButton) {
$(s.params.prevButton)[actionDom]('click', s.onClickPrev);
if (s.params.a11y && s.a11y) $(s.params.prevButton)[actionDom]('keydown', s.a11y.onEnterKey);
if (s.params.prevButton && s.prevButton && s.prevButton.length > 0) {
s.prevButton[actionDom]('click', s.onClickPrev);
if (s.params.a11y && s.a11y) s.prevButton[actionDom]('keydown', s.a11y.onEnterKey);
}
if (s.params.pagination && s.params.paginationClickable) {
$(s.paginationContainer)[actionDom]('click', '.' + s.params.bulletClass, s.onClickIndex);
if (s.params.a11y && s.a11y) $(s.paginationContainer)[actionDom]('keydown', '.' + s.params.bulletClass, s.a11y.onEnterKey);
s.paginationContainer[actionDom]('click', '.' + s.params.bulletClass, s.onClickIndex);
if (s.params.a11y && s.a11y) s.paginationContainer[actionDom]('keydown', '.' + s.params.bulletClass, s.a11y.onEnterKey);
}
// Prevent Links Clicks
if (s.params.preventClicks || s.params.preventClicksPropagation) touchEventsTarget[action]('click', s.preventClicks, true);
};
s.attachEvents = function (detach) {
s.attachEvents = function () {
s.initEvents();
};
s.detachEvents = function () {
@ -1383,7 +1427,11 @@
s.onTouchMove = function (e) {
if (e.originalEvent) e = e.originalEvent;
if (isTouchEvent && e.type === 'mousemove') return;
if (e.preventedByNestedSwiper) return;
if (e.preventedByNestedSwiper) {
s.touches.startX = e.type === 'touchmove' ? e.targetTouches[0].pageX : e.pageX;
s.touches.startY = e.type === 'touchmove' ? e.targetTouches[0].pageY : e.pageY;
return;
}
if (s.params.onlyExternal) {
// isMoved = true;
s.allowClick = false;
@ -2148,6 +2196,16 @@
s.wrapper.children('.' + s.params.slideClass + '.' + s.params.slideDuplicateClass).remove();
s.slides.removeAttr('data-swiper-slide-index');
};
s.reLoop = function (updatePosition) {
var oldIndex = s.activeIndex - s.loopedSlides;
s.destroyLoop();
s.createLoop();
s.updateSlidesSize();
if (updatePosition) {
s.slideTo(oldIndex + s.loopedSlides, 0, false);
}
};
s.fixLoop = function () {
var newIndex;
//Fix For Negative Oversliding
@ -2555,7 +2613,7 @@
srcset = _img.attr('data-srcset');
s.loadImage(_img[0], (src || background), srcset, false, function () {
if (background) {
_img.css('background-image', 'url(' + background + ')');
_img.css('background-image', 'url("' + background + '")');
_img.removeAttr('data-background');
}
else {
@ -2734,6 +2792,9 @@
if (!s.params.scrollbar) return;
var sb = s.scrollbar;
sb.track = $(s.params.scrollbar);
if (s.params.uniqueNavElements && typeof s.params.scrollbar === 'string' && sb.track.length > 1 && s.container.find(s.params.scrollbar).length === 1) {
sb.track = s.container.find(s.params.scrollbar);
}
sb.drag = sb.track.find('.swiper-scrollbar-drag');
if (sb.drag.length === 0) {
sb.drag = $('<div class="swiper-scrollbar-drag"></div>');
@ -3056,8 +3117,14 @@
try {
new window.WheelEvent('wheel');
s.mousewheel.event = 'wheel';
} catch (e) {}
} catch (e) {
if (window.WheelEvent || (s.container[0] && 'wheel' in s.container[0])) {
s.mousewheel.event = 'wheel';
}
}
if (!s.mousewheel.event && window.WheelEvent) {
}
if (!s.mousewheel.event && document.onmousewheel !== undefined) {
s.mousewheel.event = 'mousewheel';
}
@ -3070,10 +3137,9 @@
var we = s.mousewheel.event;
var delta = 0;
var rtlFactor = s.rtl ? -1 : 1;
//Opera & IE
if (e.detail) delta = -e.detail;
//WebKits
else if (we === 'mousewheel') {
if (we === 'mousewheel') {
if (s.params.mousewheelForceToAxis) {
if (s.isHorizontal()) {
if (Math.abs(e.wheelDeltaX) > Math.abs(e.wheelDeltaY)) delta = e.wheelDeltaX * rtlFactor;
@ -3383,17 +3449,15 @@
},
init: function () {
// Setup accessibility
if (s.params.nextButton) {
var nextButton = $(s.params.nextButton);
s.a11y.makeFocusable(nextButton);
s.a11y.addRole(nextButton, 'button');
s.a11y.addLabel(nextButton, s.params.nextSlideMessage);
if (s.params.nextButton && s.nextButton && s.nextButton.length > 0) {
s.a11y.makeFocusable(s.nextButton);
s.a11y.addRole(s.nextButton, 'button');
s.a11y.addLabel(s.nextButton, s.params.nextSlideMessage);
}
if (s.params.prevButton) {
var prevButton = $(s.params.prevButton);
s.a11y.makeFocusable(prevButton);
s.a11y.addRole(prevButton, 'button');
s.a11y.addLabel(prevButton, s.params.prevSlideMessage);
if (s.params.prevButton && s.prevButton && s.prevButton.length > 0) {
s.a11y.makeFocusable(s.prevButton);
s.a11y.addRole(s.prevButton, 'button');
s.a11y.addLabel(s.prevButton, s.params.prevSlideMessage);
}
$(s.container).append(s.a11y.liveRegion);
@ -4377,3 +4441,4 @@ else if (typeof define === 'function' && define.amd) {
return window.Swiper;
});
}
//# sourceMappingURL=maps/swiper.js.map

File diff suppressed because one or more lines are too long

View file

@ -170,32 +170,41 @@
.pipe(tap(function (file, t){
addJSIndent (file, t);
}))
.pipe(sourcemaps.init())
.pipe(concat(swiper.filename + '.js'))
.pipe(header(swiper.banner, { pkg : swiper.pkg, date: swiper.date } ))
.pipe(gulp.dest(paths.build.scripts))
.pipe(jshint())
.pipe(jshint.reporter(stylish));
.pipe(jshint.reporter(stylish))
.pipe(sourcemaps.write('./maps/'))
.pipe(gulp.dest(paths.build.scripts));
gulp.src(swiper.jQueryFiles)
.pipe(tap(function (file, t){
addJSIndent (file, t);
}))
.pipe(sourcemaps.init())
.pipe(concat(swiper.filename + '.jquery.js'))
.pipe(header(swiper.banner, { pkg : swiper.pkg, date: swiper.date } ))
.pipe(sourcemaps.write('./maps/'))
.pipe(gulp.dest(paths.build.scripts));
gulp.src(swiper.jQueryUMDFiles)
.pipe(tap(function (file, t){
addJSIndent (file, t);
}))
.pipe(sourcemaps.init())
.pipe(concat(swiper.filename + '.jquery.umd.js'))
.pipe(header(swiper.banner, { pkg : swiper.pkg, date: swiper.date } ))
.pipe(sourcemaps.write('./maps/'))
.pipe(gulp.dest(paths.build.scripts));
gulp.src(swiper.Framework7Files)
.pipe(tap(function (file, t){
addJSIndent (file, t, true);
}))
.pipe(sourcemaps.init())
.pipe(concat(swiper.filename + '.framework7.js'))
.pipe(header(swiper.banner, { pkg : swiper.pkg, date: swiper.date } ))
.pipe(sourcemaps.write('./maps/'))
.pipe(gulp.dest(paths.build.scripts))
.pipe(connect.reload());
cb();

View file

@ -1,4 +1,4 @@
var version = '3.3.0';
var version = '3.3.1';
Package.describe({
name: 'nolimits4web:swiper',

View file

@ -59,17 +59,15 @@ s.a11y = {
},
init: function () {
// Setup accessibility
if (s.params.nextButton) {
var nextButton = $(s.params.nextButton);
s.a11y.makeFocusable(nextButton);
s.a11y.addRole(nextButton, 'button');
s.a11y.addLabel(nextButton, s.params.nextSlideMessage);
if (s.params.nextButton && s.nextButton && s.nextButton.length > 0) {
s.a11y.makeFocusable(s.nextButton);
s.a11y.addRole(s.nextButton, 'button');
s.a11y.addLabel(s.nextButton, s.params.nextSlideMessage);
}
if (s.params.prevButton) {
var prevButton = $(s.params.prevButton);
s.a11y.makeFocusable(prevButton);
s.a11y.addRole(prevButton, 'button');
s.a11y.addLabel(prevButton, s.params.prevSlideMessage);
if (s.params.prevButton && s.prevButton && s.prevButton.length > 0) {
s.a11y.makeFocusable(s.prevButton);
s.a11y.addRole(s.prevButton, 'button');
s.a11y.addLabel(s.prevButton, s.params.prevSlideMessage);
}
$(s.container).append(s.a11y.liveRegion);

View file

@ -87,6 +87,8 @@ var defaults = {
onlyExternal: false,
threshold: 0,
touchMoveStopPropagation: true,
// Unique Navigation Elements
uniqueNavElements: true,
// Pagination
pagination: null,
paginationElement: 'span',
@ -275,10 +277,14 @@ s.setBreakpoint = function () {
var breakpoint = s.getActiveBreakpoint();
if (breakpoint && s.currentBreakpoint !== breakpoint) {
var breakPointsParams = breakpoint in s.params.breakpoints ? s.params.breakpoints[breakpoint] : s.originalParams;
var needsReLoop = s.params.loop && (breakPointsParams.slidesPerView !== s.params.slidesPerView);
for ( var param in breakPointsParams ) {
s.params[param] = breakPointsParams[param];
}
s.currentBreakpoint = breakpoint;
if(needsReLoop && s.destroyLoop) {
s.reLoop(true);
}
}
};
// Set breakpoint on load
@ -292,10 +298,12 @@ if (s.params.breakpoints) {
s.container = $(container);
if (s.container.length === 0) return;
if (s.container.length > 1) {
var swipers = [];
s.container.each(function () {
new Swiper(this, params);
var container = this;
swipers.push(new Swiper(this, params));
});
return;
return swipers;
}
// Save instance in container HTML Element and in data
@ -364,6 +372,10 @@ s.wrapper = s.container.children('.' + s.params.wrapperClass);
// Pagination
if (s.params.pagination) {
s.paginationContainer = $(s.params.pagination);
if (s.params.uniqueNavElements && typeof s.params.pagination === 'string' && s.paginationContainer.length > 1 && s.container.find(s.params.pagination).length === 1) {
s.paginationContainer = s.container.find(s.params.pagination);
}
if (s.params.paginationType === 'bullets' && s.params.paginationClickable) {
s.paginationContainer.addClass('swiper-pagination-clickable');
}
@ -372,6 +384,21 @@ if (s.params.pagination) {
}
s.paginationContainer.addClass('swiper-pagination-' + s.params.paginationType);
}
// Next/Prev Buttons
if (s.params.nextButton || s.params.prevButton) {
if (s.params.nextButton) {
s.nextButton = $(s.params.nextButton);
if (s.params.uniqueNavElements && typeof s.params.nextButton === 'string' && s.nextButton.length > 1 && s.container.find(s.params.nextButton).length === 1) {
s.nextButton = s.container.find(s.params.nextButton);
}
}
if (s.params.prevButton) {
s.prevButton = $(s.params.prevButton);
if (s.params.uniqueNavElements && typeof s.params.prevButton === 'string' && s.prevButton.length > 1 && s.container.find(s.params.prevButton).length === 1) {
s.prevButton = s.container.find(s.params.prevButton);
}
}
}
// Is Horizontal
s.isHorizontal = function () {
@ -619,6 +646,7 @@ s.updateSlidesSize = function () {
i,
prevSlideSize = 0,
index = 0;
if (typeof s.size === 'undefined') return;
if (typeof spaceBetween === 'string' && spaceBetween.indexOf('%') >= 0) {
spaceBetween = parseFloat(spaceBetween.replace('%', '')) / 100 * s.size;
}
@ -757,7 +785,7 @@ s.updateSlidesSize = function () {
}
}
s.snapGrid = newSlidesGrid;
if (Math.floor(s.virtualSize - s.size) > Math.floor(s.snapGrid[s.snapGrid.length - 1])) {
if (Math.floor(s.virtualSize - s.size) - Math.floor(s.snapGrid[s.snapGrid.length - 1]) > 1) {
s.snapGrid.push(s.virtualSize - s.size);
}
}
@ -879,8 +907,16 @@ s.updateClasses = function () {
var activeSlide = s.slides.eq(s.activeIndex);
// Active classes
activeSlide.addClass(s.params.slideActiveClass);
activeSlide.next('.' + s.params.slideClass).addClass(s.params.slideNextClass);
activeSlide.prev('.' + s.params.slideClass).addClass(s.params.slidePrevClass);
// Next Slide
var nextSlide = activeSlide.next('.' + s.params.slideClass).addClass(s.params.slideNextClass);
if (s.params.loop && nextSlide.length === 0) {
s.slides.eq(0).addClass(s.params.slideNextClass);
}
// Prev Slide
var prevSlide = activeSlide.prev('.' + s.params.slideClass).addClass(s.params.slidePrevClass);
if (s.params.loop && prevSlide.length === 0) {
s.slides.eq(-1).addClass(s.params.slidePrevClass);
}
// Pagination
if (s.paginationContainer && s.paginationContainer.length > 0) {
@ -888,7 +924,7 @@ s.updateClasses = function () {
var current,
total = s.params.loop ? Math.ceil((s.slides.length - s.loopedSlides * 2) / s.params.slidesPerGroup) : s.snapGrid.length;
if (s.params.loop) {
current = Math.ceil(s.activeIndex - s.loopedSlides)/s.params.slidesPerGroup;
current = Math.ceil((s.activeIndex - s.loopedSlides)/s.params.slidesPerGroup);
if (current > s.slides.length - 1 - s.loopedSlides * 2) {
current = current - (s.slides.length - s.loopedSlides * 2);
}
@ -931,29 +967,30 @@ s.updateClasses = function () {
}
if (s.params.paginationType === 'custom' && s.params.paginationCustomRender) {
s.paginationContainer.html(s.params.paginationCustomRender(s, current + 1, total));
s.emit('onPaginationRendered', s, s.paginationContainer[0]);
}
}
// Next/active buttons
if (!s.params.loop) {
if (s.params.prevButton) {
if (s.params.prevButton && s.prevButton && s.prevButton.length > 0) {
if (s.isBeginning) {
$(s.params.prevButton).addClass(s.params.buttonDisabledClass);
if (s.params.a11y && s.a11y) s.a11y.disable($(s.params.prevButton));
s.prevButton.addClass(s.params.buttonDisabledClass);
if (s.params.a11y && s.a11y) s.a11y.disable(s.prevButton);
}
else {
$(s.params.prevButton).removeClass(s.params.buttonDisabledClass);
if (s.params.a11y && s.a11y) s.a11y.enable($(s.params.prevButton));
s.prevButton.removeClass(s.params.buttonDisabledClass);
if (s.params.a11y && s.a11y) s.a11y.enable(s.prevButton);
}
}
if (s.params.nextButton) {
if (s.params.nextButton && s.nextButton && s.nextButton.length > 0) {
if (s.isEnd) {
$(s.params.nextButton).addClass(s.params.buttonDisabledClass);
if (s.params.a11y && s.a11y) s.a11y.disable($(s.params.nextButton));
s.nextButton.addClass(s.params.buttonDisabledClass);
if (s.params.a11y && s.a11y) s.a11y.disable(s.nextButton);
}
else {
$(s.params.nextButton).removeClass(s.params.buttonDisabledClass);
if (s.params.a11y && s.a11y) s.a11y.enable($(s.params.nextButton));
s.nextButton.removeClass(s.params.buttonDisabledClass);
if (s.params.a11y && s.a11y) s.a11y.enable(s.nextButton);
}
}
}
@ -1003,6 +1040,9 @@ s.updatePagination = function () {
}
s.paginationContainer.html(paginationHTML);
}
if (s.params.paginationType !== 'custom') {
s.emit('onPaginationRendered', s, s.paginationContainer[0]);
}
}
};
/*=========================
@ -1074,6 +1114,7 @@ s.onResize = function (forceUpdatePagination) {
if (s.controller && s.controller.spline) {
s.controller.spline = undefined;
}
var slideChangedBySlideTo = false;
if (s.params.freeMode) {
var newTranslate = Math.min(Math.max(s.translate, s.maxTranslate()), s.minTranslate());
s.setWrapperTranslate(newTranslate);
@ -1087,12 +1128,15 @@ s.onResize = function (forceUpdatePagination) {
else {
s.updateClasses();
if ((s.params.slidesPerView === 'auto' || s.params.slidesPerView > 1) && s.isEnd && !s.params.centeredSlides) {
s.slideTo(s.slides.length - 1, 0, false, true);
slideChangedBySlideTo = s.slideTo(s.slides.length - 1, 0, false, true);
}
else {
s.slideTo(s.activeIndex, 0, false, true);
slideChangedBySlideTo = s.slideTo(s.activeIndex, 0, false, true);
}
}
if (s.params.lazyLoading && !slideChangedBySlideTo && s.lazy) {
s.lazy.load();
}
// Return locks after resize
s.params.allowSwipeToPrev = allowSwipeToPrev;
s.params.allowSwipeToNext = allowSwipeToNext;
@ -1148,23 +1192,23 @@ s.initEvents = function (detach) {
window[action]('resize', s.onResize);
// Next, Prev, Index
if (s.params.nextButton) {
$(s.params.nextButton)[actionDom]('click', s.onClickNext);
if (s.params.a11y && s.a11y) $(s.params.nextButton)[actionDom]('keydown', s.a11y.onEnterKey);
if (s.params.nextButton && s.nextButton && s.nextButton.length > 0) {
s.nextButton[actionDom]('click', s.onClickNext);
if (s.params.a11y && s.a11y) s.nextButton[actionDom]('keydown', s.a11y.onEnterKey);
}
if (s.params.prevButton) {
$(s.params.prevButton)[actionDom]('click', s.onClickPrev);
if (s.params.a11y && s.a11y) $(s.params.prevButton)[actionDom]('keydown', s.a11y.onEnterKey);
if (s.params.prevButton && s.prevButton && s.prevButton.length > 0) {
s.prevButton[actionDom]('click', s.onClickPrev);
if (s.params.a11y && s.a11y) s.prevButton[actionDom]('keydown', s.a11y.onEnterKey);
}
if (s.params.pagination && s.params.paginationClickable) {
$(s.paginationContainer)[actionDom]('click', '.' + s.params.bulletClass, s.onClickIndex);
if (s.params.a11y && s.a11y) $(s.paginationContainer)[actionDom]('keydown', '.' + s.params.bulletClass, s.a11y.onEnterKey);
s.paginationContainer[actionDom]('click', '.' + s.params.bulletClass, s.onClickIndex);
if (s.params.a11y && s.a11y) s.paginationContainer[actionDom]('keydown', '.' + s.params.bulletClass, s.a11y.onEnterKey);
}
// Prevent Links Clicks
if (s.params.preventClicks || s.params.preventClicksPropagation) touchEventsTarget[action]('click', s.preventClicks, true);
};
s.attachEvents = function (detach) {
s.attachEvents = function () {
s.initEvents();
};
s.detachEvents = function () {
@ -1360,7 +1404,11 @@ s.onTouchStart = function (e) {
s.onTouchMove = function (e) {
if (e.originalEvent) e = e.originalEvent;
if (isTouchEvent && e.type === 'mousemove') return;
if (e.preventedByNestedSwiper) return;
if (e.preventedByNestedSwiper) {
s.touches.startX = e.type === 'touchmove' ? e.targetTouches[0].pageX : e.pageX;
s.touches.startY = e.type === 'touchmove' ? e.targetTouches[0].pageY : e.pageY;
return;
}
if (s.params.onlyExternal) {
// isMoved = true;
s.allowClick = false;
@ -2125,6 +2173,16 @@ s.destroyLoop = function () {
s.wrapper.children('.' + s.params.slideClass + '.' + s.params.slideDuplicateClass).remove();
s.slides.removeAttr('data-swiper-slide-index');
};
s.reLoop = function (updatePosition) {
var oldIndex = s.activeIndex - s.loopedSlides;
s.destroyLoop();
s.createLoop();
s.updateSlidesSize();
if (updatePosition) {
s.slideTo(oldIndex + s.loopedSlides, 0, false);
}
};
s.fixLoop = function () {
var newIndex;
//Fix For Negative Oversliding

View file

@ -23,7 +23,7 @@ s.lazy = {
srcset = _img.attr('data-srcset');
s.loadImage(_img[0], (src || background), srcset, false, function () {
if (background) {
_img.css('background-image', 'url(' + background + ')');
_img.css('background-image', 'url("' + background + '")');
_img.removeAttr('data-background');
}
else {

View file

@ -9,8 +9,14 @@ if (s.params.mousewheelControl) {
try {
new window.WheelEvent('wheel');
s.mousewheel.event = 'wheel';
} catch (e) {}
} catch (e) {
if (window.WheelEvent || (s.container[0] && 'wheel' in s.container[0])) {
s.mousewheel.event = 'wheel';
}
}
if (!s.mousewheel.event && window.WheelEvent) {
}
if (!s.mousewheel.event && document.onmousewheel !== undefined) {
s.mousewheel.event = 'mousewheel';
}
@ -23,10 +29,9 @@ function handleMousewheel(e) {
var we = s.mousewheel.event;
var delta = 0;
var rtlFactor = s.rtl ? -1 : 1;
//Opera & IE
if (e.detail) delta = -e.detail;
//WebKits
else if (we === 'mousewheel') {
if (we === 'mousewheel') {
if (s.params.mousewheelForceToAxis) {
if (s.isHorizontal()) {
if (Math.abs(e.wheelDeltaX) > Math.abs(e.wheelDeltaY)) delta = e.wheelDeltaX * rtlFactor;

View file

@ -86,6 +86,9 @@ s.scrollbar = {
if (!s.params.scrollbar) return;
var sb = s.scrollbar;
sb.track = $(s.params.scrollbar);
if (s.params.uniqueNavElements && typeof s.params.scrollbar === 'string' && sb.track.length > 1 && s.container.find(s.params.scrollbar).length === 1) {
sb.track = s.container.find(s.params.scrollbar);
}
sb.drag = sb.track.find('.swiper-scrollbar-drag');
if (sb.drag.length === 0) {
sb.drag = $('<div class="swiper-scrollbar-drag"></div>');

View file

@ -32,14 +32,14 @@
"iron-test-helpers": "PolymerElements/iron-test-helpers#^1.0.0"
},
"ignore": [],
"homepage": "https://github.com/polymerelements/paper-ripple",
"homepage": "https://github.com/PolymerElements/paper-ripple",
"_release": "1.0.5",
"_resolution": {
"type": "version",
"tag": "v1.0.5",
"commit": "d72e7a9a8ab518b901ed18dde492df3b87a93be5"
},
"_source": "git://github.com/polymerelements/paper-ripple.git",
"_source": "git://github.com/PolymerElements/paper-ripple.git",
"_target": "^1.0.0",
"_originalSource": "polymerelements/paper-ripple"
"_originalSource": "PolymerElements/paper-ripple"
}