vendor/assets/javascripts/jquery.lory.js in lory-rails-0.2.1 vs vendor/assets/javascripts/jquery.lory.js in lory-rails-0.2.2

- old
+ new

@@ -73,37 +73,10 @@ /******/ return __webpack_require__(__webpack_require__.s = 8); /******/ }) /************************************************************************/ /******/ ([ /* 0 */ -/***/ (function(module, exports) { - -var g; - -// This works in non-strict mode -g = (function() { - return this; -})(); - -try { - // This works if eval is allowed (see CSP) - g = g || Function("return this")() || (1,eval)("this"); -} catch(e) { - // This works if the window reference is available - if(typeof window === "object") - g = window; -} - -// g can still be undefined, but nothing to do about it... -// We return undefined, instead of nothing here, so it's -// easier to handle this case. if(!global) { ...} - -module.exports = g; - - -/***/ }), -/* 1 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -113,19 +86,19 @@ var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; /* globals jQuery */ exports.lory = lory; -var _detectPrefixes = __webpack_require__(2); +var _detectPrefixes = __webpack_require__(1); var _detectPrefixes2 = _interopRequireDefault(_detectPrefixes); -var _detectSupportsPassive = __webpack_require__(3); +var _detectSupportsPassive = __webpack_require__(2); var _detectSupportsPassive2 = _interopRequireDefault(_detectSupportsPassive); -var _dispatchEvent = __webpack_require__(4); +var _dispatchEvent = __webpack_require__(3); var _dispatchEvent2 = _interopRequireDefault(_dispatchEvent); var _defaults = __webpack_require__(6); @@ -231,16 +204,11 @@ var style = slideContainer && slideContainer.style; if (style) { style[prefixes.transition + 'TimingFunction'] = ease; style[prefixes.transition + 'Duration'] = duration + 'ms'; - - if (prefixes.hasTranslate3d) { - style[prefixes.transform] = 'translate3d(' + to + 'px, 0, 0)'; - } else { - style[prefixes.transform] = 'translate(' + to + 'px, 0)'; - } + style[prefixes.transform] = 'translateX(' + to + 'px)'; } } /** * returns an element's width @@ -261,13 +229,18 @@ var _options3 = options, slideSpeed = _options3.slideSpeed, slidesToScroll = _options3.slidesToScroll, infinite = _options3.infinite, rewind = _options3.rewind, + rewindPrev = _options3.rewindPrev, rewindSpeed = _options3.rewindSpeed, ease = _options3.ease, - classNameActiveSlide = _options3.classNameActiveSlide; + classNameActiveSlide = _options3.classNameActiveSlide, + _options3$classNameDi = _options3.classNameDisabledNextCtrl, + classNameDisabledNextCtrl = _options3$classNameDi === undefined ? 'disabled' : _options3$classNameDi, + _options3$classNameDi2 = _options3.classNameDisabledPrevCtrl, + classNameDisabledPrevCtrl = _options3$classNameDi2 === undefined ? 'disabled' : _options3$classNameDi2; var duration = slideSpeed; var nextSlide = direction ? index + 1 : index - 1; @@ -280,14 +253,14 @@ /** * Reset control classes */ if (prevCtrl) { - prevCtrl.classList.remove('disabled'); + prevCtrl.classList.remove(classNameDisabledPrevCtrl); } if (nextCtrl) { - nextCtrl.classList.remove('disabled'); + nextCtrl.classList.remove(classNameDisabledNextCtrl); } if (typeof nextIndex !== 'number') { if (direction) { if (infinite && index + infinite * 2 !== slides.length) { @@ -308,10 +281,15 @@ if (infinite && direction === undefined) { nextIndex += infinite; } + if (rewindPrev && Math.abs(position.x) === 0 && direction === false) { + nextIndex = slides.length - 1; + duration = rewindSpeed; + } + var nextOffset = Math.min(Math.max(slides[nextIndex].offsetLeft * -1, maxOffset * -1), 0); if (rewind && Math.abs(position.x) === maxOffset && direction) { nextOffset = 0; nextIndex = 0; @@ -358,16 +336,16 @@ /** * update classes for next and prev arrows * based on user settings */ - if (prevCtrl && !infinite && nextIndex === 0) { - prevCtrl.classList.add('disabled'); + if (prevCtrl && !infinite && !rewindPrev && nextIndex === 0) { + prevCtrl.classList.add(classNameDisabledPrevCtrl); } if (nextCtrl && !infinite && !rewind && nextIndex + 1 === slides.length) { - nextCtrl.classList.add('disabled'); + nextCtrl.classList.add(classNameDisabledNextCtrl); } dispatchSliderEvent('after', 'slide', { currentSlide: index }); @@ -386,10 +364,14 @@ var _options4 = options, classNameFrame = _options4.classNameFrame, classNameSlideContainer = _options4.classNameSlideContainer, classNamePrevCtrl = _options4.classNamePrevCtrl, classNameNextCtrl = _options4.classNameNextCtrl, + _options4$classNameDi = _options4.classNameDisabledNextCtrl, + classNameDisabledNextCtrl = _options4$classNameDi === undefined ? 'disabled' : _options4$classNameDi, + _options4$classNameDi2 = _options4.classNameDisabledPrevCtrl, + classNameDisabledPrevCtrl = _options4$classNameDi2 === undefined ? 'disabled' : _options4$classNameDi2, enableMouseEvents = _options4.enableMouseEvents, classNameActiveSlide = _options4.classNameActiveSlide, initialIndex = _options4.initialIndex; @@ -407,16 +389,16 @@ if (options.infinite) { slides = setupInfinite(slice.call(slideContainer.children)); } else { slides = slice.call(slideContainer.children); - if (prevCtrl) { - prevCtrl.classList.add('disabled'); + if (prevCtrl && !options.rewindPrev) { + prevCtrl.classList.add(classNameDisabledPrevCtrl); } if (nextCtrl && slides.length === 1 && !options.rewind) { - nextCtrl.classList.add('disabled'); + nextCtrl.classList.add(classNameDisabledNextCtrl); } } reset(); @@ -717,16 +699,16 @@ destroy: destroy }; } /***/ }), -/* 2 */ +/* 1 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -/* WEBPACK VAR INJECTION */(function(global) { + Object.defineProperty(exports, "__esModule", { value: true }); exports.default = detectPrefixes; /** @@ -734,11 +716,10 @@ */ function detectPrefixes() { var transform = void 0; var transition = void 0; var transitionEnd = void 0; - var hasTranslate3d = void 0; (function () { var el = document.createElement('_'); var style = el.style; @@ -765,26 +746,23 @@ if (style[prop = 'transform'] === '') { transform = prop; } document.body.insertBefore(el, null); - style[transform] = 'translate3d(0, 0, 0)'; - hasTranslate3d = !!global.getComputedStyle(el).getPropertyValue(transform); + style[transform] = 'translateX(0)'; document.body.removeChild(el); })(); return { transform: transform, transition: transition, - transitionEnd: transitionEnd, - hasTranslate3d: hasTranslate3d + transitionEnd: transitionEnd }; } -/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) /***/ }), -/* 3 */ +/* 2 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -808,22 +786,22 @@ return supportsPassive; } /***/ }), -/* 4 */ +/* 3 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = dispatchEvent; -var _customEvent = __webpack_require__(5); +var _customEvent = __webpack_require__(4); var _customEvent2 = _interopRequireDefault(_customEvent); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -843,11 +821,11 @@ target.dispatchEvent(event); } /***/ }), -/* 5 */ +/* 4 */ /***/ (function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(global) { var NativeCustomEvent = global.CustomEvent; @@ -895,13 +873,40 @@ e.detail = void 0; } return e; } -/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) /***/ }), +/* 5 */ +/***/ (function(module, exports) { + +var g; + +// This works in non-strict mode +g = (function() { + return this; +})(); + +try { + // This works if eval is allowed (see CSP) + g = g || Function("return this")() || (1,eval)("this"); +} catch(e) { + // This works if the window reference is available + if(typeof window === "object") + g = window; +} + +// g can still be undefined, but nothing to do about it... +// We return undefined, instead of nothing here, so it's +// easier to handle this case. if(!global) { ...} + +module.exports = g; + + +/***/ }), /* 6 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -1017,10 +1022,10 @@ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var _lory = __webpack_require__(1); +var _lory = __webpack_require__(0); function init($) { $.fn.lory = function (options) { return this.each(function () { var instanceOptions; \ No newline at end of file