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

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);
@ -3710,4 +3774,5 @@ else if (typeof define === 'function' && define.amd) {
'use strict';
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);
@ -3702,4 +3766,5 @@
}
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);
@ -4376,4 +4440,5 @@ else if (typeof define === 'function' && define.amd) {
'use strict';
return window.Swiper;
});
}
}
//# sourceMappingURL=maps/swiper.js.map

File diff suppressed because one or more lines are too long