Comparing version 1.12.0 to 1.12.1
/*! | ||
* Name : Elements Extension for Jarallax | ||
* Name : DEPRECATED Elements Extension for Jarallax. Use laxxx instead https://github.com/alexfoxy/laxxx | ||
* Version : 1.0.0 | ||
@@ -108,10 +108,13 @@ * Author : nK <https://nkdev.info> | ||
/* harmony import */ var lite_ready__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lite_ready__WEBPACK_IMPORTED_MODULE_0__); | ||
/* harmony import */ var _jarallax_element_esm__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(3); | ||
/* harmony import */ var global__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(3); | ||
/* harmony import */ var global__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(global__WEBPACK_IMPORTED_MODULE_1__); | ||
/* harmony import */ var _jarallax_element_esm__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(5); | ||
Object(_jarallax_element_esm__WEBPACK_IMPORTED_MODULE_1__["default"])(); // data-jarallax-element initialization | ||
Object(_jarallax_element_esm__WEBPACK_IMPORTED_MODULE_2__["default"])(); // data-jarallax-element initialization | ||
lite_ready__WEBPACK_IMPORTED_MODULE_0___default()(function () { | ||
if (typeof jarallax !== 'undefined') { | ||
jarallax(document.querySelectorAll('[data-jarallax-element]')); | ||
if ('undefined' !== typeof global__WEBPACK_IMPORTED_MODULE_1___default.a.jarallax) { | ||
global__WEBPACK_IMPORTED_MODULE_1___default.a.jarallax(document.querySelectorAll('[data-jarallax-element]')); | ||
} | ||
@@ -141,2 +144,46 @@ }); | ||
/* 3 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
/* WEBPACK VAR INJECTION */(function(global) {var win; | ||
if (typeof window !== "undefined") { | ||
win = window; | ||
} else if (typeof global !== "undefined") { | ||
win = global; | ||
} else if (typeof self !== "undefined") { | ||
win = self; | ||
} else { | ||
win = {}; | ||
} | ||
module.exports = win; | ||
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(4))) | ||
/***/ }), | ||
/* 4 */ | ||
/***/ (function(module, exports) { | ||
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
var g; // This works in non-strict mode | ||
g = function () { | ||
return this; | ||
}(); | ||
try { | ||
// This works if eval is allowed (see CSP) | ||
g = g || new Function("return this")(); | ||
} catch (e) { | ||
// This works if the window reference is available | ||
if ((typeof window === "undefined" ? "undefined" : _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; | ||
/***/ }), | ||
/* 5 */ | ||
/***/ (function(module, __webpack_exports__, __webpack_require__) { | ||
@@ -147,3 +194,3 @@ | ||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return jarallaxElement; }); | ||
/* harmony import */ var global__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(4); | ||
/* harmony import */ var global__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(3); | ||
/* harmony import */ var global__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(global__WEBPACK_IMPORTED_MODULE_0__); | ||
@@ -155,3 +202,3 @@ /* eslint no-case-declarations: "off" */ | ||
if (typeof jarallax === 'undefined') { | ||
if ('undefined' === typeof jarallax) { | ||
return; | ||
@@ -167,5 +214,4 @@ } | ||
var self = this; | ||
var args = arguments || []; | ||
if (key === 'initImg' && self.$item.getAttribute('data-jarallax-element') !== null) { | ||
if ('initImg' === key && null !== self.$item.getAttribute('data-jarallax-element')) { | ||
self.options.type = 'element'; | ||
@@ -175,3 +221,7 @@ self.pureOptions.speed = self.$item.getAttribute('data-jarallax-element') || self.pureOptions.speed; | ||
if (self.options.type !== 'element') { | ||
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { | ||
args[_key] = arguments[_key]; | ||
} | ||
if ('element' !== self.options.type) { | ||
return def.apply(self, args); | ||
@@ -225,4 +275,4 @@ } | ||
var mx = moveX; | ||
if (self.options.thresholdY !== null && moveY > self.options.thresholdY) my = 0; | ||
if (self.options.thresholdX !== null && moveX > self.options.thresholdX) mx = 0; | ||
if (null !== self.options.thresholdY && moveY > self.options.thresholdY) my = 0; | ||
if (null !== self.options.thresholdX && moveX > self.options.thresholdX) mx = 0; | ||
self.css(self.$item, { | ||
@@ -246,47 +296,3 @@ transform: "translate3d(".concat(mx, "px,").concat(my, "px,0)") | ||
/***/ }), | ||
/* 4 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
/* WEBPACK VAR INJECTION */(function(global) {var win; | ||
if (typeof window !== "undefined") { | ||
win = window; | ||
} else if (typeof global !== "undefined") { | ||
win = global; | ||
} else if (typeof self !== "undefined") { | ||
win = self; | ||
} else { | ||
win = {}; | ||
} | ||
module.exports = win; | ||
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(5))) | ||
/***/ }), | ||
/* 5 */ | ||
/***/ (function(module, exports) { | ||
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
var g; // This works in non-strict mode | ||
g = function () { | ||
return this; | ||
}(); | ||
try { | ||
// This works if eval is allowed (see CSP) | ||
g = g || new Function("return this")(); | ||
} catch (e) { | ||
// This works if the window reference is available | ||
if ((typeof window === "undefined" ? "undefined" : _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; | ||
/***/ }) | ||
/******/ ]); |
/*! | ||
* Name : Elements Extension for Jarallax | ||
* Name : DEPRECATED Elements Extension for Jarallax. Use laxxx instead https://github.com/alexfoxy/laxxx | ||
* Version : 1.0.0 | ||
* Author : nK <https://nkdev.info> | ||
* GitHub : https://github.com/nk-o/jarallax | ||
*/!function(n){var o={};function r(t){if(o[t])return o[t].exports;var e=o[t]={i:t,l:!1,exports:{}};return n[t].call(e.exports,e,e.exports,r),e.l=!0,e.exports}r.m=n,r.c=o,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=0)}([function(t,e,n){t.exports=n(1)},function(t,e,n){"use strict";n.r(e);var o=n(2),r=n.n(o),i=n(3);Object(i.default)(),r()(function(){"undefined"!=typeof jarallax&&jarallax(document.querySelectorAll("[data-jarallax-element]"))})},function(t,e){t.exports=function(t){"complete"===document.readyState||"interactive"===document.readyState?t.call():document.attachEvent?document.attachEvent("onreadystatechange",function(){"interactive"===document.readyState&&t.call()}):document.addEventListener&&document.addEventListener("DOMContentLoaded",t)}},function(t,e,n){"use strict";n.r(e),n.d(e,"default",function(){return i});var o=n(4),r=n.n(o);function i(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:r.a.jarallax;if(void 0!==t){var e=t.constructor;["initImg","canInitParallax","init","destroy","clipContainer","coverImage","isVisible","onScroll","onResize"].forEach(function(f){var m=e.prototype[f];e.prototype[f]=function(){var t=this,e=arguments||[];if("initImg"===f&&null!==t.$item.getAttribute("data-jarallax-element")&&(t.options.type="element",t.pureOptions.speed=t.$item.getAttribute("data-jarallax-element")||t.pureOptions.speed),"element"!==t.options.type)return m.apply(t,e);switch(t.pureOptions.threshold=t.$item.getAttribute("data-threshold")||"",f){case"init":var n=t.pureOptions.speed.split(" ");t.options.speed=t.pureOptions.speed||0,t.options.speedY=n[0]?parseFloat(n[0]):0,t.options.speedX=n[1]?parseFloat(n[1]):0;var o=t.pureOptions.threshold.split(" ");t.options.thresholdY=o[0]?parseFloat(o[0]):null,t.options.thresholdX=o[1]?parseFloat(o[1]):null,m.apply(t,e);var r=t.$item.getAttribute("data-jarallax-original-styles");return r&&t.$item.setAttribute("style",r),!0;case"onResize":var i=t.css(t.$item,"transform");t.css(t.$item,{transform:""});var a=t.$item.getBoundingClientRect();t.itemData={width:a.width,height:a.height,y:a.top+t.getWindowData().y,x:a.left},t.css(t.$item,{transform:i});break;case"onScroll":var l=t.getWindowData(),s=(l.y+l.height/2-t.itemData.y-t.itemData.height/2)/(l.height/2),u=s*t.options.speedY,c=s*t.options.speedX,p=u,d=c;null!==t.options.thresholdY&&u>t.options.thresholdY&&(p=0),null!==t.options.thresholdX&&c>t.options.thresholdX&&(d=0),t.css(t.$item,{transform:"translate3d(".concat(d,"px,").concat(p,"px,0)")});break;case"initImg":case"isVisible":case"clipContainer":case"coverImage":return!0}return m.apply(t,e)}})}}},function(n,t,e){(function(t){var e;e="undefined"!=typeof window?window:void 0!==t?t:"undefined"!=typeof self?self:{},n.exports=e}).call(this,e(5))},function(t,e){function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var o;o=function(){return this}();try{o=o||new Function("return this")()}catch(t){"object"===("undefined"==typeof window?"undefined":n(window))&&(o=window)}t.exports=o}]); | ||
*/!function(n){var o={};function r(t){if(o[t])return o[t].exports;var e=o[t]={i:t,l:!1,exports:{}};return n[t].call(e.exports,e,e.exports,r),e.l=!0,e.exports}r.m=n,r.c=o,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=0)}([function(t,e,n){t.exports=n(1)},function(t,e,n){"use strict";n.r(e);var o=n(2),r=n.n(o),i=n(3),a=n.n(i),l=n(5);Object(l.default)(),r()(function(){void 0!==a.a.jarallax&&a.a.jarallax(document.querySelectorAll("[data-jarallax-element]"))})},function(t,e){t.exports=function(t){"complete"===document.readyState||"interactive"===document.readyState?t.call():document.attachEvent?document.attachEvent("onreadystatechange",function(){"interactive"===document.readyState&&t.call()}):document.addEventListener&&document.addEventListener("DOMContentLoaded",t)}},function(n,t,e){(function(t){var e;e="undefined"!=typeof window?window:void 0!==t?t:"undefined"!=typeof self?self:{},n.exports=e}).call(this,e(4))},function(t,e){function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var o;o=function(){return this}();try{o=o||new Function("return this")()}catch(t){"object"===("undefined"==typeof window?"undefined":n(window))&&(o=window)}t.exports=o},function(t,e,n){"use strict";n.r(e),n.d(e,"default",function(){return i});var o=n(3),r=n.n(o);function i(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:r.a.jarallax;if(void 0!==t){var e=t.constructor;["initImg","canInitParallax","init","destroy","clipContainer","coverImage","isVisible","onScroll","onResize"].forEach(function(y){var h=e.prototype[y];e.prototype[y]=function(){var t=this;"initImg"===y&&null!==t.$item.getAttribute("data-jarallax-element")&&(t.options.type="element",t.pureOptions.speed=t.$item.getAttribute("data-jarallax-element")||t.pureOptions.speed);for(var e=arguments.length,n=new Array(e),o=0;o<e;o++)n[o]=arguments[o];if("element"!==t.options.type)return h.apply(t,n);switch(t.pureOptions.threshold=t.$item.getAttribute("data-threshold")||"",y){case"init":var r=t.pureOptions.speed.split(" ");t.options.speed=t.pureOptions.speed||0,t.options.speedY=r[0]?parseFloat(r[0]):0,t.options.speedX=r[1]?parseFloat(r[1]):0;var i=t.pureOptions.threshold.split(" ");t.options.thresholdY=i[0]?parseFloat(i[0]):null,t.options.thresholdX=i[1]?parseFloat(i[1]):null,h.apply(t,n);var a=t.$item.getAttribute("data-jarallax-original-styles");return a&&t.$item.setAttribute("style",a),!0;case"onResize":var l=t.css(t.$item,"transform");t.css(t.$item,{transform:""});var s=t.$item.getBoundingClientRect();t.itemData={width:s.width,height:s.height,y:s.top+t.getWindowData().y,x:s.left},t.css(t.$item,{transform:l});break;case"onScroll":var u=t.getWindowData(),c=(u.y+u.height/2-t.itemData.y-t.itemData.height/2)/(u.height/2),p=c*t.options.speedY,d=c*t.options.speedX,f=p,m=d;null!==t.options.thresholdY&&p>t.options.thresholdY&&(f=0),null!==t.options.thresholdX&&d>t.options.thresholdX&&(m=0),t.css(t.$item,{transform:"translate3d(".concat(m,"px,").concat(f,"px,0)")});break;case"initImg":case"isVisible":case"clipContainer":case"coverImage":return!0}return h.apply(t,n)}})}}}]); | ||
//# sourceMappingURL=jarallax-element.min.js.map |
@@ -115,4 +115,3 @@ /*! | ||
/***/ }), | ||
/* 3 */, | ||
/* 4 */ | ||
/* 3 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
@@ -133,9 +132,9 @@ | ||
module.exports = win; | ||
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(5))) | ||
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(4))) | ||
/***/ }), | ||
/* 5 */ | ||
/* 4 */ | ||
/***/ (function(module, exports) { | ||
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
@@ -162,2 +161,3 @@ var g; // This works in non-strict mode | ||
/***/ }), | ||
/* 5 */, | ||
/* 6 */ | ||
@@ -176,8 +176,7 @@ /***/ (function(module, exports, __webpack_require__) { | ||
/* harmony import */ var video_worker__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(8); | ||
/* harmony import */ var video_worker__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(video_worker__WEBPACK_IMPORTED_MODULE_0__); | ||
/* harmony import */ var global__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(4); | ||
/* harmony import */ var global__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(3); | ||
/* harmony import */ var global__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(global__WEBPACK_IMPORTED_MODULE_1__); | ||
/* harmony import */ var lite_ready__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(2); | ||
/* harmony import */ var lite_ready__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(lite_ready__WEBPACK_IMPORTED_MODULE_2__); | ||
/* harmony import */ var _jarallax_video_esm__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(10); | ||
/* harmony import */ var _jarallax_video_esm__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(9); | ||
@@ -188,8 +187,8 @@ | ||
global__WEBPACK_IMPORTED_MODULE_1___default.a.VideoWorker = global__WEBPACK_IMPORTED_MODULE_1___default.a.VideoWorker || video_worker__WEBPACK_IMPORTED_MODULE_0___default.a; | ||
global__WEBPACK_IMPORTED_MODULE_1___default.a.VideoWorker = global__WEBPACK_IMPORTED_MODULE_1___default.a.VideoWorker || video_worker__WEBPACK_IMPORTED_MODULE_0__["default"]; | ||
Object(_jarallax_video_esm__WEBPACK_IMPORTED_MODULE_3__["default"])(); // data-jarallax-video initialization | ||
lite_ready__WEBPACK_IMPORTED_MODULE_2___default()(function () { | ||
if (typeof jarallax !== 'undefined') { | ||
jarallax(document.querySelectorAll('[data-jarallax-video]')); | ||
if ('undefined' !== typeof global__WEBPACK_IMPORTED_MODULE_1___default.a.jarallax) { | ||
global__WEBPACK_IMPORTED_MODULE_1___default.a.jarallax(document.querySelectorAll('[data-jarallax-video]')); | ||
} | ||
@@ -200,8 +199,2 @@ }); | ||
/* 8 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
module.exports = __webpack_require__(9); | ||
/***/ }), | ||
/* 9 */ | ||
/***/ (function(module, __webpack_exports__, __webpack_require__) { | ||
@@ -212,3 +205,5 @@ | ||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return VideoWorker; }); | ||
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
/* harmony import */ var global__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(3); | ||
/* harmony import */ var global__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(global__WEBPACK_IMPORTED_MODULE_0__); | ||
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
@@ -221,7 +216,8 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
// Deferred | ||
// Deferred | ||
// thanks http://stackoverflow.com/questions/18096715/implement-deferred-object-without-using-jquery | ||
function Deferred() { | ||
this._done = []; | ||
this._fail = []; | ||
this.done = []; | ||
this.fail = []; | ||
} | ||
@@ -234,3 +230,4 @@ | ||
while (i--) { | ||
while (i) { | ||
i -= 1; | ||
list[i].apply(null, args); | ||
@@ -240,12 +237,20 @@ } | ||
resolve: function resolve() { | ||
this.execute(this._done, arguments); | ||
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { | ||
args[_key] = arguments[_key]; | ||
} | ||
this.execute(this.done, args); | ||
}, | ||
reject: function reject() { | ||
this.execute(this._fail, arguments); | ||
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { | ||
args[_key2] = arguments[_key2]; | ||
} | ||
this.execute(this.fail, args); | ||
}, | ||
done: function done(callback) { | ||
this._done.push(callback); | ||
this.done.push(callback); | ||
}, | ||
fail: function fail(callback) { | ||
this._fail.push(callback); | ||
this.fail.push(callback); | ||
} | ||
@@ -261,5 +266,3 @@ }; | ||
var VideoWorker = | ||
/*#__PURE__*/ | ||
function () { | ||
var VideoWorker = /*#__PURE__*/function () { | ||
function VideoWorker(url, options) { | ||
@@ -285,3 +288,4 @@ _classCallCheck(this, VideoWorker); | ||
if (self.videoID) { | ||
self.ID = ID++; | ||
self.ID = ID; | ||
ID += 1; | ||
self.loadAPI(); | ||
@@ -291,2 +295,3 @@ self.init(); | ||
} // Extend like jQuery.extend | ||
// eslint-disable-next-line class-methods-use-this | ||
@@ -296,12 +301,15 @@ | ||
key: "extend", | ||
value: function extend(out) { | ||
var _arguments = arguments; | ||
out = out || {}; | ||
Object.keys(arguments).forEach(function (i) { | ||
if (!_arguments[i]) { | ||
value: function extend() { | ||
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) { | ||
args[_key3] = arguments[_key3]; | ||
} | ||
var out = args[0] || {}; | ||
Object.keys(args).forEach(function (i) { | ||
if (!args[i]) { | ||
return; | ||
} | ||
Object.keys(_arguments[i]).forEach(function (key) { | ||
out[key] = _arguments[i][key]; | ||
Object.keys(args[i]).forEach(function (key) { | ||
out[key] = args[i][key]; | ||
}); | ||
@@ -319,3 +327,3 @@ }); | ||
var match = ytUrl.match(regExp); | ||
return match && match[1].length === 11 ? match[1] : false; | ||
return match && 11 === match[1].length ? match[1] : false; | ||
} // parse vimeo ID | ||
@@ -343,3 +351,3 @@ | ||
// eslint-disable-next-line prefer-destructuring | ||
result[match[1] === 'ogv' ? 'ogg' : match[1]] = match[2]; | ||
result['ogv' === match[1] ? 'ogg' : match[1]] = match[2]; | ||
ready = 1; | ||
@@ -358,6 +366,10 @@ } | ||
return Youtube; | ||
} else if (Vimeo) { | ||
} | ||
if (Vimeo) { | ||
this.type = 'vimeo'; | ||
return Vimeo; | ||
} else if (Local) { | ||
} | ||
if (Local) { | ||
this.type = 'local'; | ||
@@ -406,5 +418,7 @@ return Local; | ||
var args = [].slice.call(arguments, 1); | ||
for (var _len4 = arguments.length, args = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) { | ||
args[_key4 - 1] = arguments[_key4]; | ||
} | ||
if (this.userEventsList && typeof this.userEventsList[name] !== 'undefined') { | ||
if (this.userEventsList && 'undefined' !== typeof this.userEventsList[name]) { | ||
this.userEventsList[name].forEach(function (val) { | ||
@@ -427,8 +441,8 @@ // call with all arguments | ||
if (self.type === 'youtube' && self.player.playVideo) { | ||
if (typeof start !== 'undefined') { | ||
if ('youtube' === self.type && self.player.playVideo) { | ||
if ('undefined' !== typeof start) { | ||
self.player.seekTo(start || 0); | ||
} | ||
if (YT.PlayerState.PLAYING !== self.player.getPlayerState()) { | ||
if (global__WEBPACK_IMPORTED_MODULE_0___default.a.YT.PlayerState.PLAYING !== self.player.getPlayerState()) { | ||
self.player.playVideo(); | ||
@@ -438,4 +452,4 @@ } | ||
if (self.type === 'vimeo') { | ||
if (typeof start !== 'undefined') { | ||
if ('vimeo' === self.type) { | ||
if ('undefined' !== typeof start) { | ||
self.player.setCurrentTime(start); | ||
@@ -451,4 +465,4 @@ } | ||
if (self.type === 'local') { | ||
if (typeof start !== 'undefined') { | ||
if ('local' === self.type) { | ||
if ('undefined' !== typeof start) { | ||
self.player.currentTime = start; | ||
@@ -471,4 +485,4 @@ } | ||
if (self.type === 'youtube' && self.player.pauseVideo) { | ||
if (YT.PlayerState.PLAYING === self.player.getPlayerState()) { | ||
if ('youtube' === self.type && self.player.pauseVideo) { | ||
if (global__WEBPACK_IMPORTED_MODULE_0___default.a.YT.PlayerState.PLAYING === self.player.getPlayerState()) { | ||
self.player.pauseVideo(); | ||
@@ -478,3 +492,3 @@ } | ||
if (self.type === 'vimeo') { | ||
if ('vimeo' === self.type) { | ||
self.player.getPaused().then(function (paused) { | ||
@@ -487,3 +501,3 @@ if (!paused) { | ||
if (self.type === 'local') { | ||
if ('local' === self.type) { | ||
if (!self.player.paused) { | ||
@@ -503,11 +517,11 @@ self.player.pause(); | ||
if (self.type === 'youtube' && self.player.mute) { | ||
if ('youtube' === self.type && self.player.mute) { | ||
self.player.mute(); | ||
} | ||
if (self.type === 'vimeo' && self.player.setVolume) { | ||
if ('vimeo' === self.type && self.player.setVolume) { | ||
self.player.setVolume(0); | ||
} | ||
if (self.type === 'local') { | ||
if ('local' === self.type) { | ||
self.$video.muted = true; | ||
@@ -525,11 +539,11 @@ } | ||
if (self.type === 'youtube' && self.player.mute) { | ||
if ('youtube' === self.type && self.player.mute) { | ||
self.player.unMute(); | ||
} | ||
if (self.type === 'vimeo' && self.player.setVolume) { | ||
if ('vimeo' === self.type && self.player.setVolume) { | ||
self.player.setVolume(self.options.volume); | ||
} | ||
if (self.type === 'local') { | ||
if ('local' === self.type) { | ||
self.$video.muted = false; | ||
@@ -548,11 +562,11 @@ } | ||
if (self.type === 'youtube' && self.player.setVolume) { | ||
if ('youtube' === self.type && self.player.setVolume) { | ||
self.player.setVolume(volume); | ||
} | ||
if (self.type === 'vimeo' && self.player.setVolume) { | ||
if ('vimeo' === self.type && self.player.setVolume) { | ||
self.player.setVolume(volume); | ||
} | ||
if (self.type === 'local') { | ||
if ('local' === self.type) { | ||
self.$video.volume = volume / 100; | ||
@@ -571,7 +585,7 @@ } | ||
if (self.type === 'youtube' && self.player.getVolume) { | ||
if ('youtube' === self.type && self.player.getVolume) { | ||
callback(self.player.getVolume()); | ||
} | ||
if (self.type === 'vimeo' && self.player.getVolume) { | ||
if ('vimeo' === self.type && self.player.getVolume) { | ||
self.player.getVolume().then(function (volume) { | ||
@@ -582,3 +596,3 @@ callback(volume); | ||
if (self.type === 'local') { | ||
if ('local' === self.type) { | ||
callback(self.$video.volume * 100); | ||
@@ -597,7 +611,7 @@ } | ||
if (self.type === 'youtube' && self.player.isMuted) { | ||
if ('youtube' === self.type && self.player.isMuted) { | ||
callback(self.player.isMuted()); | ||
} | ||
if (self.type === 'vimeo' && self.player.getVolume) { | ||
if ('vimeo' === self.type && self.player.getVolume) { | ||
self.player.getVolume().then(function (volume) { | ||
@@ -608,3 +622,3 @@ callback(!!volume); | ||
if (self.type === 'local') { | ||
if ('local' === self.type) { | ||
callback(self.$video.muted); | ||
@@ -623,3 +637,3 @@ } | ||
if (self.type === 'youtube') { | ||
if ('youtube' === self.type) { | ||
var availableSizes = ['maxresdefault', 'sddefault', 'hqdefault', '0']; | ||
@@ -631,3 +645,3 @@ var step = 0; | ||
// if no thumbnail, youtube add their own image with width = 120px | ||
if ((this.naturalWidth || this.width) !== 120 || step === availableSizes.length - 1) { | ||
if (120 !== (this.naturalWidth || this.width) || step === availableSizes.length - 1) { | ||
// ok | ||
@@ -638,3 +652,3 @@ self.videoImage = "https://img.youtube.com/vi/".concat(self.videoID, "/").concat(availableSizes[step], ".jpg"); | ||
// try another size | ||
step++; | ||
step += 1; | ||
this.src = "https://img.youtube.com/vi/".concat(self.videoID, "/").concat(availableSizes[step], ".jpg"); | ||
@@ -647,3 +661,3 @@ } | ||
if (self.type === 'vimeo') { | ||
if ('vimeo' === self.type) { | ||
var request = new XMLHttpRequest(); | ||
@@ -653,4 +667,4 @@ request.open('GET', "https://vimeo.com/api/v2/video/".concat(self.videoID, ".json"), true); | ||
request.onreadystatechange = function () { | ||
if (this.readyState === 4) { | ||
if (this.status >= 200 && this.status < 400) { | ||
if (4 === this.readyState) { | ||
if (200 <= this.status && 400 > this.status) { | ||
// Success! | ||
@@ -695,3 +709,3 @@ var response = JSON.parse(this.responseText); | ||
if (self.type === 'youtube') { | ||
if ('youtube' === self.type) { | ||
self.playerOptions = {}; | ||
@@ -752,7 +766,7 @@ self.playerOptions.videoId = self.videoID; | ||
// loop | ||
if (self.options.loop && e.data === YT.PlayerState.ENDED) { | ||
if (self.options.loop && e.data === global__WEBPACK_IMPORTED_MODULE_0___default.a.YT.PlayerState.ENDED) { | ||
self.play(self.options.startTime); | ||
} | ||
if (!ytStarted && e.data === YT.PlayerState.PLAYING) { | ||
if (!ytStarted && e.data === global__WEBPACK_IMPORTED_MODULE_0___default.a.YT.PlayerState.PLAYING) { | ||
ytStarted = 1; | ||
@@ -762,11 +776,11 @@ self.fire('started', e); | ||
if (e.data === YT.PlayerState.PLAYING) { | ||
if (e.data === global__WEBPACK_IMPORTED_MODULE_0___default.a.YT.PlayerState.PLAYING) { | ||
self.fire('play', e); | ||
} | ||
if (e.data === YT.PlayerState.PAUSED) { | ||
if (e.data === global__WEBPACK_IMPORTED_MODULE_0___default.a.YT.PlayerState.PAUSED) { | ||
self.fire('pause', e); | ||
} | ||
if (e.data === YT.PlayerState.ENDED) { | ||
if (e.data === global__WEBPACK_IMPORTED_MODULE_0___default.a.YT.PlayerState.ENDED) { | ||
self.fire('ended', e); | ||
@@ -776,3 +790,3 @@ } // progress check | ||
if (e.data === YT.PlayerState.PLAYING) { | ||
if (e.data === global__WEBPACK_IMPORTED_MODULE_0___default.a.YT.PlayerState.PLAYING) { | ||
ytProgressInterval = setInterval(function () { | ||
@@ -792,2 +806,5 @@ self.fire('timeupdate', e); // check for end of video and play again or stop | ||
} | ||
}, | ||
onError: function onError(e) { | ||
self.fire('error', e); | ||
} | ||
@@ -804,3 +821,3 @@ }; | ||
self.player = self.player || new window.YT.Player(self.playerID, self.playerOptions); | ||
self.player = self.player || new global__WEBPACK_IMPORTED_MODULE_0___default.a.YT.Player(self.playerID, self.playerOptions); | ||
@@ -816,3 +833,3 @@ if (firstInit) { | ||
if (self.type === 'vimeo') { | ||
if ('vimeo' === self.type) { | ||
self.playerOptions = { | ||
@@ -837,2 +854,3 @@ id: self.videoID, | ||
self.playerOptions.title = 0; | ||
self.playerOptions.background = 1; | ||
} | ||
@@ -843,3 +861,3 @@ | ||
Object.keys(self.playerOptions).forEach(function (key) { | ||
if (playerOptionsString !== '') { | ||
if ('' !== playerOptionsString) { | ||
playerOptionsString += '&'; | ||
@@ -862,3 +880,3 @@ } | ||
self.player = self.player || new Vimeo.Player(self.$video, self.playerOptions); // set current time for autoplay | ||
self.player = self.player || new global__WEBPACK_IMPORTED_MODULE_0___default.a.Vimeo.Player(self.$video, self.playerOptions); // set current time for autoplay | ||
@@ -899,3 +917,3 @@ if (self.options.startTime && self.options.autoplay) { | ||
if (self.options.startTime && e.seconds === 0) { | ||
if (self.options.startTime && 0 === e.seconds) { | ||
self.play(self.options.startTime); | ||
@@ -916,2 +934,5 @@ } | ||
}); | ||
self.player.on('error', function (e) { | ||
self.fire('error', e); | ||
}); | ||
} // Local | ||
@@ -927,3 +948,3 @@ | ||
if (self.type === 'local') { | ||
if ('local' === self.type) { | ||
if (!self.$video) { | ||
@@ -1006,2 +1027,5 @@ self.$video = document.createElement('video'); // show controls | ||
}); | ||
self.player.addEventListener('error', function (e) { | ||
self.fire('error', e); | ||
}); | ||
} | ||
@@ -1029,3 +1053,3 @@ | ||
if (self.type === 'youtube' && !YoutubeAPIadded) { | ||
if ('youtube' === self.type && !YoutubeAPIadded) { | ||
YoutubeAPIadded = 1; | ||
@@ -1036,4 +1060,9 @@ src = 'https://www.youtube.com/iframe_api'; | ||
if (self.type === 'vimeo' && !VimeoAPIadded) { | ||
VimeoAPIadded = 1; | ||
if ('vimeo' === self.type && !VimeoAPIadded) { | ||
VimeoAPIadded = 1; // Useful when Vimeo API added using RequireJS https://github.com/nk-o/video-worker/pull/7 | ||
if ('undefined' !== typeof global__WEBPACK_IMPORTED_MODULE_0___default.a.Vimeo) { | ||
return; | ||
} | ||
src = 'https://player.vimeo.com/api/player.js'; | ||
@@ -1059,5 +1088,5 @@ } | ||
if (self.type === 'youtube') { | ||
if ('youtube' === self.type) { | ||
// Listen for global YT player callback | ||
if ((typeof YT === 'undefined' || YT.loaded === 0) && !loadingYoutubePlayer) { | ||
if (('undefined' === typeof global__WEBPACK_IMPORTED_MODULE_0___default.a.YT || 0 === global__WEBPACK_IMPORTED_MODULE_0___default.a.YT.loaded) && !loadingYoutubePlayer) { | ||
// Prevents Ready event from being called twice | ||
@@ -1071,3 +1100,3 @@ loadingYoutubePlayer = 1; // Creates deferred so, other players know when to wait. | ||
}; | ||
} else if ((typeof YT === "undefined" ? "undefined" : _typeof(YT)) === 'object' && YT.loaded === 1) { | ||
} else if ('object' === _typeof(global__WEBPACK_IMPORTED_MODULE_0___default.a.YT) && 1 === global__WEBPACK_IMPORTED_MODULE_0___default.a.YT.loaded) { | ||
callback(); | ||
@@ -1082,7 +1111,7 @@ } else { | ||
if (self.type === 'vimeo') { | ||
if (typeof Vimeo === 'undefined' && !loadingVimeoPlayer) { | ||
if ('vimeo' === self.type) { | ||
if ('undefined' === typeof global__WEBPACK_IMPORTED_MODULE_0___default.a.Vimeo && !loadingVimeoPlayer) { | ||
loadingVimeoPlayer = 1; | ||
var vimeoInterval = setInterval(function () { | ||
if (typeof Vimeo !== 'undefined') { | ||
if ('undefined' !== typeof global__WEBPACK_IMPORTED_MODULE_0___default.a.Vimeo) { | ||
clearInterval(vimeoInterval); | ||
@@ -1093,3 +1122,3 @@ loadingVimeoDefer.resolve('done'); | ||
}, 20); | ||
} else if (typeof Vimeo !== 'undefined') { | ||
} else if ('undefined' !== typeof global__WEBPACK_IMPORTED_MODULE_0___default.a.Vimeo) { | ||
callback(); | ||
@@ -1104,3 +1133,3 @@ } else { | ||
if (self.type === 'local') { | ||
if ('local' === self.type) { | ||
callback(); | ||
@@ -1117,3 +1146,3 @@ } | ||
/***/ }), | ||
/* 10 */ | ||
/* 9 */ | ||
/***/ (function(module, __webpack_exports__, __webpack_require__) { | ||
@@ -1125,4 +1154,3 @@ | ||
/* harmony import */ var video_worker__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(8); | ||
/* harmony import */ var video_worker__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(video_worker__WEBPACK_IMPORTED_MODULE_0__); | ||
/* harmony import */ var global__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(4); | ||
/* harmony import */ var global__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(3); | ||
/* harmony import */ var global__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(global__WEBPACK_IMPORTED_MODULE_1__); | ||
@@ -1134,3 +1162,3 @@ | ||
if (typeof jarallax === 'undefined') { | ||
if ('undefined' === typeof jarallax) { | ||
return; | ||
@@ -1165,3 +1193,13 @@ } | ||
}); | ||
self.$video = video; | ||
self.$video = video; // add Poster attribute to self-hosted video | ||
if ('local' === self.video.type) { | ||
if (self.image.src) { | ||
self.$video.setAttribute('poster', self.image.src); | ||
} else if (self.image.$item && 'IMG' === self.image.$item.tagName && self.image.$item.src) { | ||
self.$video.setAttribute('poster', self.image.$item.src); | ||
} | ||
} // insert video tag | ||
self.image.$container.appendChild(video); // remove parent video element (created by VideoWorker) | ||
@@ -1182,3 +1220,3 @@ | ||
if (imageData && self.video && node && (node === 'IFRAME' || node === 'VIDEO')) { | ||
if (imageData && self.video && node && ('IFRAME' === node || 'VIDEO' === node)) { | ||
var h = imageData.image.height; | ||
@@ -1197,3 +1235,3 @@ var w = h * self.image.width / self.image.height; | ||
if (node === 'IFRAME') { | ||
if ('IFRAME' === node) { | ||
h += 400; | ||
@@ -1241,5 +1279,6 @@ mt -= 200; | ||
return defaultResult; | ||
} | ||
} // Init video api | ||
var video = new video_worker__WEBPACK_IMPORTED_MODULE_0___default.a(self.options.videoSrc, { | ||
var video = new video_worker__WEBPACK_IMPORTED_MODULE_0__["default"](self.options.videoSrc, { | ||
autoplay: true, | ||
@@ -1254,4 +1293,25 @@ loop: self.options.videoLoop, | ||
function resetDefaultImage() { | ||
if (self.image.$default_item) { | ||
self.image.$item = self.image.$default_item; | ||
self.image.$item.style.display = 'block'; // set image width and height | ||
self.coverImage(); | ||
self.clipContainer(); | ||
self.onScroll(); | ||
} | ||
} | ||
if (video.isValid()) { | ||
// if parallax will not be inited, we can add thumbnail on background. | ||
// Force enable parallax. | ||
// When the parallax disabled on mobile devices, we still need to display videos. | ||
// https://github.com/nk-o/jarallax/issues/159 | ||
if (this.options.disableParallax()) { | ||
defaultResult = true; | ||
self.image.position = 'absolute'; | ||
self.options.type = 'scroll'; | ||
self.options.speed = 1; | ||
} // if parallax will not be inited, we can add thumbnail on background. | ||
if (!defaultResult) { | ||
@@ -1284,3 +1344,3 @@ if (!self.defaultInitImgResult) { | ||
if (self.options.videoLoop || !self.options.videoLoop && !self.videoEnded) { | ||
if (!self.videoError && (self.options.videoLoop || !self.options.videoLoop && !self.videoEnded)) { | ||
if (self.isVisible()) { | ||
@@ -1312,15 +1372,10 @@ video.play(); | ||
video.on('ended', function () { | ||
self.videoEnded = true; | ||
self.videoEnded = true; // show default image if Loop disabled. | ||
if (!self.options.videoLoop) { | ||
// show image if Loop disabled | ||
if (self.image.$default_item) { | ||
self.image.$item = self.image.$default_item; | ||
self.image.$item.style.display = 'block'; // set image width and height | ||
resetDefaultImage(); | ||
}); | ||
video.on('error', function () { | ||
self.videoError = true; // show default image if video loading error. | ||
self.coverImage(); | ||
self.clipContainer(); | ||
self.onScroll(); | ||
} | ||
} | ||
resetDefaultImage(); | ||
}); | ||
@@ -1330,6 +1385,6 @@ self.video = video; // set image if not exists | ||
if (!self.defaultInitImgResult) { | ||
// set empty image on local video if not defined | ||
// set empty image on self-hosted video if not defined | ||
self.image.src = 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7'; | ||
if (video.type !== 'local') { | ||
if ('local' !== video.type) { | ||
video.getImageURL(function (url) { | ||
@@ -1341,4 +1396,2 @@ self.image.bgImage = "url(\"".concat(url, "\")"); | ||
} | ||
return true; | ||
} | ||
@@ -1345,0 +1398,0 @@ } |
@@ -6,3 +6,3 @@ /*! | ||
* GitHub : https://github.com/nk-o/jarallax | ||
*/!function(o){var i={};function n(e){if(i[e])return i[e].exports;var t=i[e]={i:e,l:!1,exports:{}};return o[e].call(t.exports,t,t.exports,n),t.l=!0,t.exports}n.m=o,n.c=i,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(o,i,function(e){return t[e]}.bind(null,i));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=6)}([,,function(e,t){e.exports=function(e){"complete"===document.readyState||"interactive"===document.readyState?e.call():document.attachEvent?document.attachEvent("onreadystatechange",function(){"interactive"===document.readyState&&e.call()}):document.addEventListener&&document.addEventListener("DOMContentLoaded",e)}},,function(o,e,t){(function(e){var t;t="undefined"!=typeof window?window:void 0!==e?e:"undefined"!=typeof self?self:{},o.exports=t}).call(this,t(5))},function(e,t){function o(e){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var i;i=function(){return this}();try{i=i||new Function("return this")()}catch(e){"object"===("undefined"==typeof window?"undefined":o(window))&&(i=window)}e.exports=i},function(e,t,o){e.exports=o(7)},function(e,t,o){"use strict";o.r(t);var i=o(8),n=o.n(i),a=o(4),r=o.n(a),l=o(2),p=o.n(l),u=o(10);r.a.VideoWorker=r.a.VideoWorker||n.a,Object(u.default)(),p()(function(){"undefined"!=typeof jarallax&&jarallax(document.querySelectorAll("[data-jarallax-video]"))})},function(e,t,o){e.exports=o(9)},function(e,t,o){"use strict";function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function a(e,t){for(var o=0;o<t.length;o++){var i=t[o];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function i(){this._done=[],this._fail=[]}o.r(t),o.d(t,"default",function(){return c}),i.prototype={execute:function(e,t){var o=e.length;for(t=Array.prototype.slice.call(t);o--;)e[o].apply(null,t)},resolve:function(){this.execute(this._done,arguments)},reject:function(){this.execute(this._fail,arguments)},done:function(e){this._done.push(e)},fail:function(e){this._fail.push(e)}};var r=0,l=0,p=0,u=0,s=0,d=new i,y=new i,c=function(){function i(e,t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,i);var o=this;o.url=e,o.options_default={autoplay:!1,loop:!1,mute:!1,volume:100,showContols:!0,startTime:0,endTime:0},o.options=o.extend({},o.options_default,t),o.videoID=o.parseURL(e),o.videoID&&(o.ID=r++,o.loadAPI(),o.init())}return function(e,t,o){t&&a(e.prototype,t),o&&a(e,o)}(i,[{key:"extend",value:function(o){var i=arguments;return o=o||{},Object.keys(arguments).forEach(function(t){i[t]&&Object.keys(i[t]).forEach(function(e){o[e]=i[t][e]})}),o}},{key:"parseURL",value:function(e){var t,o,i,n,a,r=!(!(t=e.match(/.*(?:youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=)([^#\&\?]*).*/))||11!==t[1].length)&&t[1],l=!(!(o=e.match(/https?:\/\/(?:www\.|player\.)?vimeo.com\/(?:channels\/(?:\w+\/)?|groups\/([^\/]*)\/videos\/|album\/(\d+)\/video\/|video\/|)(\d+)(?:$|\/|\?)/))||!o[3])&&o[3],p=(i=e.split(/,(?=mp4\:|webm\:|ogv\:|ogg\:)/),n={},a=0,i.forEach(function(e){var t=e.match(/^(mp4|webm|ogv|ogg)\:(.*)/);t&&t[1]&&t[2]&&(n["ogv"===t[1]?"ogg":t[1]]=t[2],a=1)}),!!a&&n);return r?(this.type="youtube",r):l?(this.type="vimeo",l):!!p&&(this.type="local",p)}},{key:"isValid",value:function(){return!!this.videoID}},{key:"on",value:function(e,t){this.userEventsList=this.userEventsList||[],(this.userEventsList[e]||(this.userEventsList[e]=[])).push(t)}},{key:"off",value:function(o,i){var n=this;this.userEventsList&&this.userEventsList[o]&&(i?this.userEventsList[o].forEach(function(e,t){e===i&&(n.userEventsList[o][t]=!1)}):delete this.userEventsList[o])}},{key:"fire",value:function(e){var t=this,o=[].slice.call(arguments,1);this.userEventsList&&void 0!==this.userEventsList[e]&&this.userEventsList[e].forEach(function(e){e&&e.apply(t,o)})}},{key:"play",value:function(e){var t=this;t.player&&("youtube"===t.type&&t.player.playVideo&&(void 0!==e&&t.player.seekTo(e||0),YT.PlayerState.PLAYING!==t.player.getPlayerState()&&t.player.playVideo()),"vimeo"===t.type&&(void 0!==e&&t.player.setCurrentTime(e),t.player.getPaused().then(function(e){e&&t.player.play()})),"local"===t.type&&(void 0!==e&&(t.player.currentTime=e),t.player.paused&&t.player.play()))}},{key:"pause",value:function(){var t=this;t.player&&("youtube"===t.type&&t.player.pauseVideo&&YT.PlayerState.PLAYING===t.player.getPlayerState()&&t.player.pauseVideo(),"vimeo"===t.type&&t.player.getPaused().then(function(e){e||t.player.pause()}),"local"===t.type&&(t.player.paused||t.player.pause()))}},{key:"mute",value:function(){var e=this;e.player&&("youtube"===e.type&&e.player.mute&&e.player.mute(),"vimeo"===e.type&&e.player.setVolume&&e.player.setVolume(0),"local"===e.type&&(e.$video.muted=!0))}},{key:"unmute",value:function(){var e=this;e.player&&("youtube"===e.type&&e.player.mute&&e.player.unMute(),"vimeo"===e.type&&e.player.setVolume&&e.player.setVolume(e.options.volume),"local"===e.type&&(e.$video.muted=!1))}},{key:"setVolume",value:function(e){var t=0<arguments.length&&void 0!==e&&e,o=this;o.player&&t&&("youtube"===o.type&&o.player.setVolume&&o.player.setVolume(t),"vimeo"===o.type&&o.player.setVolume&&o.player.setVolume(t),"local"===o.type&&(o.$video.volume=t/100))}},{key:"getVolume",value:function(t){var e=this;e.player?("youtube"===e.type&&e.player.getVolume&&t(e.player.getVolume()),"vimeo"===e.type&&e.player.getVolume&&e.player.getVolume().then(function(e){t(e)}),"local"===e.type&&t(100*e.$video.volume)):t(!1)}},{key:"getMuted",value:function(t){var e=this;e.player?("youtube"===e.type&&e.player.isMuted&&t(e.player.isMuted()),"vimeo"===e.type&&e.player.getVolume&&e.player.getVolume().then(function(e){t(!!e)}),"local"===e.type&&t(e.$video.muted)):t(null)}},{key:"getImageURL",value:function(t){var o=this;if(o.videoImage)t(o.videoImage);else{if("youtube"===o.type){var e=["maxresdefault","sddefault","hqdefault","0"],i=0,n=new Image;n.onload=function(){120!==(this.naturalWidth||this.width)||i===e.length-1?(o.videoImage="https://img.youtube.com/vi/".concat(o.videoID,"/").concat(e[i],".jpg"),t(o.videoImage)):(i++,this.src="https://img.youtube.com/vi/".concat(o.videoID,"/").concat(e[i],".jpg"))},n.src="https://img.youtube.com/vi/".concat(o.videoID,"/").concat(e[i],".jpg")}if("vimeo"===o.type){var a=new XMLHttpRequest;a.open("GET","https://vimeo.com/api/v2/video/".concat(o.videoID,".json"),!0),a.onreadystatechange=function(){if(4===this.readyState&&200<=this.status&&this.status<400){var e=JSON.parse(this.responseText);o.videoImage=e[0].thumbnail_large,t(o.videoImage)}},a.send(),a=null}}}},{key:"getIframe",value:function(e){this.getVideo(e)}},{key:"getVideo",value:function(p){var u=this;u.$video?p(u.$video):u.onAPIready(function(){var e,t;if(u.$video||((e=document.createElement("div")).style.display="none"),"youtube"===u.type){var o,i;u.playerOptions={},u.playerOptions.videoId=u.videoID,u.playerOptions.playerVars={autohide:1,rel:0,autoplay:0,playsinline:1},u.options.showContols||(u.playerOptions.playerVars.iv_load_policy=3,u.playerOptions.playerVars.modestbranding=1,u.playerOptions.playerVars.controls=0,u.playerOptions.playerVars.showinfo=0,u.playerOptions.playerVars.disablekb=1),u.playerOptions.events={onReady:function(t){if(u.options.mute?t.target.mute():u.options.volume&&t.target.setVolume(u.options.volume),u.options.autoplay&&u.play(u.options.startTime),u.fire("ready",t),u.options.loop&&!u.options.endTime){u.options.endTime=u.player.getDuration()-.1}setInterval(function(){u.getVolume(function(e){u.options.volume!==e&&(u.options.volume=e,u.fire("volumechange",t))})},150)},onStateChange:function(e){u.options.loop&&e.data===YT.PlayerState.ENDED&&u.play(u.options.startTime),o||e.data!==YT.PlayerState.PLAYING||(o=1,u.fire("started",e)),e.data===YT.PlayerState.PLAYING&&u.fire("play",e),e.data===YT.PlayerState.PAUSED&&u.fire("pause",e),e.data===YT.PlayerState.ENDED&&u.fire("ended",e),e.data===YT.PlayerState.PLAYING?i=setInterval(function(){u.fire("timeupdate",e),u.options.endTime&&u.player.getCurrentTime()>=u.options.endTime&&(u.options.loop?u.play(u.options.startTime):u.pause())},150):clearInterval(i)}};var n=!u.$video;if(n){var a=document.createElement("div");a.setAttribute("id",u.playerID),e.appendChild(a),document.body.appendChild(e)}u.player=u.player||new window.YT.Player(u.playerID,u.playerOptions),n&&(u.$video=document.getElementById(u.playerID),u.videoWidth=parseInt(u.$video.getAttribute("width"),10)||1280,u.videoHeight=parseInt(u.$video.getAttribute("height"),10)||720)}if("vimeo"===u.type){if(u.playerOptions={id:u.videoID,autopause:0,transparent:0,autoplay:u.options.autoplay?1:0,loop:u.options.loop?1:0,muted:u.options.mute?1:0},u.options.volume&&(u.playerOptions.volume=u.options.volume),u.options.showContols||(u.playerOptions.badge=0,u.playerOptions.byline=0,u.playerOptions.portrait=0,u.playerOptions.title=0),!u.$video){var r="";Object.keys(u.playerOptions).forEach(function(e){""!==r&&(r+="&"),r+="".concat(e,"=").concat(encodeURIComponent(u.playerOptions[e]))}),u.$video=document.createElement("iframe"),u.$video.setAttribute("id",u.playerID),u.$video.setAttribute("src","https://player.vimeo.com/video/".concat(u.videoID,"?").concat(r)),u.$video.setAttribute("frameborder","0"),u.$video.setAttribute("mozallowfullscreen",""),u.$video.setAttribute("allowfullscreen",""),e.appendChild(u.$video),document.body.appendChild(e)}var l;u.player=u.player||new Vimeo.Player(u.$video,u.playerOptions),u.options.startTime&&u.options.autoplay&&u.player.setCurrentTime(u.options.startTime),u.player.getVideoWidth().then(function(e){u.videoWidth=e||1280}),u.player.getVideoHeight().then(function(e){u.videoHeight=e||720}),u.player.on("timeupdate",function(e){l||(u.fire("started",e),l=1),u.fire("timeupdate",e),u.options.endTime&&u.options.endTime&&e.seconds>=u.options.endTime&&(u.options.loop?u.play(u.options.startTime):u.pause())}),u.player.on("play",function(e){u.fire("play",e),u.options.startTime&&0===e.seconds&&u.play(u.options.startTime)}),u.player.on("pause",function(e){u.fire("pause",e)}),u.player.on("ended",function(e){u.fire("ended",e)}),u.player.on("loaded",function(e){u.fire("ready",e)}),u.player.on("volumechange",function(e){u.fire("volumechange",e)})}"local"===u.type&&(u.$video||(u.$video=document.createElement("video"),u.options.showContols&&(u.$video.controls=!0),u.options.mute?u.$video.muted=!0:u.$video.volume&&(u.$video.volume=u.options.volume/100),u.options.loop&&(u.$video.loop=!0),u.$video.setAttribute("playsinline",""),u.$video.setAttribute("webkit-playsinline",""),u.$video.setAttribute("id",u.playerID),e.appendChild(u.$video),document.body.appendChild(e),Object.keys(u.videoID).forEach(function(e){!function(e,t,o){var i=document.createElement("source");i.src=t,i.type=o,e.appendChild(i)}(u.$video,u.videoID[e],"video/".concat(e))})),u.player=u.player||u.$video,u.player.addEventListener("playing",function(e){t||u.fire("started",e),t=1}),u.player.addEventListener("timeupdate",function(e){u.fire("timeupdate",e),u.options.endTime&&u.options.endTime&&this.currentTime>=u.options.endTime&&(u.options.loop?u.play(u.options.startTime):u.pause())}),u.player.addEventListener("play",function(e){u.fire("play",e)}),u.player.addEventListener("pause",function(e){u.fire("pause",e)}),u.player.addEventListener("ended",function(e){u.fire("ended",e)}),u.player.addEventListener("loadedmetadata",function(){u.videoWidth=this.videoWidth||1280,u.videoHeight=this.videoHeight||720,u.fire("ready"),u.options.autoplay&&u.play(u.options.startTime)}),u.player.addEventListener("volumechange",function(e){u.getVolume(function(e){u.options.volume=e}),u.fire("volumechange",e)}));p(u.$video)})}},{key:"init",value:function(){this.playerID="VideoWorker-".concat(this.ID)}},{key:"loadAPI",value:function(){if(!l||!p){var e="";if("youtube"!==this.type||l||(l=1,e="https://www.youtube.com/iframe_api"),"vimeo"!==this.type||p||(p=1,e="https://player.vimeo.com/api/player.js"),e){var t=document.createElement("script"),o=document.getElementsByTagName("head")[0];t.src=e,o.appendChild(t),t=o=null}}}},{key:"onAPIready",value:function(e){if("youtube"===this.type&&("undefined"!=typeof YT&&0!==YT.loaded||u?"object"===("undefined"==typeof YT?"undefined":n(YT))&&1===YT.loaded?e():d.done(function(){e()}):(u=1,window.onYouTubeIframeAPIReady=function(){window.onYouTubeIframeAPIReady=null,d.resolve("done"),e()})),"vimeo"===this.type)if("undefined"!=typeof Vimeo||s)"undefined"!=typeof Vimeo?e():y.done(function(){e()});else{s=1;var t=setInterval(function(){"undefined"!=typeof Vimeo&&(clearInterval(t),y.resolve("done"),e())},20)}"local"===this.type&&e()}}]),i}()},function(e,t,o){"use strict";o.r(t),o.d(t,"default",function(){return a});var i=o(8),r=o.n(i),n=o(4),p=o.n(n);function a(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:p.a.jarallax;if(void 0!==e){var t=e.constructor,i=t.prototype.onScroll;t.prototype.onScroll=function(){var o=this;i.apply(o),o.isVideoInserted||!o.video||o.options.videoLazyLoading&&!o.isElementInViewport||o.options.disableVideo()||(o.isVideoInserted=!0,o.video.getVideo(function(e){var t=e.parentNode;o.css(e,{position:o.image.position,top:"0px",left:"0px",right:"0px",bottom:"0px",width:"100%",height:"100%",maxWidth:"none",maxHeight:"none",margin:0,zIndex:-1}),o.$video=e,o.image.$container.appendChild(e),t.parentNode.removeChild(t)}))};var l=t.prototype.coverImage;t.prototype.coverImage=function(){var e=this,t=l.apply(e),o=!!e.image.$item&&e.image.$item.nodeName;if(t&&e.video&&o&&("IFRAME"===o||"VIDEO"===o)){var i=t.image.height,n=i*e.image.width/e.image.height,a=(t.container.width-n)/2,r=t.image.marginTop;t.container.width>n&&(i=(n=t.container.width)*e.image.height/e.image.width,a=0,r+=(t.image.height-i)/2),"IFRAME"===o&&(i+=400,r-=200),e.css(e.$video,{width:"".concat(n,"px"),marginLeft:"".concat(a,"px"),height:"".concat(i,"px"),marginTop:"".concat(r,"px")})}return t};var o=t.prototype.initImg;t.prototype.initImg=function(){var e=this,t=o.apply(e);return e.options.videoSrc||(e.options.videoSrc=e.$item.getAttribute("data-jarallax-video")||null),e.options.videoSrc?(e.defaultInitImgResult=t,!0):t};var n=t.prototype.canInitParallax;t.prototype.canInitParallax=function(){var o=this,e=n.apply(o);if(!o.options.videoSrc)return e;var t=new r.a(o.options.videoSrc,{autoplay:!0,loop:o.options.videoLoop,showContols:!1,startTime:o.options.videoStartTime||0,endTime:o.options.videoEndTime||0,mute:o.options.videoVolume?0:1,volume:o.options.videoVolume||0});if(t.isValid())if(e){if(t.on("ready",function(){if(o.options.videoPlayOnlyVisible){var e=o.onScroll;o.onScroll=function(){e.apply(o),!o.options.videoLoop&&(o.options.videoLoop||o.videoEnded)||(o.isVisible()?t.play():t.pause())}}else t.play()}),t.on("started",function(){o.image.$default_item=o.image.$item,o.image.$item=o.$video,o.image.width=o.video.videoWidth||1280,o.image.height=o.video.videoHeight||720,o.coverImage(),o.clipContainer(),o.onScroll(),o.image.$default_item&&(o.image.$default_item.style.display="none")}),t.on("ended",function(){o.videoEnded=!0,o.options.videoLoop||o.image.$default_item&&(o.image.$item=o.image.$default_item,o.image.$item.style.display="block",o.coverImage(),o.clipContainer(),o.onScroll())}),o.video=t,!o.defaultInitImgResult)return o.image.src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7","local"===t.type||(t.getImageURL(function(e){o.image.bgImage='url("'.concat(e,'")'),o.init()}),!1)}else o.defaultInitImgResult||t.getImageURL(function(e){var t=o.$item.getAttribute("style");t&&o.$item.setAttribute("data-jarallax-original-styles",t),o.css(o.$item,{"background-image":'url("'.concat(e,'")'),"background-position":"center","background-size":"cover"})});return e};var a=t.prototype.destroy;t.prototype.destroy=function(){var e=this;e.image.$default_item&&(e.image.$item=e.image.$default_item,delete e.image.$default_item),a.apply(e)}}}}]); | ||
*/!function(o){var i={};function n(e){if(i[e])return i[e].exports;var t=i[e]={i:e,l:!1,exports:{}};return o[e].call(t.exports,t,t.exports,n),t.l=!0,t.exports}n.m=o,n.c=i,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(o,i,function(e){return t[e]}.bind(null,i));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=6)}([,,function(e,t){e.exports=function(e){"complete"===document.readyState||"interactive"===document.readyState?e.call():document.attachEvent?document.attachEvent("onreadystatechange",function(){"interactive"===document.readyState&&e.call()}):document.addEventListener&&document.addEventListener("DOMContentLoaded",e)}},function(o,e,t){(function(e){var t;t="undefined"!=typeof window?window:void 0!==e?e:"undefined"!=typeof self?self:{},o.exports=t}).call(this,t(4))},function(e,t){function o(e){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var i;i=function(){return this}();try{i=i||new Function("return this")()}catch(e){"object"===("undefined"==typeof window?"undefined":o(window))&&(i=window)}e.exports=i},,function(e,t,o){e.exports=o(7)},function(e,t,o){"use strict";o.r(t);var i=o(8),n=o(3),a=o.n(n),r=o(2),l=o.n(r),p=o(9);a.a.VideoWorker=a.a.VideoWorker||i.default,Object(p.default)(),l()(function(){void 0!==a.a.jarallax&&a.a.jarallax(document.querySelectorAll("[data-jarallax-video]"))})},function(e,t,o){"use strict";o.r(t),o.d(t,"default",function(){return m});var i=o(3),s=o.n(i);function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function a(e,t){for(var o=0;o<t.length;o++){var i=t[o];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function r(){this.done=[],this.fail=[]}r.prototype={execute:function(e,t){var o=e.length;for(t=Array.prototype.slice.call(t);o;)e[--o].apply(null,t)},resolve:function(){for(var e=arguments.length,t=new Array(e),o=0;o<e;o++)t[o]=arguments[o];this.execute(this.done,t)},reject:function(){for(var e=arguments.length,t=new Array(e),o=0;o<e;o++)t[o]=arguments[o];this.execute(this.fail,t)},done:function(e){this.done.push(e)},fail:function(e){this.fail.push(e)}};var l=0,p=0,u=0,d=0,y=0,c=new r,v=new r,m=function(){function i(e,t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,i);var o=this;o.url=e,o.options_default={autoplay:!1,loop:!1,mute:!1,volume:100,showContols:!0,startTime:0,endTime:0},o.options=o.extend({},o.options_default,t),o.videoID=o.parseURL(e),o.videoID&&(o.ID=l,l+=1,o.loadAPI(),o.init())}var e,t,o;return e=i,(t=[{key:"extend",value:function(){for(var e=arguments.length,o=new Array(e),t=0;t<e;t++)o[t]=arguments[t];var i=o[0]||{};return Object.keys(o).forEach(function(t){o[t]&&Object.keys(o[t]).forEach(function(e){i[e]=o[t][e]})}),i}},{key:"parseURL",value:function(e){var t,o,i,n,a,r=!(!(t=e.match(/.*(?:youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=)([^#\&\?]*).*/))||11!==t[1].length)&&t[1],l=!(!(o=e.match(/https?:\/\/(?:www\.|player\.)?vimeo.com\/(?:channels\/(?:\w+\/)?|groups\/([^\/]*)\/videos\/|album\/(\d+)\/video\/|video\/|)(\d+)(?:$|\/|\?)/))||!o[3])&&o[3],p=(i=e.split(/,(?=mp4\:|webm\:|ogv\:|ogg\:)/),n={},a=0,i.forEach(function(e){var t=e.match(/^(mp4|webm|ogv|ogg)\:(.*)/);t&&t[1]&&t[2]&&(n["ogv"===t[1]?"ogg":t[1]]=t[2],a=1)}),!!a&&n);return r?(this.type="youtube",r):l?(this.type="vimeo",l):!!p&&(this.type="local",p)}},{key:"isValid",value:function(){return!!this.videoID}},{key:"on",value:function(e,t){this.userEventsList=this.userEventsList||[],(this.userEventsList[e]||(this.userEventsList[e]=[])).push(t)}},{key:"off",value:function(o,i){var n=this;this.userEventsList&&this.userEventsList[o]&&(i?this.userEventsList[o].forEach(function(e,t){e===i&&(n.userEventsList[o][t]=!1)}):delete this.userEventsList[o])}},{key:"fire",value:function(e){for(var t=this,o=arguments.length,i=new Array(1<o?o-1:0),n=1;n<o;n++)i[n-1]=arguments[n];this.userEventsList&&void 0!==this.userEventsList[e]&&this.userEventsList[e].forEach(function(e){e&&e.apply(t,i)})}},{key:"play",value:function(e){var t=this;t.player&&("youtube"===t.type&&t.player.playVideo&&(void 0!==e&&t.player.seekTo(e||0),s.a.YT.PlayerState.PLAYING!==t.player.getPlayerState()&&t.player.playVideo()),"vimeo"===t.type&&(void 0!==e&&t.player.setCurrentTime(e),t.player.getPaused().then(function(e){e&&t.player.play()})),"local"===t.type&&(void 0!==e&&(t.player.currentTime=e),t.player.paused&&t.player.play()))}},{key:"pause",value:function(){var t=this;t.player&&("youtube"===t.type&&t.player.pauseVideo&&s.a.YT.PlayerState.PLAYING===t.player.getPlayerState()&&t.player.pauseVideo(),"vimeo"===t.type&&t.player.getPaused().then(function(e){e||t.player.pause()}),"local"===t.type&&(t.player.paused||t.player.pause()))}},{key:"mute",value:function(){var e=this;e.player&&("youtube"===e.type&&e.player.mute&&e.player.mute(),"vimeo"===e.type&&e.player.setVolume&&e.player.setVolume(0),"local"===e.type&&(e.$video.muted=!0))}},{key:"unmute",value:function(){var e=this;e.player&&("youtube"===e.type&&e.player.mute&&e.player.unMute(),"vimeo"===e.type&&e.player.setVolume&&e.player.setVolume(e.options.volume),"local"===e.type&&(e.$video.muted=!1))}},{key:"setVolume",value:function(e){var t=0<arguments.length&&void 0!==e&&e,o=this;o.player&&t&&("youtube"===o.type&&o.player.setVolume&&o.player.setVolume(t),"vimeo"===o.type&&o.player.setVolume&&o.player.setVolume(t),"local"===o.type&&(o.$video.volume=t/100))}},{key:"getVolume",value:function(t){var e=this;e.player?("youtube"===e.type&&e.player.getVolume&&t(e.player.getVolume()),"vimeo"===e.type&&e.player.getVolume&&e.player.getVolume().then(function(e){t(e)}),"local"===e.type&&t(100*e.$video.volume)):t(!1)}},{key:"getMuted",value:function(t){var e=this;e.player?("youtube"===e.type&&e.player.isMuted&&t(e.player.isMuted()),"vimeo"===e.type&&e.player.getVolume&&e.player.getVolume().then(function(e){t(!!e)}),"local"===e.type&&t(e.$video.muted)):t(null)}},{key:"getImageURL",value:function(t){var o=this;if(o.videoImage)t(o.videoImage);else{if("youtube"===o.type){var e=["maxresdefault","sddefault","hqdefault","0"],i=0,n=new Image;n.onload=function(){120!==(this.naturalWidth||this.width)||i===e.length-1?(o.videoImage="https://img.youtube.com/vi/".concat(o.videoID,"/").concat(e[i],".jpg"),t(o.videoImage)):(i+=1,this.src="https://img.youtube.com/vi/".concat(o.videoID,"/").concat(e[i],".jpg"))},n.src="https://img.youtube.com/vi/".concat(o.videoID,"/").concat(e[i],".jpg")}if("vimeo"===o.type){var a=new XMLHttpRequest;a.open("GET","https://vimeo.com/api/v2/video/".concat(o.videoID,".json"),!0),a.onreadystatechange=function(){if(4===this.readyState&&200<=this.status&&this.status<400){var e=JSON.parse(this.responseText);o.videoImage=e[0].thumbnail_large,t(o.videoImage)}},a.send(),a=null}}}},{key:"getIframe",value:function(e){this.getVideo(e)}},{key:"getVideo",value:function(p){var u=this;u.$video?p(u.$video):u.onAPIready(function(){var e,t;if(u.$video||((e=document.createElement("div")).style.display="none"),"youtube"===u.type){var o,i;u.playerOptions={},u.playerOptions.videoId=u.videoID,u.playerOptions.playerVars={autohide:1,rel:0,autoplay:0,playsinline:1},u.options.showContols||(u.playerOptions.playerVars.iv_load_policy=3,u.playerOptions.playerVars.modestbranding=1,u.playerOptions.playerVars.controls=0,u.playerOptions.playerVars.showinfo=0,u.playerOptions.playerVars.disablekb=1),u.playerOptions.events={onReady:function(t){if(u.options.mute?t.target.mute():u.options.volume&&t.target.setVolume(u.options.volume),u.options.autoplay&&u.play(u.options.startTime),u.fire("ready",t),u.options.loop&&!u.options.endTime){u.options.endTime=u.player.getDuration()-.1}setInterval(function(){u.getVolume(function(e){u.options.volume!==e&&(u.options.volume=e,u.fire("volumechange",t))})},150)},onStateChange:function(e){u.options.loop&&e.data===s.a.YT.PlayerState.ENDED&&u.play(u.options.startTime),o||e.data!==s.a.YT.PlayerState.PLAYING||(o=1,u.fire("started",e)),e.data===s.a.YT.PlayerState.PLAYING&&u.fire("play",e),e.data===s.a.YT.PlayerState.PAUSED&&u.fire("pause",e),e.data===s.a.YT.PlayerState.ENDED&&u.fire("ended",e),e.data===s.a.YT.PlayerState.PLAYING?i=setInterval(function(){u.fire("timeupdate",e),u.options.endTime&&u.player.getCurrentTime()>=u.options.endTime&&(u.options.loop?u.play(u.options.startTime):u.pause())},150):clearInterval(i)},onError:function(e){u.fire("error",e)}};var n=!u.$video;if(n){var a=document.createElement("div");a.setAttribute("id",u.playerID),e.appendChild(a),document.body.appendChild(e)}u.player=u.player||new s.a.YT.Player(u.playerID,u.playerOptions),n&&(u.$video=document.getElementById(u.playerID),u.videoWidth=parseInt(u.$video.getAttribute("width"),10)||1280,u.videoHeight=parseInt(u.$video.getAttribute("height"),10)||720)}if("vimeo"===u.type){if(u.playerOptions={id:u.videoID,autopause:0,transparent:0,autoplay:u.options.autoplay?1:0,loop:u.options.loop?1:0,muted:u.options.mute?1:0},u.options.volume&&(u.playerOptions.volume=u.options.volume),u.options.showContols||(u.playerOptions.badge=0,u.playerOptions.byline=0,u.playerOptions.portrait=0,u.playerOptions.title=0,u.playerOptions.background=1),!u.$video){var r="";Object.keys(u.playerOptions).forEach(function(e){""!==r&&(r+="&"),r+="".concat(e,"=").concat(encodeURIComponent(u.playerOptions[e]))}),u.$video=document.createElement("iframe"),u.$video.setAttribute("id",u.playerID),u.$video.setAttribute("src","https://player.vimeo.com/video/".concat(u.videoID,"?").concat(r)),u.$video.setAttribute("frameborder","0"),u.$video.setAttribute("mozallowfullscreen",""),u.$video.setAttribute("allowfullscreen",""),e.appendChild(u.$video),document.body.appendChild(e)}var l;u.player=u.player||new s.a.Vimeo.Player(u.$video,u.playerOptions),u.options.startTime&&u.options.autoplay&&u.player.setCurrentTime(u.options.startTime),u.player.getVideoWidth().then(function(e){u.videoWidth=e||1280}),u.player.getVideoHeight().then(function(e){u.videoHeight=e||720}),u.player.on("timeupdate",function(e){l||(u.fire("started",e),l=1),u.fire("timeupdate",e),u.options.endTime&&u.options.endTime&&e.seconds>=u.options.endTime&&(u.options.loop?u.play(u.options.startTime):u.pause())}),u.player.on("play",function(e){u.fire("play",e),u.options.startTime&&0===e.seconds&&u.play(u.options.startTime)}),u.player.on("pause",function(e){u.fire("pause",e)}),u.player.on("ended",function(e){u.fire("ended",e)}),u.player.on("loaded",function(e){u.fire("ready",e)}),u.player.on("volumechange",function(e){u.fire("volumechange",e)}),u.player.on("error",function(e){u.fire("error",e)})}"local"===u.type&&(u.$video||(u.$video=document.createElement("video"),u.options.showContols&&(u.$video.controls=!0),u.options.mute?u.$video.muted=!0:u.$video.volume&&(u.$video.volume=u.options.volume/100),u.options.loop&&(u.$video.loop=!0),u.$video.setAttribute("playsinline",""),u.$video.setAttribute("webkit-playsinline",""),u.$video.setAttribute("id",u.playerID),e.appendChild(u.$video),document.body.appendChild(e),Object.keys(u.videoID).forEach(function(e){var t,o,i,n;t=u.$video,o=u.videoID[e],i="video/".concat(e),(n=document.createElement("source")).src=o,n.type=i,t.appendChild(n)})),u.player=u.player||u.$video,u.player.addEventListener("playing",function(e){t||u.fire("started",e),t=1}),u.player.addEventListener("timeupdate",function(e){u.fire("timeupdate",e),u.options.endTime&&u.options.endTime&&this.currentTime>=u.options.endTime&&(u.options.loop?u.play(u.options.startTime):u.pause())}),u.player.addEventListener("play",function(e){u.fire("play",e)}),u.player.addEventListener("pause",function(e){u.fire("pause",e)}),u.player.addEventListener("ended",function(e){u.fire("ended",e)}),u.player.addEventListener("loadedmetadata",function(){u.videoWidth=this.videoWidth||1280,u.videoHeight=this.videoHeight||720,u.fire("ready"),u.options.autoplay&&u.play(u.options.startTime)}),u.player.addEventListener("volumechange",function(e){u.getVolume(function(e){u.options.volume=e}),u.fire("volumechange",e)}),u.player.addEventListener("error",function(e){u.fire("error",e)}));p(u.$video)})}},{key:"init",value:function(){this.playerID="VideoWorker-".concat(this.ID)}},{key:"loadAPI",value:function(){if(!p||!u){var e="";if("youtube"!==this.type||p||(p=1,e="https://www.youtube.com/iframe_api"),"vimeo"===this.type&&!u){if(u=1,void 0!==s.a.Vimeo)return;e="https://player.vimeo.com/api/player.js"}if(e){var t=document.createElement("script"),o=document.getElementsByTagName("head")[0];t.src=e,o.appendChild(t),t=o=null}}}},{key:"onAPIready",value:function(e){if("youtube"===this.type&&(void 0!==s.a.YT&&0!==s.a.YT.loaded||d?"object"===n(s.a.YT)&&1===s.a.YT.loaded?e():c.done(function(){e()}):(d=1,window.onYouTubeIframeAPIReady=function(){window.onYouTubeIframeAPIReady=null,c.resolve("done"),e()})),"vimeo"===this.type)if(void 0!==s.a.Vimeo||y)void 0!==s.a.Vimeo?e():v.done(function(){e()});else{y=1;var t=setInterval(function(){void 0!==s.a.Vimeo&&(clearInterval(t),v.resolve("done"),e())},20)}"local"===this.type&&e()}}])&&a(e.prototype,t),o&&a(e,o),i}()},function(e,t,o){"use strict";o.r(t),o.d(t,"default",function(){return n});var r=o(8),i=o(3),p=o.n(i);function n(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:p.a.jarallax;if(void 0!==e){var t=e.constructor,i=t.prototype.onScroll;t.prototype.onScroll=function(){var o=this;i.apply(o),o.isVideoInserted||!o.video||o.options.videoLazyLoading&&!o.isElementInViewport||o.options.disableVideo()||(o.isVideoInserted=!0,o.video.getVideo(function(e){var t=e.parentNode;o.css(e,{position:o.image.position,top:"0px",left:"0px",right:"0px",bottom:"0px",width:"100%",height:"100%",maxWidth:"none",maxHeight:"none",margin:0,zIndex:-1}),o.$video=e,"local"===o.video.type&&(o.image.src?o.$video.setAttribute("poster",o.image.src):o.image.$item&&"IMG"===o.image.$item.tagName&&o.image.$item.src&&o.$video.setAttribute("poster",o.image.$item.src)),o.image.$container.appendChild(e),t.parentNode.removeChild(t)}))};var l=t.prototype.coverImage;t.prototype.coverImage=function(){var e=this,t=l.apply(e),o=!!e.image.$item&&e.image.$item.nodeName;if(t&&e.video&&o&&("IFRAME"===o||"VIDEO"===o)){var i=t.image.height,n=i*e.image.width/e.image.height,a=(t.container.width-n)/2,r=t.image.marginTop;t.container.width>n&&(i=(n=t.container.width)*e.image.height/e.image.width,a=0,r+=(t.image.height-i)/2),"IFRAME"===o&&(i+=400,r-=200),e.css(e.$video,{width:"".concat(n,"px"),marginLeft:"".concat(a,"px"),height:"".concat(i,"px"),marginTop:"".concat(r,"px")})}return t};var o=t.prototype.initImg;t.prototype.initImg=function(){var e=this,t=o.apply(e);return e.options.videoSrc||(e.options.videoSrc=e.$item.getAttribute("data-jarallax-video")||null),e.options.videoSrc?(e.defaultInitImgResult=t,!0):t};var n=t.prototype.canInitParallax;t.prototype.canInitParallax=function(){var o=this,e=n.apply(o);if(!o.options.videoSrc)return e;var t=new r.default(o.options.videoSrc,{autoplay:!0,loop:o.options.videoLoop,showContols:!1,startTime:o.options.videoStartTime||0,endTime:o.options.videoEndTime||0,mute:o.options.videoVolume?0:1,volume:o.options.videoVolume||0});function i(){o.image.$default_item&&(o.image.$item=o.image.$default_item,o.image.$item.style.display="block",o.coverImage(),o.clipContainer(),o.onScroll())}if(t.isValid())if(this.options.disableParallax()&&(e=!0,o.image.position="absolute",o.options.type="scroll",o.options.speed=1),e){if(t.on("ready",function(){if(o.options.videoPlayOnlyVisible){var e=o.onScroll;o.onScroll=function(){e.apply(o),o.videoError||!o.options.videoLoop&&(o.options.videoLoop||o.videoEnded)||(o.isVisible()?t.play():t.pause())}}else t.play()}),t.on("started",function(){o.image.$default_item=o.image.$item,o.image.$item=o.$video,o.image.width=o.video.videoWidth||1280,o.image.height=o.video.videoHeight||720,o.coverImage(),o.clipContainer(),o.onScroll(),o.image.$default_item&&(o.image.$default_item.style.display="none")}),t.on("ended",function(){o.videoEnded=!0,i()}),t.on("error",function(){o.videoError=!0,i()}),o.video=t,!o.defaultInitImgResult&&(o.image.src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7","local"!==t.type))return t.getImageURL(function(e){o.image.bgImage='url("'.concat(e,'")'),o.init()}),!1}else o.defaultInitImgResult||t.getImageURL(function(e){var t=o.$item.getAttribute("style");t&&o.$item.setAttribute("data-jarallax-original-styles",t),o.css(o.$item,{"background-image":'url("'.concat(e,'")'),"background-position":"center","background-size":"cover"})});return e};var a=t.prototype.destroy;t.prototype.destroy=function(){var e=this;e.image.$default_item&&(e.image.$item=e.image.$default_item,delete e.image.$default_item),a.apply(e)}}}}]); | ||
//# sourceMappingURL=jarallax-video.min.js.map |
/*! | ||
* Name : Just Another Parallax [Jarallax] | ||
* Version : 1.12.0 | ||
* Version : 1.12.1 | ||
* Author : nK <https://nkdev.info> | ||
@@ -90,3 +90,3 @@ * GitHub : https://github.com/nk-o/jarallax | ||
/******/ // Load entry module and return exports | ||
/******/ return __webpack_require__(__webpack_require__.s = 11); | ||
/******/ return __webpack_require__(__webpack_require__.s = 10); | ||
/******/ }) | ||
@@ -116,4 +116,3 @@ /************************************************************************/ | ||
/***/ }), | ||
/* 3 */, | ||
/* 4 */ | ||
/* 3 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
@@ -134,9 +133,9 @@ | ||
module.exports = win; | ||
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(5))) | ||
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(4))) | ||
/***/ }), | ||
/* 5 */ | ||
/* 4 */ | ||
/***/ (function(module, exports) { | ||
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
@@ -163,2 +162,3 @@ var g; // This works in non-strict mode | ||
/***/ }), | ||
/* 5 */, | ||
/* 6 */, | ||
@@ -168,11 +168,10 @@ /* 7 */, | ||
/* 9 */, | ||
/* 10 */, | ||
/* 11 */ | ||
/* 10 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
module.exports = __webpack_require__(12); | ||
module.exports = __webpack_require__(11); | ||
/***/ }), | ||
/* 12 */ | ||
/* 11 */ | ||
/***/ (function(module, __webpack_exports__, __webpack_require__) { | ||
@@ -184,6 +183,6 @@ | ||
/* harmony import */ var lite_ready__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lite_ready__WEBPACK_IMPORTED_MODULE_0__); | ||
/* harmony import */ var global__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(4); | ||
/* harmony import */ var global__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(3); | ||
/* harmony import */ var global__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(global__WEBPACK_IMPORTED_MODULE_1__); | ||
/* harmony import */ var _jarallax_esm__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(13); | ||
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
/* harmony import */ var _jarallax_esm__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(12); | ||
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
@@ -203,8 +202,11 @@ | ||
if (typeof global__WEBPACK_IMPORTED_MODULE_1__["jQuery"] !== 'undefined') { | ||
if ('undefined' !== typeof global__WEBPACK_IMPORTED_MODULE_1__["jQuery"]) { | ||
var jQueryPlugin = function jQueryPlugin() { | ||
var args = arguments || []; | ||
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { | ||
args[_key] = arguments[_key]; | ||
} | ||
Array.prototype.unshift.call(args, this); | ||
var res = _jarallax_esm__WEBPACK_IMPORTED_MODULE_2__["default"].apply(global__WEBPACK_IMPORTED_MODULE_1__["window"], args); | ||
return _typeof(res) !== 'object' ? res : this; | ||
return 'object' !== _typeof(res) ? res : this; | ||
}; | ||
@@ -229,3 +231,3 @@ | ||
/***/ }), | ||
/* 13 */ | ||
/* 12 */ | ||
/***/ (function(module, __webpack_exports__, __webpack_require__) { | ||
@@ -237,15 +239,17 @@ | ||
/* harmony import */ var lite_ready__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lite_ready__WEBPACK_IMPORTED_MODULE_0__); | ||
/* harmony import */ var rafl__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(14); | ||
/* harmony import */ var rafl__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(rafl__WEBPACK_IMPORTED_MODULE_1__); | ||
/* harmony import */ var global__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(4); | ||
/* harmony import */ var global__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(global__WEBPACK_IMPORTED_MODULE_2__); | ||
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); } | ||
/* harmony import */ var global__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(3); | ||
/* harmony import */ var global__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(global__WEBPACK_IMPORTED_MODULE_1__); | ||
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } | ||
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } | ||
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } | ||
function _iterableToArrayLimit(arr, i) { if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]")) { return; } var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } | ||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(n); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } | ||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } | ||
function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } | ||
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } | ||
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
@@ -260,4 +264,4 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
var isIE = navigator.userAgent.indexOf('MSIE ') > -1 || navigator.userAgent.indexOf('Trident/') > -1 || navigator.userAgent.indexOf('Edge/') > -1; | ||
var navigator = global__WEBPACK_IMPORTED_MODULE_1__["window"].navigator; | ||
var isIE = -1 < navigator.userAgent.indexOf('MSIE ') || -1 < navigator.userAgent.indexOf('Trident/') || -1 < navigator.userAgent.indexOf('Edge/'); | ||
var isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent); | ||
@@ -269,3 +273,3 @@ | ||
for (var i = 0; i < prefixes.length; i++) { | ||
for (var i = 0; i < prefixes.length; i += 1) { | ||
if (div && div.style[prefixes[i]] !== undefined) { | ||
@@ -292,3 +296,3 @@ return prefixes[i]; | ||
return ($deviceHelper ? $deviceHelper.clientHeight : 0) || global__WEBPACK_IMPORTED_MODULE_2__["window"].innerHeight || document.documentElement.clientHeight; | ||
return ($deviceHelper ? $deviceHelper.clientHeight : 0) || global__WEBPACK_IMPORTED_MODULE_1__["window"].innerHeight || document.documentElement.clientHeight; | ||
} // Window height data | ||
@@ -303,3 +307,3 @@ | ||
} else { | ||
wndH = global__WEBPACK_IMPORTED_MODULE_2__["window"].innerHeight || document.documentElement.clientHeight; | ||
wndH = global__WEBPACK_IMPORTED_MODULE_1__["window"].innerHeight || document.documentElement.clientHeight; | ||
} | ||
@@ -309,5 +313,5 @@ } | ||
updateWndVars(); | ||
global__WEBPACK_IMPORTED_MODULE_2__["window"].addEventListener('resize', updateWndVars); | ||
global__WEBPACK_IMPORTED_MODULE_2__["window"].addEventListener('orientationchange', updateWndVars); | ||
global__WEBPACK_IMPORTED_MODULE_2__["window"].addEventListener('load', updateWndVars); | ||
global__WEBPACK_IMPORTED_MODULE_1__["window"].addEventListener('resize', updateWndVars); | ||
global__WEBPACK_IMPORTED_MODULE_1__["window"].addEventListener('orientationchange', updateWndVars); | ||
global__WEBPACK_IMPORTED_MODULE_1__["window"].addEventListener('load', updateWndVars); | ||
lite_ready__WEBPACK_IMPORTED_MODULE_0___default()(function () { | ||
@@ -325,6 +329,6 @@ updateWndVars({ | ||
while (elem.parentElement !== null) { | ||
while (null !== elem.parentElement) { | ||
elem = elem.parentElement; | ||
if (elem.nodeType === 1) { | ||
if (1 === elem.nodeType) { | ||
parents.push(elem); | ||
@@ -351,3 +355,3 @@ } | ||
bottom: clientRect.bottom, | ||
wndW: global__WEBPACK_IMPORTED_MODULE_2__["window"].innerWidth, | ||
wndW: global__WEBPACK_IMPORTED_MODULE_1__["window"].innerWidth, | ||
wndH: wndH | ||
@@ -367,3 +371,3 @@ }; | ||
}); | ||
rafl__WEBPACK_IMPORTED_MODULE_1___default()(updateParallax); | ||
global__WEBPACK_IMPORTED_MODULE_1__["window"].requestAnimationFrame(updateParallax); | ||
} | ||
@@ -373,5 +377,3 @@ | ||
var Jarallax = | ||
/*#__PURE__*/ | ||
function () { | ||
var Jarallax = /*#__PURE__*/function () { | ||
function Jarallax(item, userOptions) { | ||
@@ -381,3 +383,4 @@ _classCallCheck(this, Jarallax); | ||
var self = this; | ||
self.instanceID = instanceID++; | ||
self.instanceID = instanceID; | ||
instanceID += 1; | ||
self.$item = item; | ||
@@ -425,3 +428,3 @@ self.defaults = { | ||
if (loweCaseOption && typeof self.defaults[loweCaseOption] !== 'undefined') { | ||
if (loweCaseOption && 'undefined' !== typeof self.defaults[loweCaseOption]) { | ||
pureDataOptions[loweCaseOption] = dataOptions[key]; | ||
@@ -434,5 +437,5 @@ } | ||
Object.keys(self.options).forEach(function (key) { | ||
if (self.options[key] === 'true') { | ||
if ('true' === self.options[key]) { | ||
self.options[key] = true; | ||
} else if (self.options[key] === 'false') { | ||
} else if ('false' === self.options[key]) { | ||
self.options[key] = false; | ||
@@ -444,3 +447,3 @@ } | ||
if (typeof self.options.disableParallax === 'string') { | ||
if ('string' === typeof self.options.disableParallax) { | ||
self.options.disableParallax = new RegExp(self.options.disableParallax); | ||
@@ -457,3 +460,3 @@ } | ||
if (typeof self.options.disableParallax !== 'function') { | ||
if ('function' !== typeof self.options.disableParallax) { | ||
self.options.disableParallax = function () { | ||
@@ -465,3 +468,3 @@ return false; | ||
if (typeof self.options.disableVideo === 'string') { | ||
if ('string' === typeof self.options.disableVideo) { | ||
self.options.disableVideo = new RegExp(self.options.disableVideo); | ||
@@ -478,3 +481,3 @@ } | ||
if (typeof self.options.disableVideo !== 'function') { | ||
if ('function' !== typeof self.options.disableVideo) { | ||
self.options.disableVideo = function () { | ||
@@ -488,3 +491,3 @@ return false; | ||
if (elementInVP && _typeof(elementInVP) === 'object' && typeof elementInVP.length !== 'undefined') { | ||
if (elementInVP && 'object' === _typeof(elementInVP) && 'undefined' !== typeof elementInVP.length) { | ||
var _elementInVP = elementInVP; | ||
@@ -517,2 +520,3 @@ | ||
} // add styles to element | ||
// eslint-disable-next-line class-methods-use-this | ||
@@ -523,4 +527,4 @@ | ||
value: function css(el, styles) { | ||
if (typeof styles === 'string') { | ||
return global__WEBPACK_IMPORTED_MODULE_2__["window"].getComputedStyle(el).getPropertyValue(styles); | ||
if ('string' === typeof styles) { | ||
return global__WEBPACK_IMPORTED_MODULE_1__["window"].getComputedStyle(el).getPropertyValue(styles); | ||
} // add transform property with vendor prefix | ||
@@ -538,2 +542,3 @@ | ||
} // Extend like jQuery.extend | ||
// eslint-disable-next-line class-methods-use-this | ||
@@ -543,11 +548,14 @@ }, { | ||
value: function extend(out) { | ||
var _arguments = arguments; | ||
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { | ||
args[_key - 1] = arguments[_key]; | ||
} | ||
out = out || {}; | ||
Object.keys(arguments).forEach(function (i) { | ||
if (!_arguments[i]) { | ||
Object.keys(args).forEach(function (i) { | ||
if (!args[i]) { | ||
return; | ||
} | ||
Object.keys(_arguments[i]).forEach(function (key) { | ||
out[key] = _arguments[i][key]; | ||
Object.keys(args[i]).forEach(function (key) { | ||
out[key] = args[i][key]; | ||
}); | ||
@@ -557,2 +565,3 @@ }); | ||
} // get window size and scroll position. Useful for extensions | ||
// eslint-disable-next-line class-methods-use-this | ||
@@ -563,3 +572,3 @@ }, { | ||
return { | ||
width: global__WEBPACK_IMPORTED_MODULE_2__["window"].innerWidth || document.documentElement.clientWidth, | ||
width: global__WEBPACK_IMPORTED_MODULE_1__["window"].innerWidth || document.documentElement.clientWidth, | ||
height: wndH, | ||
@@ -577,3 +586,3 @@ y: document.documentElement.scrollTop | ||
if ($imgElement && typeof $imgElement === 'string') { | ||
if ($imgElement && 'string' === typeof $imgElement) { | ||
$imgElement = self.$item.querySelector($imgElement); | ||
@@ -609,3 +618,3 @@ } // check if dom element | ||
if (self.image.src === null) { | ||
if (null === self.image.src) { | ||
self.image.src = 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7'; | ||
@@ -615,3 +624,3 @@ self.image.bgImage = self.css(self.$item, 'background-image'); | ||
return !(!self.image.bgImage || self.image.bgImage === 'none'); | ||
return !(!self.image.bgImage || 'none' === self.image.bgImage); | ||
} | ||
@@ -656,3 +665,3 @@ }, { | ||
if (self.css(self.$item, 'position') === 'static') { | ||
if ('static' === self.css(self.$item, 'position')) { | ||
self.css(self.$item, { | ||
@@ -663,3 +672,3 @@ position: 'relative' | ||
if (self.css(self.$item, 'z-index') === 'auto') { | ||
if ('auto' === self.css(self.$item, 'z-index')) { | ||
self.css(self.$item, { | ||
@@ -707,3 +716,3 @@ zIndex: 0 | ||
if (self.options.type === 'opacity' || self.options.type === 'scale' || self.options.type === 'scale-opacity' || self.options.speed === 1) { | ||
if ('opacity' === self.options.type || 'scale' === self.options.type || 'scale-opacity' === self.options.type || 1 === self.options.speed) { | ||
self.image.position = 'absolute'; | ||
@@ -715,8 +724,8 @@ } // 1. Check if one of parents have transform style (without this check, scroll transform will be inverted if used parallax with position fixed) | ||
if (self.image.position === 'fixed') { | ||
if ('fixed' === self.image.position) { | ||
var $parents = getParents(self.$item).filter(function (el) { | ||
var styles = global__WEBPACK_IMPORTED_MODULE_2__["window"].getComputedStyle(el); | ||
var styles = global__WEBPACK_IMPORTED_MODULE_1__["window"].getComputedStyle(el); | ||
var parentTransform = styles['-webkit-transform'] || styles['-moz-transform'] || styles.transform; | ||
var overflowRegex = /(auto|scroll)/; | ||
return parentTransform && parentTransform !== 'none' || overflowRegex.test(styles.overflow + styles['overflow-y'] + styles['overflow-x']); | ||
return parentTransform && 'none' !== parentTransform || overflowRegex.test(styles.overflow + styles['overflow-y'] + styles['overflow-x']); | ||
}); | ||
@@ -740,3 +749,3 @@ self.image.position = $parents.length ? 'absolute' : 'fixed'; | ||
if (self.css(self.$item, 'background-image') !== 'none') { | ||
if ('none' !== self.css(self.$item, 'background-image')) { | ||
self.css(self.$item, { | ||
@@ -757,4 +766,4 @@ 'background-image': 'none' | ||
if (jarallaxList.length === 1) { | ||
updateParallax(); | ||
if (1 === jarallaxList.length) { | ||
global__WEBPACK_IMPORTED_MODULE_1__["window"].requestAnimationFrame(updateParallax); | ||
} | ||
@@ -828,3 +837,3 @@ } // remove from parallax instances list | ||
// needed only when background in fixed position | ||
if (this.image.position !== 'fixed') { | ||
if ('fixed' !== this.image.position) { | ||
return; | ||
@@ -861,3 +870,3 @@ } | ||
var speed = self.options.speed; | ||
var isScroll = self.options.type === 'scroll' || self.options.type === 'scroll-opacity'; | ||
var isScroll = 'scroll' === self.options.type || 'scroll-opacity' === self.options.type; | ||
var scrollDist = 0; | ||
@@ -869,3 +878,3 @@ var resultH = contH; | ||
// scroll distance and height for image | ||
if (speed < 0) { | ||
if (0 > speed) { | ||
scrollDist = speed * Math.max(contH, wndH); | ||
@@ -881,5 +890,5 @@ | ||
if (speed > 1) { | ||
if (1 < speed) { | ||
resultH = Math.abs(scrollDist - wndH); | ||
} else if (speed < 0) { | ||
} else if (0 > speed) { | ||
resultH = scrollDist / speed + Math.abs(scrollDist); | ||
@@ -906,3 +915,3 @@ } else { | ||
marginTop: "".concat(resultMT, "px"), | ||
left: self.image.position === 'fixed' ? "".concat(rect.left, "px") : '0', | ||
left: 'fixed' === self.image.position ? "".concat(rect.left, "px") : '0', | ||
width: "".concat(rect.width, "px") | ||
@@ -944,3 +953,3 @@ }); // call onCoverImage event | ||
self.isElementInViewport = viewportRect.bottom >= 0 && viewportRect.right >= 0 && viewportRect.top <= wndH && viewportRect.left <= global__WEBPACK_IMPORTED_MODULE_2__["window"].innerWidth; // stop calculations if item is not in viewport | ||
self.isElementInViewport = 0 <= viewportRect.bottom && 0 <= viewportRect.right && viewportRect.top <= wndH && viewportRect.left <= global__WEBPACK_IMPORTED_MODULE_1__["window"].innerWidth; // stop calculations if item is not in viewport | ||
@@ -958,3 +967,3 @@ if (force ? false : !self.isElementInViewport) { | ||
var afterBottom = Math.max(0, -contT + wndH - contH); | ||
var fromViewportCenter = 1 - 2 * (wndH - contT) / (wndH + contH); // calculate on how percent of section is visible | ||
var fromViewportCenter = 1 - 2 * ((wndH - contT) / (wndH + contH)); // calculate on how percent of section is visible | ||
@@ -972,3 +981,3 @@ var visiblePercent = 1; | ||
if (self.options.type === 'opacity' || self.options.type === 'scale-opacity' || self.options.type === 'scroll-opacity') { | ||
if ('opacity' === self.options.type || 'scale-opacity' === self.options.type || 'scroll-opacity' === self.options.type) { | ||
styles.transform = 'translate3d(0,0,0)'; | ||
@@ -979,6 +988,6 @@ styles.opacity = visiblePercent; | ||
if (self.options.type === 'scale' || self.options.type === 'scale-opacity') { | ||
if ('scale' === self.options.type || 'scale-opacity' === self.options.type) { | ||
var scale = 1; | ||
if (self.options.speed < 0) { | ||
if (0 > self.options.speed) { | ||
scale -= self.options.speed * visiblePercent; | ||
@@ -993,6 +1002,6 @@ } else { | ||
if (self.options.type === 'scroll' || self.options.type === 'scroll-opacity') { | ||
if ('scroll' === self.options.type || 'scroll-opacity' === self.options.type) { | ||
var positionY = self.parallaxScrollDistance * fromViewportCenter; // fix if parallax block in absolute position | ||
if (self.image.position === 'absolute') { | ||
if ('absolute' === self.image.position) { | ||
positionY -= contT; | ||
@@ -1032,11 +1041,9 @@ } | ||
var plugin = function plugin(items) { | ||
var plugin = function plugin(items, options) { | ||
// check for dom element | ||
// thanks: http://stackoverflow.com/questions/384286/javascript-isdom-how-do-you-check-if-a-javascript-object-is-a-dom-object | ||
if ((typeof HTMLElement === "undefined" ? "undefined" : _typeof(HTMLElement)) === 'object' ? items instanceof HTMLElement : items && _typeof(items) === 'object' && items !== null && items.nodeType === 1 && typeof items.nodeName === 'string') { | ||
if ('object' === (typeof HTMLElement === "undefined" ? "undefined" : _typeof(HTMLElement)) ? items instanceof HTMLElement : items && 'object' === _typeof(items) && null !== items && 1 === items.nodeType && 'string' === typeof items.nodeName) { | ||
items = [items]; | ||
} | ||
var options = arguments[1]; | ||
var args = Array.prototype.slice.call(arguments, 2); | ||
var len = items.length; | ||
@@ -1046,4 +1053,8 @@ var k = 0; | ||
for (k; k < len; k++) { | ||
if (_typeof(options) === 'object' || typeof options === 'undefined') { | ||
for (var _len2 = arguments.length, args = new Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) { | ||
args[_key2 - 2] = arguments[_key2]; | ||
} | ||
for (k; k < len; k += 1) { | ||
if ('object' === _typeof(options) || 'undefined' === typeof options) { | ||
if (!items[k].jarallax) { | ||
@@ -1057,3 +1068,3 @@ items[k].jarallax = new Jarallax(items[k], options); | ||
if (typeof ret !== 'undefined') { | ||
if ('undefined' !== typeof ret) { | ||
return ret; | ||
@@ -1069,56 +1080,3 @@ } | ||
/***/ }), | ||
/* 14 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
var global = __webpack_require__(15); | ||
/** | ||
* `requestAnimationFrame()` | ||
*/ | ||
var request = global.requestAnimationFrame || global.webkitRequestAnimationFrame || global.mozRequestAnimationFrame || fallback; | ||
var prev = +new Date(); | ||
function fallback(fn) { | ||
var curr = +new Date(); | ||
var ms = Math.max(0, 16 - (curr - prev)); | ||
var req = setTimeout(fn, ms); | ||
return prev = curr, req; | ||
} | ||
/** | ||
* `cancelAnimationFrame()` | ||
*/ | ||
var cancel = global.cancelAnimationFrame || global.webkitCancelAnimationFrame || global.mozCancelAnimationFrame || clearTimeout; | ||
if (Function.prototype.bind) { | ||
request = request.bind(global); | ||
cancel = cancel.bind(global); | ||
} | ||
exports = module.exports = request; | ||
exports.cancel = cancel; | ||
/***/ }), | ||
/* 15 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
/* WEBPACK VAR INJECTION */(function(global) {var win; | ||
if (typeof window !== "undefined") { | ||
win = window; | ||
} else if (typeof global !== "undefined") { | ||
win = global; | ||
} else if (typeof self !== "undefined") { | ||
win = self; | ||
} else { | ||
win = {}; | ||
} | ||
module.exports = win; | ||
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(5))) | ||
/***/ }) | ||
/******/ ]); |
/*! | ||
* Name : Just Another Parallax [Jarallax] | ||
* Version : 1.12.0 | ||
* Version : 1.12.1 | ||
* Author : nK <https://nkdev.info> | ||
* GitHub : https://github.com/nk-o/jarallax | ||
*/!function(n){var o={};function i(e){if(o[e])return o[e].exports;var t=o[e]={i:e,l:!1,exports:{}};return n[e].call(t.exports,t,t.exports,i),t.l=!0,t.exports}i.m=n,i.c=o,i.d=function(e,t,n){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(t,e){if(1&e&&(t=i(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)i.d(n,o,function(e){return t[e]}.bind(null,o));return n},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="",i(i.s=11)}([,,function(e,t){e.exports=function(e){"complete"===document.readyState||"interactive"===document.readyState?e.call():document.attachEvent?document.attachEvent("onreadystatechange",function(){"interactive"===document.readyState&&e.call()}):document.addEventListener&&document.addEventListener("DOMContentLoaded",e)}},,function(n,e,t){(function(e){var t;t="undefined"!=typeof window?window:void 0!==e?e:"undefined"!=typeof self?self:{},n.exports=t}).call(this,t(5))},function(e,t){function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var o;o=function(){return this}();try{o=o||new Function("return this")()}catch(e){"object"===("undefined"==typeof window?"undefined":n(window))&&(o=window)}e.exports=o},,,,,,function(e,t,n){e.exports=n(12)},function(e,t,n){"use strict";n.r(t);var o=n(2),i=n.n(o),a=n(4),r=n(13);function l(e){return(l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var s=a.window.jarallax;if(a.window.jarallax=r.default,a.window.jarallax.noConflict=function(){return a.window.jarallax=s,this},void 0!==a.jQuery){var c=function(){var e=arguments||[];Array.prototype.unshift.call(e,this);var t=r.default.apply(a.window,e);return"object"!==l(t)?t:this};c.constructor=r.default.constructor;var u=a.jQuery.fn.jarallax;a.jQuery.fn.jarallax=c,a.jQuery.fn.jarallax.noConflict=function(){return a.jQuery.fn.jarallax=u,this}}i()(function(){Object(r.default)(document.querySelectorAll("[data-jarallax]"))})},function(e,t,n){"use strict";n.r(t);var o=n(2),i=n.n(o),a=n(14),r=n.n(a),b=n(4);function c(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],o=!0,i=!1,a=void 0;try{for(var r,l=e[Symbol.iterator]();!(o=(r=l.next()).done)&&(n.push(r.value),!t||n.length!==t);o=!0);}catch(e){i=!0,a=e}finally{try{o||null==l.return||l.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function u(e){return(u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function l(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}var s,v,m=-1<navigator.userAgent.indexOf("MSIE ")||-1<navigator.userAgent.indexOf("Trident/")||-1<navigator.userAgent.indexOf("Edge/"),p=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),d=function(){for(var e="transform WebkitTransform MozTransform".split(" "),t=document.createElement("div"),n=0;n<e.length;n++)if(t&&void 0!==t.style[e[n]])return e[n];return!1}();function f(){v=p?(!s&&document.body&&((s=document.createElement("div")).style.cssText="position: fixed; top: -9999px; left: 0; height: 100vh; width: 0;",document.body.appendChild(s)),(s?s.clientHeight:0)||b.window.innerHeight||document.documentElement.clientHeight):b.window.innerHeight||document.documentElement.clientHeight}f(),b.window.addEventListener("resize",f),b.window.addEventListener("orientationchange",f),b.window.addEventListener("load",f),i()(function(){f()});var g=[];function y(){g.length&&(g.forEach(function(e,t){var n=e.instance,o=e.oldData,i=n.$item.getBoundingClientRect(),a={width:i.width,height:i.height,top:i.top,bottom:i.bottom,wndW:b.window.innerWidth,wndH:v},r=!o||o.wndW!==a.wndW||o.wndH!==a.wndH||o.width!==a.width||o.height!==a.height,l=r||!o||o.top!==a.top||o.bottom!==a.bottom;g[t].oldData=a,r&&n.onResize(),l&&n.onScroll()}),r()(y))}function h(e,t){("object"===("undefined"==typeof HTMLElement?"undefined":u(HTMLElement))?e instanceof HTMLElement:e&&"object"===u(e)&&null!==e&&1===e.nodeType&&"string"==typeof e.nodeName)&&(e=[e]);for(var n,o=t,i=Array.prototype.slice.call(arguments,2),a=e.length,r=0;r<a;r++)if("object"===u(o)||void 0===o?e[r].jarallax||(e[r].jarallax=new w(e[r],o)):e[r].jarallax&&(n=e[r].jarallax[o].apply(e[r].jarallax,i)),void 0!==n)return n;return e}var x=0,w=function(){function s(e,t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,s);var n=this;n.instanceID=x++,n.$item=e,n.defaults={type:"scroll",speed:.5,imgSrc:null,imgElement:".jarallax-img",imgSize:"cover",imgPosition:"50% 50%",imgRepeat:"no-repeat",keepImg:!1,elementInViewport:null,zIndex:-100,disableParallax:!1,disableVideo:!1,videoSrc:null,videoStartTime:0,videoEndTime:0,videoVolume:0,videoLoop:!0,videoPlayOnlyVisible:!0,videoLazyLoading:!0,onScroll:null,onInit:null,onDestroy:null,onCoverImage:null};var o=n.$item.dataset||{},i={};if(Object.keys(o).forEach(function(e){var t=e.substr(0,1).toLowerCase()+e.substr(1);t&&void 0!==n.defaults[t]&&(i[t]=o[e])}),n.options=n.extend({},n.defaults,i,t),n.pureOptions=n.extend({},n.options),Object.keys(n.options).forEach(function(e){"true"===n.options[e]?n.options[e]=!0:"false"===n.options[e]&&(n.options[e]=!1)}),n.options.speed=Math.min(2,Math.max(-1,parseFloat(n.options.speed))),"string"==typeof n.options.disableParallax&&(n.options.disableParallax=new RegExp(n.options.disableParallax)),n.options.disableParallax instanceof RegExp){var a=n.options.disableParallax;n.options.disableParallax=function(){return a.test(navigator.userAgent)}}if("function"!=typeof n.options.disableParallax&&(n.options.disableParallax=function(){return!1}),"string"==typeof n.options.disableVideo&&(n.options.disableVideo=new RegExp(n.options.disableVideo)),n.options.disableVideo instanceof RegExp){var r=n.options.disableVideo;n.options.disableVideo=function(){return r.test(navigator.userAgent)}}"function"!=typeof n.options.disableVideo&&(n.options.disableVideo=function(){return!1});var l=n.options.elementInViewport;l&&"object"===u(l)&&void 0!==l.length&&(l=c(l,1)[0]);l instanceof Element||(l=null),n.options.elementInViewport=l,n.image={src:n.options.imgSrc||null,$container:null,useImgTag:!1,position:/iPad|iPhone|iPod|Android/.test(navigator.userAgent)?"absolute":"fixed"},n.initImg()&&n.canInitParallax()&&n.init()}return function(e,t,n){t&&l(e.prototype,t),n&&l(e,n)}(s,[{key:"css",value:function(t,n){return"string"==typeof n?b.window.getComputedStyle(t).getPropertyValue(n):(n.transform&&d&&(n[d]=n.transform),Object.keys(n).forEach(function(e){t.style[e]=n[e]}),t)}},{key:"extend",value:function(n){var o=arguments;return n=n||{},Object.keys(arguments).forEach(function(t){o[t]&&Object.keys(o[t]).forEach(function(e){n[e]=o[t][e]})}),n}},{key:"getWindowData",value:function(){return{width:b.window.innerWidth||document.documentElement.clientWidth,height:v,y:document.documentElement.scrollTop}}},{key:"initImg",value:function(){var e=this,t=e.options.imgElement;return t&&"string"==typeof t&&(t=e.$item.querySelector(t)),t instanceof Element||(e.options.imgSrc?(t=new Image).src=e.options.imgSrc:t=null),t&&(e.options.keepImg?e.image.$item=t.cloneNode(!0):(e.image.$item=t,e.image.$itemParent=t.parentNode),e.image.useImgTag=!0),!!e.image.$item||(null===e.image.src&&(e.image.src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",e.image.bgImage=e.css(e.$item,"background-image")),!(!e.image.bgImage||"none"===e.image.bgImage))}},{key:"canInitParallax",value:function(){return d&&!this.options.disableParallax()}},{key:"init",value:function(){var e=this,t={position:"absolute",top:0,left:0,width:"100%",height:"100%",overflow:"hidden",pointerEvents:"none"},n={};if(!e.options.keepImg){var o=e.$item.getAttribute("style");if(o&&e.$item.setAttribute("data-jarallax-original-styles",o),e.image.useImgTag){var i=e.image.$item.getAttribute("style");i&&e.image.$item.setAttribute("data-jarallax-original-styles",i)}}if("static"===e.css(e.$item,"position")&&e.css(e.$item,{position:"relative"}),"auto"===e.css(e.$item,"z-index")&&e.css(e.$item,{zIndex:0}),e.image.$container=document.createElement("div"),e.css(e.image.$container,t),e.css(e.image.$container,{"z-index":e.options.zIndex}),m&&e.css(e.image.$container,{opacity:.9999}),e.image.$container.setAttribute("id","jarallax-container-".concat(e.instanceID)),e.$item.appendChild(e.image.$container),e.image.useImgTag?n=e.extend({"object-fit":e.options.imgSize,"object-position":e.options.imgPosition,"font-family":"object-fit: ".concat(e.options.imgSize,"; object-position: ").concat(e.options.imgPosition,";"),"max-width":"none"},t,n):(e.image.$item=document.createElement("div"),e.image.src&&(n=e.extend({"background-position":e.options.imgPosition,"background-size":e.options.imgSize,"background-repeat":e.options.imgRepeat,"background-image":e.image.bgImage||'url("'.concat(e.image.src,'")')},t,n))),"opacity"!==e.options.type&&"scale"!==e.options.type&&"scale-opacity"!==e.options.type&&1!==e.options.speed||(e.image.position="absolute"),"fixed"===e.image.position){var a=function(e){for(var t=[];null!==e.parentElement;)1===(e=e.parentElement).nodeType&&t.push(e);return t}(e.$item).filter(function(e){var t=b.window.getComputedStyle(e),n=t["-webkit-transform"]||t["-moz-transform"]||t.transform;return n&&"none"!==n||/(auto|scroll)/.test(t.overflow+t["overflow-y"]+t["overflow-x"])});e.image.position=a.length?"absolute":"fixed"}n.position=e.image.position,e.css(e.image.$item,n),e.image.$container.appendChild(e.image.$item),e.onResize(),e.onScroll(!0),e.options.onInit&&e.options.onInit.call(e),"none"!==e.css(e.$item,"background-image")&&e.css(e.$item,{"background-image":"none"}),e.addToParallaxList()}},{key:"addToParallaxList",value:function(){g.push({instance:this}),1===g.length&&y()}},{key:"removeFromParallaxList",value:function(){var n=this;g.forEach(function(e,t){e.instance.instanceID===n.instanceID&&g.splice(t,1)})}},{key:"destroy",value:function(){var e=this;e.removeFromParallaxList();var t=e.$item.getAttribute("data-jarallax-original-styles");if(e.$item.removeAttribute("data-jarallax-original-styles"),t?e.$item.setAttribute("style",t):e.$item.removeAttribute("style"),e.image.useImgTag){var n=e.image.$item.getAttribute("data-jarallax-original-styles");e.image.$item.removeAttribute("data-jarallax-original-styles"),n?e.image.$item.setAttribute("style",t):e.image.$item.removeAttribute("style"),e.image.$itemParent&&e.image.$itemParent.appendChild(e.image.$item)}e.$clipStyles&&e.$clipStyles.parentNode.removeChild(e.$clipStyles),e.image.$container&&e.image.$container.parentNode.removeChild(e.image.$container),e.options.onDestroy&&e.options.onDestroy.call(e),delete e.$item.jarallax}},{key:"clipContainer",value:function(){if("fixed"===this.image.position){var e=this,t=e.image.$container.getBoundingClientRect(),n=t.width,o=t.height;if(!e.$clipStyles)e.$clipStyles=document.createElement("style"),e.$clipStyles.setAttribute("type","text/css"),e.$clipStyles.setAttribute("id","jarallax-clip-".concat(e.instanceID)),(document.head||document.getElementsByTagName("head")[0]).appendChild(e.$clipStyles);var i="#jarallax-container-".concat(e.instanceID," {\n clip: rect(0 ").concat(n,"px ").concat(o,"px 0);\n clip: rect(0, ").concat(n,"px, ").concat(o,"px, 0);\n }");e.$clipStyles.styleSheet?e.$clipStyles.styleSheet.cssText=i:e.$clipStyles.innerHTML=i}}},{key:"coverImage",value:function(){var e=this,t=e.image.$container.getBoundingClientRect(),n=t.height,o=e.options.speed,i="scroll"===e.options.type||"scroll-opacity"===e.options.type,a=0,r=n,l=0;return i&&(o<0?(a=o*Math.max(n,v),v<n&&(a-=o*(n-v))):a=o*(n+v),1<o?r=Math.abs(a-v):o<0?r=a/o+Math.abs(a):r+=(v-n)*(1-o),a/=2),e.parallaxScrollDistance=a,l=i?(v-r)/2:(n-r)/2,e.css(e.image.$item,{height:"".concat(r,"px"),marginTop:"".concat(l,"px"),left:"fixed"===e.image.position?"".concat(t.left,"px"):"0",width:"".concat(t.width,"px")}),e.options.onCoverImage&&e.options.onCoverImage.call(e),{image:{height:r,marginTop:l},container:t}}},{key:"isVisible",value:function(){return this.isElementInViewport||!1}},{key:"onScroll",value:function(e){var t=this,n=t.$item.getBoundingClientRect(),o=n.top,i=n.height,a={},r=n;if(t.options.elementInViewport&&(r=t.options.elementInViewport.getBoundingClientRect()),t.isElementInViewport=0<=r.bottom&&0<=r.right&&r.top<=v&&r.left<=b.window.innerWidth,e||t.isElementInViewport){var l=Math.max(0,o),s=Math.max(0,i+o),c=Math.max(0,-o),u=Math.max(0,o+i-v),m=Math.max(0,i-(o+i-v)),p=Math.max(0,-o+v-i),d=1-2*(v-o)/(v+i),f=1;if(i<v?f=1-(c||u)/i:s<=v?f=s/v:m<=v&&(f=m/v),"opacity"!==t.options.type&&"scale-opacity"!==t.options.type&&"scroll-opacity"!==t.options.type||(a.transform="translate3d(0,0,0)",a.opacity=f),"scale"===t.options.type||"scale-opacity"===t.options.type){var g=1;t.options.speed<0?g-=t.options.speed*f:g+=t.options.speed*(1-f),a.transform="scale(".concat(g,") translate3d(0,0,0)")}if("scroll"===t.options.type||"scroll-opacity"===t.options.type){var y=t.parallaxScrollDistance*d;"absolute"===t.image.position&&(y-=o),a.transform="translate3d(0,".concat(y,"px,0)")}t.css(t.image.$item,a),t.options.onScroll&&t.options.onScroll.call(t,{section:n,beforeTop:l,beforeTopEnd:s,afterTop:c,beforeBottom:u,beforeBottomEnd:m,afterBottom:p,visiblePercent:f,fromViewportCenter:d})}}},{key:"onResize",value:function(){this.coverImage(),this.clipContainer()}}]),s}();h.constructor=w,t.default=h},function(e,t,n){var o=n(15),i=o.requestAnimationFrame||o.webkitRequestAnimationFrame||o.mozRequestAnimationFrame||function(e){var t=+new Date,n=Math.max(0,16-(t-a)),o=setTimeout(e,n);return a=t,o},a=+new Date;var r=o.cancelAnimationFrame||o.webkitCancelAnimationFrame||o.mozCancelAnimationFrame||clearTimeout;Function.prototype.bind&&(i=i.bind(o),r=r.bind(o)),(e.exports=i).cancel=r},function(n,e,t){(function(e){var t;t="undefined"!=typeof window?window:void 0!==e?e:"undefined"!=typeof self?self:{},n.exports=t}).call(this,t(5))}]); | ||
*/!function(n){var o={};function i(e){if(o[e])return o[e].exports;var t=o[e]={i:e,l:!1,exports:{}};return n[e].call(t.exports,t,t.exports,i),t.l=!0,t.exports}i.m=n,i.c=o,i.d=function(e,t,n){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(t,e){if(1&e&&(t=i(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)i.d(n,o,function(e){return t[e]}.bind(null,o));return n},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="",i(i.s=10)}([,,function(e,t){e.exports=function(e){"complete"===document.readyState||"interactive"===document.readyState?e.call():document.attachEvent?document.attachEvent("onreadystatechange",function(){"interactive"===document.readyState&&e.call()}):document.addEventListener&&document.addEventListener("DOMContentLoaded",e)}},function(n,e,t){(function(e){var t;t="undefined"!=typeof window?window:void 0!==e?e:"undefined"!=typeof self?self:{},n.exports=t}).call(this,t(4))},function(e,t){function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var o;o=function(){return this}();try{o=o||new Function("return this")()}catch(e){"object"===("undefined"==typeof window?"undefined":n(window))&&(o=window)}e.exports=o},,,,,,function(e,t,n){e.exports=n(11)},function(e,t,n){"use strict";n.r(t);var o=n(2),i=n.n(o),a=n(3),r=n(12);function l(e){return(l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var s=a.window.jarallax;if(a.window.jarallax=r.default,a.window.jarallax.noConflict=function(){return a.window.jarallax=s,this},void 0!==a.jQuery){var c=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];Array.prototype.unshift.call(t,this);var o=r.default.apply(a.window,t);return"object"!==l(o)?o:this};c.constructor=r.default.constructor;var u=a.jQuery.fn.jarallax;a.jQuery.fn.jarallax=c,a.jQuery.fn.jarallax.noConflict=function(){return a.jQuery.fn.jarallax=u,this}}i()(function(){Object(r.default)(document.querySelectorAll("[data-jarallax]"))})},function(e,t,n){"use strict";n.r(t);var o=n(2),i=n.n(o),b=n(3);function c(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],o=!0,i=!1,a=void 0;try{for(var r,l=e[Symbol.iterator]();!(o=(r=l.next()).done)&&(n.push(r.value),!t||n.length!==t);o=!0);}catch(e){i=!0,a=e}finally{try{o||null==l.return||l.return()}finally{if(i)throw a}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return a(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return a(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function u(e){return(u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function r(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}var l,h,d=b.window.navigator,p=-1<d.userAgent.indexOf("MSIE ")||-1<d.userAgent.indexOf("Trident/")||-1<d.userAgent.indexOf("Edge/"),s=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(d.userAgent),m=function(){for(var e="transform WebkitTransform MozTransform".split(" "),t=document.createElement("div"),n=0;n<e.length;n+=1)if(t&&void 0!==t.style[e[n]])return e[n];return!1}();function f(){h=s?(!l&&document.body&&((l=document.createElement("div")).style.cssText="position: fixed; top: -9999px; left: 0; height: 100vh; width: 0;",document.body.appendChild(l)),(l?l.clientHeight:0)||b.window.innerHeight||document.documentElement.clientHeight):b.window.innerHeight||document.documentElement.clientHeight}f(),b.window.addEventListener("resize",f),b.window.addEventListener("orientationchange",f),b.window.addEventListener("load",f),i()(function(){f()});var g=[];function y(){g.length&&(g.forEach(function(e,t){var n=e.instance,o=e.oldData,i=n.$item.getBoundingClientRect(),a={width:i.width,height:i.height,top:i.top,bottom:i.bottom,wndW:b.window.innerWidth,wndH:h},r=!o||o.wndW!==a.wndW||o.wndH!==a.wndH||o.width!==a.width||o.height!==a.height,l=r||!o||o.top!==a.top||o.bottom!==a.bottom;g[t].oldData=a,r&&n.onResize(),l&&n.onScroll()}),b.window.requestAnimationFrame(y))}function v(e,t){("object"===("undefined"==typeof HTMLElement?"undefined":u(HTMLElement))?e instanceof HTMLElement:e&&"object"===u(e)&&null!==e&&1===e.nodeType&&"string"==typeof e.nodeName)&&(e=[e]);for(var n,o=e.length,i=0,a=arguments.length,r=new Array(2<a?a-2:0),l=2;l<a;l++)r[l-2]=arguments[l];for(;i<o;i+=1)if("object"===u(t)||void 0===t?e[i].jarallax||(e[i].jarallax=new w(e[i],t)):e[i].jarallax&&(n=e[i].jarallax[t].apply(e[i].jarallax,r)),void 0!==n)return n;return e}var x=0,w=function(){function s(e,t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,s);var n=this;n.instanceID=x,x+=1,n.$item=e,n.defaults={type:"scroll",speed:.5,imgSrc:null,imgElement:".jarallax-img",imgSize:"cover",imgPosition:"50% 50%",imgRepeat:"no-repeat",keepImg:!1,elementInViewport:null,zIndex:-100,disableParallax:!1,disableVideo:!1,videoSrc:null,videoStartTime:0,videoEndTime:0,videoVolume:0,videoLoop:!0,videoPlayOnlyVisible:!0,videoLazyLoading:!0,onScroll:null,onInit:null,onDestroy:null,onCoverImage:null};var o=n.$item.dataset||{},i={};if(Object.keys(o).forEach(function(e){var t=e.substr(0,1).toLowerCase()+e.substr(1);t&&void 0!==n.defaults[t]&&(i[t]=o[e])}),n.options=n.extend({},n.defaults,i,t),n.pureOptions=n.extend({},n.options),Object.keys(n.options).forEach(function(e){"true"===n.options[e]?n.options[e]=!0:"false"===n.options[e]&&(n.options[e]=!1)}),n.options.speed=Math.min(2,Math.max(-1,parseFloat(n.options.speed))),"string"==typeof n.options.disableParallax&&(n.options.disableParallax=new RegExp(n.options.disableParallax)),n.options.disableParallax instanceof RegExp){var a=n.options.disableParallax;n.options.disableParallax=function(){return a.test(d.userAgent)}}if("function"!=typeof n.options.disableParallax&&(n.options.disableParallax=function(){return!1}),"string"==typeof n.options.disableVideo&&(n.options.disableVideo=new RegExp(n.options.disableVideo)),n.options.disableVideo instanceof RegExp){var r=n.options.disableVideo;n.options.disableVideo=function(){return r.test(d.userAgent)}}"function"!=typeof n.options.disableVideo&&(n.options.disableVideo=function(){return!1});var l=n.options.elementInViewport;l&&"object"===u(l)&&void 0!==l.length&&(l=c(l,1)[0]);l instanceof Element||(l=null),n.options.elementInViewport=l,n.image={src:n.options.imgSrc||null,$container:null,useImgTag:!1,position:/iPad|iPhone|iPod|Android/.test(d.userAgent)?"absolute":"fixed"},n.initImg()&&n.canInitParallax()&&n.init()}var e,t,n;return e=s,(t=[{key:"css",value:function(t,n){return"string"==typeof n?b.window.getComputedStyle(t).getPropertyValue(n):(n.transform&&m&&(n[m]=n.transform),Object.keys(n).forEach(function(e){t.style[e]=n[e]}),t)}},{key:"extend",value:function(n){for(var e=arguments.length,o=new Array(1<e?e-1:0),t=1;t<e;t++)o[t-1]=arguments[t];return n=n||{},Object.keys(o).forEach(function(t){o[t]&&Object.keys(o[t]).forEach(function(e){n[e]=o[t][e]})}),n}},{key:"getWindowData",value:function(){return{width:b.window.innerWidth||document.documentElement.clientWidth,height:h,y:document.documentElement.scrollTop}}},{key:"initImg",value:function(){var e=this,t=e.options.imgElement;return t&&"string"==typeof t&&(t=e.$item.querySelector(t)),t instanceof Element||(e.options.imgSrc?(t=new Image).src=e.options.imgSrc:t=null),t&&(e.options.keepImg?e.image.$item=t.cloneNode(!0):(e.image.$item=t,e.image.$itemParent=t.parentNode),e.image.useImgTag=!0),!!e.image.$item||(null===e.image.src&&(e.image.src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",e.image.bgImage=e.css(e.$item,"background-image")),!(!e.image.bgImage||"none"===e.image.bgImage))}},{key:"canInitParallax",value:function(){return m&&!this.options.disableParallax()}},{key:"init",value:function(){var e=this,t={position:"absolute",top:0,left:0,width:"100%",height:"100%",overflow:"hidden",pointerEvents:"none"},n={};if(!e.options.keepImg){var o=e.$item.getAttribute("style");if(o&&e.$item.setAttribute("data-jarallax-original-styles",o),e.image.useImgTag){var i=e.image.$item.getAttribute("style");i&&e.image.$item.setAttribute("data-jarallax-original-styles",i)}}if("static"===e.css(e.$item,"position")&&e.css(e.$item,{position:"relative"}),"auto"===e.css(e.$item,"z-index")&&e.css(e.$item,{zIndex:0}),e.image.$container=document.createElement("div"),e.css(e.image.$container,t),e.css(e.image.$container,{"z-index":e.options.zIndex}),p&&e.css(e.image.$container,{opacity:.9999}),e.image.$container.setAttribute("id","jarallax-container-".concat(e.instanceID)),e.$item.appendChild(e.image.$container),e.image.useImgTag?n=e.extend({"object-fit":e.options.imgSize,"object-position":e.options.imgPosition,"font-family":"object-fit: ".concat(e.options.imgSize,"; object-position: ").concat(e.options.imgPosition,";"),"max-width":"none"},t,n):(e.image.$item=document.createElement("div"),e.image.src&&(n=e.extend({"background-position":e.options.imgPosition,"background-size":e.options.imgSize,"background-repeat":e.options.imgRepeat,"background-image":e.image.bgImage||'url("'.concat(e.image.src,'")')},t,n))),"opacity"!==e.options.type&&"scale"!==e.options.type&&"scale-opacity"!==e.options.type&&1!==e.options.speed||(e.image.position="absolute"),"fixed"===e.image.position){var a=function(e){for(var t=[];null!==e.parentElement;)1===(e=e.parentElement).nodeType&&t.push(e);return t}(e.$item).filter(function(e){var t=b.window.getComputedStyle(e),n=t["-webkit-transform"]||t["-moz-transform"]||t.transform;return n&&"none"!==n||/(auto|scroll)/.test(t.overflow+t["overflow-y"]+t["overflow-x"])});e.image.position=a.length?"absolute":"fixed"}n.position=e.image.position,e.css(e.image.$item,n),e.image.$container.appendChild(e.image.$item),e.onResize(),e.onScroll(!0),e.options.onInit&&e.options.onInit.call(e),"none"!==e.css(e.$item,"background-image")&&e.css(e.$item,{"background-image":"none"}),e.addToParallaxList()}},{key:"addToParallaxList",value:function(){g.push({instance:this}),1===g.length&&b.window.requestAnimationFrame(y)}},{key:"removeFromParallaxList",value:function(){var n=this;g.forEach(function(e,t){e.instance.instanceID===n.instanceID&&g.splice(t,1)})}},{key:"destroy",value:function(){var e=this;e.removeFromParallaxList();var t=e.$item.getAttribute("data-jarallax-original-styles");if(e.$item.removeAttribute("data-jarallax-original-styles"),t?e.$item.setAttribute("style",t):e.$item.removeAttribute("style"),e.image.useImgTag){var n=e.image.$item.getAttribute("data-jarallax-original-styles");e.image.$item.removeAttribute("data-jarallax-original-styles"),n?e.image.$item.setAttribute("style",t):e.image.$item.removeAttribute("style"),e.image.$itemParent&&e.image.$itemParent.appendChild(e.image.$item)}e.$clipStyles&&e.$clipStyles.parentNode.removeChild(e.$clipStyles),e.image.$container&&e.image.$container.parentNode.removeChild(e.image.$container),e.options.onDestroy&&e.options.onDestroy.call(e),delete e.$item.jarallax}},{key:"clipContainer",value:function(){if("fixed"===this.image.position){var e=this,t=e.image.$container.getBoundingClientRect(),n=t.width,o=t.height;if(!e.$clipStyles)e.$clipStyles=document.createElement("style"),e.$clipStyles.setAttribute("type","text/css"),e.$clipStyles.setAttribute("id","jarallax-clip-".concat(e.instanceID)),(document.head||document.getElementsByTagName("head")[0]).appendChild(e.$clipStyles);var i="#jarallax-container-".concat(e.instanceID," {\n clip: rect(0 ").concat(n,"px ").concat(o,"px 0);\n clip: rect(0, ").concat(n,"px, ").concat(o,"px, 0);\n }");e.$clipStyles.styleSheet?e.$clipStyles.styleSheet.cssText=i:e.$clipStyles.innerHTML=i}}},{key:"coverImage",value:function(){var e=this,t=e.image.$container.getBoundingClientRect(),n=t.height,o=e.options.speed,i="scroll"===e.options.type||"scroll-opacity"===e.options.type,a=0,r=n,l=0;return i&&(o<0?(a=o*Math.max(n,h),h<n&&(a-=o*(n-h))):a=o*(n+h),1<o?r=Math.abs(a-h):o<0?r=a/o+Math.abs(a):r+=(h-n)*(1-o),a/=2),e.parallaxScrollDistance=a,l=i?(h-r)/2:(n-r)/2,e.css(e.image.$item,{height:"".concat(r,"px"),marginTop:"".concat(l,"px"),left:"fixed"===e.image.position?"".concat(t.left,"px"):"0",width:"".concat(t.width,"px")}),e.options.onCoverImage&&e.options.onCoverImage.call(e),{image:{height:r,marginTop:l},container:t}}},{key:"isVisible",value:function(){return this.isElementInViewport||!1}},{key:"onScroll",value:function(e){var t=this,n=t.$item.getBoundingClientRect(),o=n.top,i=n.height,a={},r=n;if(t.options.elementInViewport&&(r=t.options.elementInViewport.getBoundingClientRect()),t.isElementInViewport=0<=r.bottom&&0<=r.right&&r.top<=h&&r.left<=b.window.innerWidth,e||t.isElementInViewport){var l=Math.max(0,o),s=Math.max(0,i+o),c=Math.max(0,-o),u=Math.max(0,o+i-h),d=Math.max(0,i-(o+i-h)),p=Math.max(0,-o+h-i),m=1-(h-o)/(h+i)*2,f=1;if(i<h?f=1-(c||u)/i:s<=h?f=s/h:d<=h&&(f=d/h),"opacity"!==t.options.type&&"scale-opacity"!==t.options.type&&"scroll-opacity"!==t.options.type||(a.transform="translate3d(0,0,0)",a.opacity=f),"scale"===t.options.type||"scale-opacity"===t.options.type){var g=1;t.options.speed<0?g-=t.options.speed*f:g+=t.options.speed*(1-f),a.transform="scale(".concat(g,") translate3d(0,0,0)")}if("scroll"===t.options.type||"scroll-opacity"===t.options.type){var y=t.parallaxScrollDistance*m;"absolute"===t.image.position&&(y-=o),a.transform="translate3d(0,".concat(y,"px,0)")}t.css(t.image.$item,a),t.options.onScroll&&t.options.onScroll.call(t,{section:n,beforeTop:l,beforeTopEnd:s,afterTop:c,beforeBottom:u,beforeBottomEnd:d,afterBottom:p,visiblePercent:f,fromViewportCenter:m})}}},{key:"onResize",value:function(){this.coverImage(),this.clipContainer()}}])&&r(e.prototype,t),n&&r(e,n),s}();v.constructor=w,t.default=v}]); | ||
//# sourceMappingURL=jarallax.min.js.map |
10
index.js
@@ -1,4 +0,4 @@ | ||
const jarallax = require('./src/jarallax.esm').default; | ||
const jarallaxVideo = require('./src/jarallax-video.esm').default; | ||
const jarallaxElement = require('./src/jarallax-element.esm').default; | ||
const jarallax = require( './src/jarallax.esm' ).default; | ||
const jarallaxVideo = require( './src/jarallax-video.esm' ).default; | ||
const jarallaxElement = require( './src/jarallax-element.esm' ).default; | ||
@@ -8,7 +8,7 @@ module.exports = { | ||
jarallaxElement() { | ||
return jarallaxElement(jarallax); | ||
return jarallaxElement( jarallax ); | ||
}, | ||
jarallaxVideo() { | ||
return jarallaxVideo(jarallax); | ||
return jarallaxVideo( jarallax ); | ||
}, | ||
}; |
{ | ||
"name": "jarallax", | ||
"version": "1.12.0", | ||
"version": "1.12.1", | ||
"description": "Smooth parallax scrolling effect for background images, videos and inline elements. Code in pure JavaScript with NO dependencies + jQuery supported. Youtube, Vimeo and Local Videos parallax supported.", | ||
@@ -21,7 +21,2 @@ "license": "MIT", | ||
}, | ||
"husky": { | ||
"hooks": { | ||
"pre-commit": "npm run js-lint" | ||
} | ||
}, | ||
"repository": { | ||
@@ -43,31 +38,29 @@ "type": "git", | ||
"devDependencies": { | ||
"@babel/core": "^7.6.2", | ||
"@babel/plugin-proposal-class-properties": "^7.5.5", | ||
"@babel/plugin-proposal-object-rest-spread": "^7.6.2", | ||
"@babel/plugin-transform-async-to-generator": "^7.5.0", | ||
"@babel/plugin-transform-block-scoping": "^7.6.3", | ||
"@babel/preset-env": "^7.6.2", | ||
"@babel/register": "^7.6.2", | ||
"@types/jquery": "^3.3.31", | ||
"babel-loader": "^8.0.6", | ||
"@babel/core": "^7.9.0", | ||
"@babel/plugin-proposal-class-properties": "^7.8.3", | ||
"@babel/plugin-proposal-object-rest-spread": "^7.9.5", | ||
"@babel/plugin-transform-async-to-generator": "^7.8.3", | ||
"@babel/plugin-transform-block-scoping": "^7.8.3", | ||
"@babel/preset-env": "^7.9.5", | ||
"@babel/register": "^7.9.0", | ||
"@types/jquery": "^3.3.36", | ||
"babel-loader": "^8.1.0", | ||
"browser-sync": "^2.26.7", | ||
"del": "^5.1.0", | ||
"eslint": "^6.5.1", | ||
"eslint-config-airbnb": "^18.0.1", | ||
"eslint-plugin-import": "^2.18.2", | ||
"eslint-plugin-jsx-a11y": "^6.2.3", | ||
"eslint-plugin-react": "^7.16.0", | ||
"eslint-config-nk": "^0.0.17", | ||
"gulp": "^4.0.2", | ||
"gulp-header": "^2.0.9", | ||
"gulp-if": "^3.0.0", | ||
"gulp-load-plugins": "^2.0.1", | ||
"gulp-load-plugins": "^2.0.3", | ||
"gulp-plumber": "^1.2.1", | ||
"gulp-rename": "^1.4.0", | ||
"gulp-rename": "^2.0.0", | ||
"gulp-sourcemaps": "^2.6.5", | ||
"gulp-uglify": "^3.0.2", | ||
"gulp-watch": "^5.0.1", | ||
"husky": "^3.0.9", | ||
"jquery": "^3.4.1", | ||
"husky": "^3.1.0", | ||
"jquery": "^3.5.0", | ||
"json-file": "^0.1.0", | ||
"node-qunit-phantomjs": "^2.0.1", | ||
"lint-staged": "^10.1.7", | ||
"micromatch": "^4.0.2", | ||
"node-qunit-phantomjs": "^2.1.1", | ||
"object-fit-images": "^3.2.4", | ||
@@ -81,5 +74,4 @@ "qunitjs": "^2.4.1", | ||
"lite-ready": "^1.0.4", | ||
"rafl": "^1.2.2", | ||
"video-worker": "^1.1.6" | ||
"video-worker": "^1.1.8" | ||
} | ||
} |
## Just Another Parallax | ||
Smooth parallax scrolling effect for background images, videos and inline elements. Code in pure JavaScript with ***NO dependencies*** + jQuery supported. ***YouTube***, ***Vimeo*** and ***Local Videos*** parallax supported. | ||
Smooth parallax scrolling effect for background images, videos. Code in pure JavaScript with ***NO dependencies*** + jQuery supported. ***YouTube***, ***Vimeo*** and ***Self-Hosted Videos*** parallax supported. | ||
@@ -19,3 +19,2 @@ ## [Demo](https://free.nkdev.info/jarallax/) | ||
jarallax-video.min.js | ![jarallax-video.min.js](https://img.badgesize.io/nk-o/jarallax/master/dist/jarallax-video.min.js?compression=gzip) | ||
jarallax-element.min.js | ![jarallax-element.min.js](https://img.badgesize.io/nk-o/jarallax/master/dist/jarallax-element.min.js?compression=gzip) | ||
@@ -45,3 +44,2 @@ ## Usage with WordPress | ||
jarallax, | ||
jarallaxElement, | ||
jarallaxVideo | ||
@@ -51,3 +49,2 @@ } from 'jarallax'; | ||
jarallaxVideo(); | ||
jarallaxElement(); | ||
``` | ||
@@ -65,5 +62,2 @@ | ||
<script src="jarallax/dist/jarallax-video.min.js"></script> | ||
<!-- Include it if you want to parallax any element --> | ||
<script src="jarallax/dist/jarallax-element.min.js"></script> | ||
``` | ||
@@ -77,9 +71,6 @@ | ||
<!-- Jarallax --> | ||
<script src="https://unpkg.com/jarallax@1.10/dist/jarallax.min.js"></script> | ||
<script src="https://unpkg.com/jarallax@1/dist/jarallax.min.js"></script> | ||
<!-- Include it if you want to use Video parallax --> | ||
<script src="https://unpkg.com/jarallax@1.10/dist/jarallax-video.min.js"></script> | ||
<!-- Include it if you want to parallax any element --> | ||
<script src="https://unpkg.com/jarallax@1.10/dist/jarallax-element.min.js"></script> | ||
<script src="https://unpkg.com/jarallax@1/dist/jarallax-video.min.js"></script> | ||
``` | ||
@@ -186,3 +177,3 @@ | ||
<!-- Background Local Video Parallax --> | ||
<!-- Background Self-Hosted Video Parallax --> | ||
<div class="jarallax" data-jarallax-video="mp4:./video/local-video.mp4,webm:./video/local-video.webm,ogv:./video/local-video.ogv"> | ||
@@ -193,3 +184,3 @@ Your content here... | ||
Note: for local videos required only 1 video type, not necessary use all mp4, webm and ogv. This need only for maximum compatibility with all browsers. | ||
Note: for self-hosted videos required 1 video type only, not necessarily use all mp4, webm and ogv. This needs only for maximum compatibility with all browsers. | ||
@@ -212,18 +203,6 @@ ### B. JavaScript way | ||
## Any Element Parallax Usage Examples | ||
## Elements Parallax Usage Examples | ||
```html | ||
<!-- Element will be parallaxed on -140 pixels from the screen center by Y axis --> | ||
<div data-jarallax-element="-140"> | ||
Your content here... | ||
</div> | ||
Since v1.9.0 there was an extension to allow transform specific elements. This feature is still available, but DEPRECATED. We recommend you to use `laxxx` library <https://github.com/alexfoxy/laxxx>. It is much more powerful and has a less code (in cases when you don't want to add parallax backgrounds). | ||
<!-- Element will be parallaxed on 250 pixels from the screen center by Y axis and on -100 pixels from the screen center by X axis --> | ||
<div data-jarallax-element="250 -100"> | ||
Your content here... | ||
</div> | ||
``` | ||
Note: this is more like experimental feature, so the behavior could be changed in the future releases. | ||
## Options | ||
@@ -280,3 +259,3 @@ | ||
:--- | :--- | :------ | :---------- | ||
videoSrc | string | `null` | You can use Youtube, Vimeo or local videos. Also you can use data attribute `data-jarallax-video`. | ||
videoSrc | string | `null` | You can use Youtube, Vimeo or Self-Hosted videos. Also you can use data attribute `data-jarallax-video`. | ||
videoStartTime | float | `0` | Start time in seconds when video will be started (this value will be applied also after loop). | ||
@@ -416,2 +395,2 @@ videoEndTime | float | `0` | End time in seconds when video will be ended. | ||
Images <https://unsplash.com/> | ||
Local Video <https://videos.pexels.com/> | ||
Videos <https://videos.pexels.com/> |
/* eslint no-case-declarations: "off" */ | ||
import global from 'global'; | ||
export default function jarallaxElement(jarallax = global.jarallax) { | ||
if (typeof jarallax === 'undefined') { | ||
export default function jarallaxElement( jarallax = global.jarallax ) { | ||
if ( 'undefined' === typeof jarallax ) { | ||
return; | ||
@@ -22,35 +22,34 @@ } | ||
'onResize', | ||
].forEach((key) => { | ||
const def = Jarallax.prototype[key]; | ||
Jarallax.prototype[key] = function () { | ||
].forEach( ( key ) => { | ||
const def = Jarallax.prototype[ key ]; | ||
Jarallax.prototype[ key ] = function( ...args ) { | ||
const self = this; | ||
const args = arguments || []; | ||
if (key === 'initImg' && self.$item.getAttribute('data-jarallax-element') !== null) { | ||
if ( 'initImg' === key && null !== self.$item.getAttribute( 'data-jarallax-element' ) ) { | ||
self.options.type = 'element'; | ||
self.pureOptions.speed = self.$item.getAttribute('data-jarallax-element') || self.pureOptions.speed; | ||
self.pureOptions.speed = self.$item.getAttribute( 'data-jarallax-element' ) || self.pureOptions.speed; | ||
} | ||
if (self.options.type !== 'element') { | ||
return def.apply(self, args); | ||
if ( 'element' !== self.options.type ) { | ||
return def.apply( self, args ); | ||
} | ||
self.pureOptions.threshold = self.$item.getAttribute('data-threshold') || ''; | ||
self.pureOptions.threshold = self.$item.getAttribute( 'data-threshold' ) || ''; | ||
switch (key) { | ||
switch ( key ) { | ||
case 'init': | ||
const speedArr = self.pureOptions.speed.split(' '); | ||
const speedArr = self.pureOptions.speed.split( ' ' ); | ||
self.options.speed = self.pureOptions.speed || 0; | ||
self.options.speedY = speedArr[0] ? parseFloat(speedArr[0]) : 0; | ||
self.options.speedX = speedArr[1] ? parseFloat(speedArr[1]) : 0; | ||
self.options.speedY = speedArr[ 0 ] ? parseFloat( speedArr[ 0 ] ) : 0; | ||
self.options.speedX = speedArr[ 1 ] ? parseFloat( speedArr[ 1 ] ) : 0; | ||
const thresholdArr = self.pureOptions.threshold.split(' '); | ||
self.options.thresholdY = thresholdArr[0] ? parseFloat(thresholdArr[0]) : null; | ||
self.options.thresholdX = thresholdArr[1] ? parseFloat(thresholdArr[1]) : null; | ||
const thresholdArr = self.pureOptions.threshold.split( ' ' ); | ||
self.options.thresholdY = thresholdArr[ 0 ] ? parseFloat( thresholdArr[ 0 ] ) : null; | ||
self.options.thresholdX = thresholdArr[ 1 ] ? parseFloat( thresholdArr[ 1 ] ) : null; | ||
def.apply(self, args); | ||
def.apply( self, args ); | ||
// restore background image if available. | ||
const originalStylesTag = self.$item.getAttribute('data-jarallax-original-styles'); | ||
if (originalStylesTag) { | ||
self.$item.setAttribute('style', originalStylesTag); | ||
const originalStylesTag = self.$item.getAttribute( 'data-jarallax-original-styles' ); | ||
if ( originalStylesTag ) { | ||
self.$item.setAttribute( 'style', originalStylesTag ); | ||
} | ||
@@ -60,4 +59,4 @@ | ||
case 'onResize': | ||
const defTransform = self.css(self.$item, 'transform'); | ||
self.css(self.$item, { transform: '' }); | ||
const defTransform = self.css( self.$item, 'transform' ); | ||
self.css( self.$item, { transform: '' } ); | ||
const rect = self.$item.getBoundingClientRect(); | ||
@@ -70,7 +69,7 @@ self.itemData = { | ||
}; | ||
self.css(self.$item, { transform: defTransform }); | ||
self.css( self.$item, { transform: defTransform } ); | ||
break; | ||
case 'onScroll': | ||
const wnd = self.getWindowData(); | ||
const centerPercent = (wnd.y + wnd.height / 2 - self.itemData.y - self.itemData.height / 2) / (wnd.height / 2); | ||
const centerPercent = ( wnd.y + wnd.height / 2 - self.itemData.y - self.itemData.height / 2 ) / ( wnd.height / 2 ); | ||
const moveY = centerPercent * self.options.speedY; | ||
@@ -80,5 +79,5 @@ const moveX = centerPercent * self.options.speedX; | ||
let mx = moveX; | ||
if (self.options.thresholdY !== null && moveY > self.options.thresholdY) my = 0; | ||
if (self.options.thresholdX !== null && moveX > self.options.thresholdX) mx = 0; | ||
self.css(self.$item, { transform: `translate3d(${mx}px,${my}px,0)` }); | ||
if ( null !== self.options.thresholdY && moveY > self.options.thresholdY ) my = 0; | ||
if ( null !== self.options.thresholdX && moveX > self.options.thresholdX ) mx = 0; | ||
self.css( self.$item, { transform: `translate3d(${ mx }px,${ my }px,0)` } ); | ||
break; | ||
@@ -92,5 +91,5 @@ case 'initImg': | ||
} | ||
return def.apply(self, args); | ||
return def.apply( self, args ); | ||
}; | ||
}); | ||
} ); | ||
} |
import domReady from 'lite-ready'; | ||
import global from 'global'; | ||
import jarallaxElement from './jarallax-element.esm'; | ||
@@ -7,6 +9,6 @@ | ||
// data-jarallax-element initialization | ||
domReady(() => { | ||
if (typeof jarallax !== 'undefined') { | ||
jarallax(document.querySelectorAll('[data-jarallax-element]')); | ||
domReady( () => { | ||
if ( 'undefined' !== typeof global.jarallax ) { | ||
global.jarallax( document.querySelectorAll( '[data-jarallax-element]' ) ); | ||
} | ||
}); | ||
} ); |
import VideoWorker from 'video-worker'; | ||
import global from 'global'; | ||
export default function jarallaxVideo(jarallax = global.jarallax) { | ||
if (typeof jarallax === 'undefined') { | ||
export default function jarallaxVideo( jarallax = global.jarallax ) { | ||
if ( 'undefined' === typeof jarallax ) { | ||
return; | ||
@@ -13,18 +13,18 @@ } | ||
const defOnScroll = Jarallax.prototype.onScroll; | ||
Jarallax.prototype.onScroll = function () { | ||
Jarallax.prototype.onScroll = function() { | ||
const self = this; | ||
defOnScroll.apply(self); | ||
defOnScroll.apply( self ); | ||
const isReady = !self.isVideoInserted | ||
const isReady = ! self.isVideoInserted | ||
&& self.video | ||
&& (!self.options.videoLazyLoading || self.isElementInViewport) | ||
&& !self.options.disableVideo(); | ||
&& ( ! self.options.videoLazyLoading || self.isElementInViewport ) | ||
&& ! self.options.disableVideo(); | ||
if (isReady) { | ||
if ( isReady ) { | ||
self.isVideoInserted = true; | ||
self.video.getVideo((video) => { | ||
self.video.getVideo( ( video ) => { | ||
const $parent = video.parentNode; | ||
self.css(video, { | ||
self.css( video, { | ||
position: self.image.position, | ||
@@ -41,9 +41,20 @@ top: '0px', | ||
zIndex: -1, | ||
}); | ||
} ); | ||
self.$video = video; | ||
self.image.$container.appendChild(video); | ||
// add Poster attribute to self-hosted video | ||
if ( 'local' === self.video.type ) { | ||
if ( self.image.src ) { | ||
self.$video.setAttribute( 'poster', self.image.src ); | ||
} else if ( self.image.$item && 'IMG' === self.image.$item.tagName && self.image.$item.src ) { | ||
self.$video.setAttribute( 'poster', self.image.$item.src ); | ||
} | ||
} | ||
// insert video tag | ||
self.image.$container.appendChild( video ); | ||
// remove parent video element (created by VideoWorker) | ||
$parent.parentNode.removeChild($parent); | ||
}); | ||
$parent.parentNode.removeChild( $parent ); | ||
} ); | ||
} | ||
@@ -54,22 +65,22 @@ }; | ||
const defCoverImage = Jarallax.prototype.coverImage; | ||
Jarallax.prototype.coverImage = function () { | ||
Jarallax.prototype.coverImage = function() { | ||
const self = this; | ||
const imageData = defCoverImage.apply(self); | ||
const imageData = defCoverImage.apply( self ); | ||
const node = self.image.$item ? self.image.$item.nodeName : false; | ||
if (imageData && self.video && node && (node === 'IFRAME' || node === 'VIDEO')) { | ||
if ( imageData && self.video && node && ( 'IFRAME' === node || 'VIDEO' === node ) ) { | ||
let h = imageData.image.height; | ||
let w = h * self.image.width / self.image.height; | ||
let ml = (imageData.container.width - w) / 2; | ||
let w = ( h * self.image.width ) / self.image.height; | ||
let ml = ( imageData.container.width - w ) / 2; | ||
let mt = imageData.image.marginTop; | ||
if (imageData.container.width > w) { | ||
if ( imageData.container.width > w ) { | ||
w = imageData.container.width; | ||
h = w * self.image.height / self.image.width; | ||
h = ( w * self.image.height ) / self.image.width; | ||
ml = 0; | ||
mt += (imageData.image.height - h) / 2; | ||
mt += ( imageData.image.height - h ) / 2; | ||
} | ||
// add video height over than need to hide controls | ||
if (node === 'IFRAME') { | ||
if ( 'IFRAME' === node ) { | ||
h += 400; | ||
@@ -79,8 +90,8 @@ mt -= 200; | ||
self.css(self.$video, { | ||
width: `${w}px`, | ||
marginLeft: `${ml}px`, | ||
height: `${h}px`, | ||
marginTop: `${mt}px`, | ||
}); | ||
self.css( self.$video, { | ||
width: `${ w }px`, | ||
marginLeft: `${ ml }px`, | ||
height: `${ h }px`, | ||
marginTop: `${ mt }px`, | ||
} ); | ||
} | ||
@@ -93,11 +104,11 @@ | ||
const defInitImg = Jarallax.prototype.initImg; | ||
Jarallax.prototype.initImg = function () { | ||
Jarallax.prototype.initImg = function() { | ||
const self = this; | ||
const defaultResult = defInitImg.apply(self); | ||
const defaultResult = defInitImg.apply( self ); | ||
if (!self.options.videoSrc) { | ||
self.options.videoSrc = self.$item.getAttribute('data-jarallax-video') || null; | ||
if ( ! self.options.videoSrc ) { | ||
self.options.videoSrc = self.$item.getAttribute( 'data-jarallax-video' ) || null; | ||
} | ||
if (self.options.videoSrc) { | ||
if ( self.options.videoSrc ) { | ||
self.defaultInitImgResult = defaultResult; | ||
@@ -111,11 +122,12 @@ return true; | ||
const defCanInitParallax = Jarallax.prototype.canInitParallax; | ||
Jarallax.prototype.canInitParallax = function () { | ||
Jarallax.prototype.canInitParallax = function() { | ||
const self = this; | ||
const defaultResult = defCanInitParallax.apply(self); | ||
let defaultResult = defCanInitParallax.apply( self ); | ||
if (!self.options.videoSrc) { | ||
if ( ! self.options.videoSrc ) { | ||
return defaultResult; | ||
} | ||
const video = new VideoWorker(self.options.videoSrc, { | ||
// Init video api | ||
const video = new VideoWorker( self.options.videoSrc, { | ||
autoplay: true, | ||
@@ -128,22 +140,44 @@ loop: self.options.videoLoop, | ||
volume: self.options.videoVolume || 0, | ||
}); | ||
} ); | ||
if (video.isValid()) { | ||
function resetDefaultImage() { | ||
if ( self.image.$default_item ) { | ||
self.image.$item = self.image.$default_item; | ||
self.image.$item.style.display = 'block'; | ||
// set image width and height | ||
self.coverImage(); | ||
self.clipContainer(); | ||
self.onScroll(); | ||
} | ||
} | ||
if ( video.isValid() ) { | ||
// Force enable parallax. | ||
// When the parallax disabled on mobile devices, we still need to display videos. | ||
// https://github.com/nk-o/jarallax/issues/159 | ||
if ( this.options.disableParallax() ) { | ||
defaultResult = true; | ||
self.image.position = 'absolute'; | ||
self.options.type = 'scroll'; | ||
self.options.speed = 1; | ||
} | ||
// if parallax will not be inited, we can add thumbnail on background. | ||
if (!defaultResult) { | ||
if (!self.defaultInitImgResult) { | ||
video.getImageURL((url) => { | ||
if ( ! defaultResult ) { | ||
if ( ! self.defaultInitImgResult ) { | ||
video.getImageURL( ( url ) => { | ||
// save default user styles | ||
const curStyle = self.$item.getAttribute('style'); | ||
if (curStyle) { | ||
self.$item.setAttribute('data-jarallax-original-styles', curStyle); | ||
const curStyle = self.$item.getAttribute( 'style' ); | ||
if ( curStyle ) { | ||
self.$item.setAttribute( 'data-jarallax-original-styles', curStyle ); | ||
} | ||
// set new background | ||
self.css(self.$item, { | ||
'background-image': `url("${url}")`, | ||
self.css( self.$item, { | ||
'background-image': `url("${ url }")`, | ||
'background-position': 'center', | ||
'background-size': 'cover', | ||
}); | ||
}); | ||
} ); | ||
} ); | ||
} | ||
@@ -153,9 +187,9 @@ | ||
} else { | ||
video.on('ready', () => { | ||
if (self.options.videoPlayOnlyVisible) { | ||
video.on( 'ready', () => { | ||
if ( self.options.videoPlayOnlyVisible ) { | ||
const oldOnScroll = self.onScroll; | ||
self.onScroll = function () { | ||
oldOnScroll.apply(self); | ||
if (self.options.videoLoop || (!self.options.videoLoop && !self.videoEnded)) { | ||
if (self.isVisible()) { | ||
self.onScroll = function() { | ||
oldOnScroll.apply( self ); | ||
if ( ! self.videoError && ( self.options.videoLoop || ( ! self.options.videoLoop && ! self.videoEnded ) ) ) { | ||
if ( self.isVisible() ) { | ||
video.play(); | ||
@@ -170,4 +204,4 @@ } else { | ||
} | ||
}); | ||
video.on('started', () => { | ||
} ); | ||
video.on( 'started', () => { | ||
self.image.$default_item = self.image.$item; | ||
@@ -184,23 +218,19 @@ self.image.$item = self.$video; | ||
// hide image | ||
if (self.image.$default_item) { | ||
if ( self.image.$default_item ) { | ||
self.image.$default_item.style.display = 'none'; | ||
} | ||
}); | ||
} ); | ||
video.on('ended', () => { | ||
video.on( 'ended', () => { | ||
self.videoEnded = true; | ||
if (!self.options.videoLoop) { | ||
// show image if Loop disabled | ||
if (self.image.$default_item) { | ||
self.image.$item = self.image.$default_item; | ||
self.image.$item.style.display = 'block'; | ||
// show default image if Loop disabled. | ||
resetDefaultImage(); | ||
} ); | ||
video.on( 'error', () => { | ||
self.videoError = true; | ||
// set image width and height | ||
self.coverImage(); | ||
self.clipContainer(); | ||
self.onScroll(); | ||
} | ||
} | ||
}); | ||
// show default image if video loading error. | ||
resetDefaultImage(); | ||
} ); | ||
@@ -210,16 +240,14 @@ self.video = video; | ||
// set image if not exists | ||
if (!self.defaultInitImgResult) { | ||
// set empty image on local video if not defined | ||
if ( ! self.defaultInitImgResult ) { | ||
// set empty image on self-hosted video if not defined | ||
self.image.src = 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7'; | ||
if (video.type !== 'local') { | ||
video.getImageURL((url) => { | ||
self.image.bgImage = `url("${url}")`; | ||
if ( 'local' !== video.type ) { | ||
video.getImageURL( ( url ) => { | ||
self.image.bgImage = `url("${ url }")`; | ||
self.init(); | ||
}); | ||
} ); | ||
return false; | ||
} | ||
return true; | ||
} | ||
@@ -234,6 +262,6 @@ } | ||
const defDestroy = Jarallax.prototype.destroy; | ||
Jarallax.prototype.destroy = function () { | ||
Jarallax.prototype.destroy = function() { | ||
const self = this; | ||
if (self.image.$default_item) { | ||
if ( self.image.$default_item ) { | ||
self.image.$item = self.image.$default_item; | ||
@@ -243,4 +271,4 @@ delete self.image.$default_item; | ||
defDestroy.apply(self); | ||
defDestroy.apply( self ); | ||
}; | ||
} |
import VideoWorker from 'video-worker'; | ||
import global from 'global'; | ||
import domReady from 'lite-ready'; | ||
import jarallaxVideo from './jarallax-video.esm'; | ||
@@ -12,6 +13,6 @@ | ||
// data-jarallax-video initialization | ||
domReady(() => { | ||
if (typeof jarallax !== 'undefined') { | ||
jarallax(document.querySelectorAll('[data-jarallax-video]')); | ||
domReady( () => { | ||
if ( 'undefined' !== typeof global.jarallax ) { | ||
global.jarallax( document.querySelectorAll( '[data-jarallax-video]' ) ); | ||
} | ||
}); | ||
} ); |
import domReady from 'lite-ready'; | ||
import raf from 'rafl'; | ||
import { window } from 'global'; | ||
const isIE = navigator.userAgent.indexOf('MSIE ') > -1 || navigator.userAgent.indexOf('Trident/') > -1 || navigator.userAgent.indexOf('Edge/') > -1; | ||
const isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent); | ||
const { | ||
navigator, | ||
} = window; | ||
const supportTransform = (() => { | ||
const prefixes = 'transform WebkitTransform MozTransform'.split(' '); | ||
const div = document.createElement('div'); | ||
for (let i = 0; i < prefixes.length; i++) { | ||
if (div && div.style[prefixes[i]] !== undefined) { | ||
return prefixes[i]; | ||
const isIE = -1 < navigator.userAgent.indexOf( 'MSIE ' ) || -1 < navigator.userAgent.indexOf( 'Trident/' ) || -1 < navigator.userAgent.indexOf( 'Edge/' ); | ||
const isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test( navigator.userAgent ); | ||
const supportTransform = ( () => { | ||
const prefixes = 'transform WebkitTransform MozTransform'.split( ' ' ); | ||
const div = document.createElement( 'div' ); | ||
for ( let i = 0; i < prefixes.length; i += 1 ) { | ||
if ( div && div.style[ prefixes[ i ] ] !== undefined ) { | ||
return prefixes[ i ]; | ||
} | ||
} | ||
return false; | ||
})(); | ||
} )(); | ||
@@ -26,9 +29,9 @@ let $deviceHelper; | ||
function getDeviceHeight() { | ||
if (!$deviceHelper && document.body) { | ||
$deviceHelper = document.createElement('div'); | ||
if ( ! $deviceHelper && document.body ) { | ||
$deviceHelper = document.createElement( 'div' ); | ||
$deviceHelper.style.cssText = 'position: fixed; top: -9999px; left: 0; height: 100vh; width: 0;'; | ||
document.body.appendChild($deviceHelper); | ||
document.body.appendChild( $deviceHelper ); | ||
} | ||
return ($deviceHelper ? $deviceHelper.clientHeight : 0) || window.innerHeight || document.documentElement.clientHeight; | ||
return ( $deviceHelper ? $deviceHelper.clientHeight : 0 ) || window.innerHeight || document.documentElement.clientHeight; | ||
} | ||
@@ -39,3 +42,3 @@ | ||
function updateWndVars() { | ||
if (isMobile) { | ||
if ( isMobile ) { | ||
wndH = getDeviceHeight(); | ||
@@ -47,10 +50,10 @@ } else { | ||
updateWndVars(); | ||
window.addEventListener('resize', updateWndVars); | ||
window.addEventListener('orientationchange', updateWndVars); | ||
window.addEventListener('load', updateWndVars); | ||
domReady(() => { | ||
updateWndVars({ | ||
window.addEventListener( 'resize', updateWndVars ); | ||
window.addEventListener( 'orientationchange', updateWndVars ); | ||
window.addEventListener( 'load', updateWndVars ); | ||
domReady( () => { | ||
updateWndVars( { | ||
type: 'dom-loaded', | ||
}); | ||
}); | ||
} ); | ||
} ); | ||
@@ -62,10 +65,10 @@ // list with all jarallax instances | ||
// get all parents of the element. | ||
function getParents(elem) { | ||
function getParents( elem ) { | ||
const parents = []; | ||
while (elem.parentElement !== null) { | ||
while ( null !== elem.parentElement ) { | ||
elem = elem.parentElement; | ||
if (elem.nodeType === 1) { | ||
parents.push(elem); | ||
if ( 1 === elem.nodeType ) { | ||
parents.push( elem ); | ||
} | ||
@@ -78,7 +81,7 @@ } | ||
function updateParallax() { | ||
if (!jarallaxList.length) { | ||
if ( ! jarallaxList.length ) { | ||
return; | ||
} | ||
jarallaxList.forEach((data, k) => { | ||
jarallaxList.forEach( ( data, k ) => { | ||
const { | ||
@@ -100,3 +103,3 @@ instance, | ||
const isResized = !oldData | ||
const isResized = ! oldData | ||
|| oldData.wndW !== newData.wndW | ||
@@ -107,17 +110,17 @@ || oldData.wndH !== newData.wndH | ||
const isScrolled = isResized | ||
|| !oldData | ||
|| ! oldData | ||
|| oldData.top !== newData.top | ||
|| oldData.bottom !== newData.bottom; | ||
jarallaxList[k].oldData = newData; | ||
jarallaxList[ k ].oldData = newData; | ||
if (isResized) { | ||
if ( isResized ) { | ||
instance.onResize(); | ||
} | ||
if (isScrolled) { | ||
if ( isScrolled ) { | ||
instance.onScroll(); | ||
} | ||
}); | ||
} ); | ||
raf(updateParallax); | ||
window.requestAnimationFrame( updateParallax ); | ||
} | ||
@@ -129,6 +132,7 @@ | ||
class Jarallax { | ||
constructor(item, userOptions) { | ||
constructor( item, userOptions ) { | ||
const self = this; | ||
self.instanceID = instanceID++; | ||
self.instanceID = instanceID; | ||
instanceID += 1; | ||
@@ -170,33 +174,33 @@ self.$item = item; | ||
const pureDataOptions = {}; | ||
Object.keys(dataOptions).forEach((key) => { | ||
const loweCaseOption = key.substr(0, 1).toLowerCase() + key.substr(1); | ||
if (loweCaseOption && typeof self.defaults[loweCaseOption] !== 'undefined') { | ||
pureDataOptions[loweCaseOption] = dataOptions[key]; | ||
Object.keys( dataOptions ).forEach( ( key ) => { | ||
const loweCaseOption = key.substr( 0, 1 ).toLowerCase() + key.substr( 1 ); | ||
if ( loweCaseOption && 'undefined' !== typeof self.defaults[ loweCaseOption ] ) { | ||
pureDataOptions[ loweCaseOption ] = dataOptions[ key ]; | ||
} | ||
}); | ||
} ); | ||
self.options = self.extend({}, self.defaults, pureDataOptions, userOptions); | ||
self.pureOptions = self.extend({}, self.options); | ||
self.options = self.extend( {}, self.defaults, pureDataOptions, userOptions ); | ||
self.pureOptions = self.extend( {}, self.options ); | ||
// prepare 'true' and 'false' strings to boolean | ||
Object.keys(self.options).forEach((key) => { | ||
if (self.options[key] === 'true') { | ||
self.options[key] = true; | ||
} else if (self.options[key] === 'false') { | ||
self.options[key] = false; | ||
Object.keys( self.options ).forEach( ( key ) => { | ||
if ( 'true' === self.options[ key ] ) { | ||
self.options[ key ] = true; | ||
} else if ( 'false' === self.options[ key ] ) { | ||
self.options[ key ] = false; | ||
} | ||
}); | ||
} ); | ||
// fix speed option [-1.0, 2.0] | ||
self.options.speed = Math.min(2, Math.max(-1, parseFloat(self.options.speed))); | ||
self.options.speed = Math.min( 2, Math.max( -1, parseFloat( self.options.speed ) ) ); | ||
// prepare disableParallax callback | ||
if (typeof self.options.disableParallax === 'string') { | ||
self.options.disableParallax = new RegExp(self.options.disableParallax); | ||
if ( 'string' === typeof self.options.disableParallax ) { | ||
self.options.disableParallax = new RegExp( self.options.disableParallax ); | ||
} | ||
if (self.options.disableParallax instanceof RegExp) { | ||
if ( self.options.disableParallax instanceof RegExp ) { | ||
const disableParallaxRegexp = self.options.disableParallax; | ||
self.options.disableParallax = () => disableParallaxRegexp.test(navigator.userAgent); | ||
self.options.disableParallax = () => disableParallaxRegexp.test( navigator.userAgent ); | ||
} | ||
if (typeof self.options.disableParallax !== 'function') { | ||
if ( 'function' !== typeof self.options.disableParallax ) { | ||
self.options.disableParallax = () => false; | ||
@@ -206,10 +210,10 @@ } | ||
// prepare disableVideo callback | ||
if (typeof self.options.disableVideo === 'string') { | ||
self.options.disableVideo = new RegExp(self.options.disableVideo); | ||
if ( 'string' === typeof self.options.disableVideo ) { | ||
self.options.disableVideo = new RegExp( self.options.disableVideo ); | ||
} | ||
if (self.options.disableVideo instanceof RegExp) { | ||
if ( self.options.disableVideo instanceof RegExp ) { | ||
const disableVideoRegexp = self.options.disableVideo; | ||
self.options.disableVideo = () => disableVideoRegexp.test(navigator.userAgent); | ||
self.options.disableVideo = () => disableVideoRegexp.test( navigator.userAgent ); | ||
} | ||
if (typeof self.options.disableVideo !== 'function') { | ||
if ( 'function' !== typeof self.options.disableVideo ) { | ||
self.options.disableVideo = () => false; | ||
@@ -221,7 +225,7 @@ } | ||
// get first item from array | ||
if (elementInVP && typeof elementInVP === 'object' && typeof elementInVP.length !== 'undefined') { | ||
[elementInVP] = elementInVP; | ||
if ( elementInVP && 'object' === typeof elementInVP && 'undefined' !== typeof elementInVP.length ) { | ||
[ elementInVP ] = elementInVP; | ||
} | ||
// check if dom element | ||
if (!(elementInVP instanceof Element)) { | ||
if ( ! ( elementInVP instanceof Element ) ) { | ||
elementInVP = null; | ||
@@ -239,6 +243,6 @@ } | ||
// on mobile devices better scrolled with absolute position | ||
position: /iPad|iPhone|iPod|Android/.test(navigator.userAgent) ? 'absolute' : 'fixed', | ||
position: /iPad|iPhone|iPod|Android/.test( navigator.userAgent ) ? 'absolute' : 'fixed', | ||
}; | ||
if (self.initImg() && self.canInitParallax()) { | ||
if ( self.initImg() && self.canInitParallax() ) { | ||
self.init(); | ||
@@ -249,15 +253,16 @@ } | ||
// add styles to element | ||
css(el, styles) { | ||
if (typeof styles === 'string') { | ||
return window.getComputedStyle(el).getPropertyValue(styles); | ||
// eslint-disable-next-line class-methods-use-this | ||
css( el, styles ) { | ||
if ( 'string' === typeof styles ) { | ||
return window.getComputedStyle( el ).getPropertyValue( styles ); | ||
} | ||
// add transform property with vendor prefix | ||
if (styles.transform && supportTransform) { | ||
styles[supportTransform] = styles.transform; | ||
if ( styles.transform && supportTransform ) { | ||
styles[ supportTransform ] = styles.transform; | ||
} | ||
Object.keys(styles).forEach((key) => { | ||
el.style[key] = styles[key]; | ||
}); | ||
Object.keys( styles ).forEach( ( key ) => { | ||
el.style[ key ] = styles[ key ]; | ||
} ); | ||
return el; | ||
@@ -267,12 +272,15 @@ } | ||
// Extend like jQuery.extend | ||
extend(out) { | ||
// eslint-disable-next-line class-methods-use-this | ||
extend( out, ...args ) { | ||
out = out || {}; | ||
Object.keys(arguments).forEach((i) => { | ||
if (!arguments[i]) { | ||
Object.keys( args ).forEach( ( i ) => { | ||
if ( ! args[ i ] ) { | ||
return; | ||
} | ||
Object.keys(arguments[i]).forEach((key) => { | ||
out[key] = arguments[i][key]; | ||
}); | ||
}); | ||
Object.keys( args[ i ] ).forEach( ( key ) => { | ||
out[ key ] = args[ i ][ key ]; | ||
} ); | ||
} ); | ||
return out; | ||
@@ -282,2 +290,3 @@ } | ||
// get window size and scroll position. Useful for extensions | ||
// eslint-disable-next-line class-methods-use-this | ||
getWindowData() { | ||
@@ -297,9 +306,9 @@ return { | ||
let $imgElement = self.options.imgElement; | ||
if ($imgElement && typeof $imgElement === 'string') { | ||
$imgElement = self.$item.querySelector($imgElement); | ||
if ( $imgElement && 'string' === typeof $imgElement ) { | ||
$imgElement = self.$item.querySelector( $imgElement ); | ||
} | ||
// check if dom element | ||
if (!($imgElement instanceof Element)) { | ||
if (self.options.imgSrc) { | ||
if ( ! ( $imgElement instanceof Element ) ) { | ||
if ( self.options.imgSrc ) { | ||
$imgElement = new Image(); | ||
@@ -312,5 +321,5 @@ $imgElement.src = self.options.imgSrc; | ||
if ($imgElement) { | ||
if (self.options.keepImg) { | ||
self.image.$item = $imgElement.cloneNode(true); | ||
if ( $imgElement ) { | ||
if ( self.options.keepImg ) { | ||
self.image.$item = $imgElement.cloneNode( true ); | ||
} else { | ||
@@ -324,3 +333,3 @@ self.image.$item = $imgElement; | ||
// true if there is img tag | ||
if (self.image.$item) { | ||
if ( self.image.$item ) { | ||
return true; | ||
@@ -330,11 +339,11 @@ } | ||
// get image src | ||
if (self.image.src === null) { | ||
if ( null === self.image.src ) { | ||
self.image.src = 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7'; | ||
self.image.bgImage = self.css(self.$item, 'background-image'); | ||
self.image.bgImage = self.css( self.$item, 'background-image' ); | ||
} | ||
return !(!self.image.bgImage || self.image.bgImage === 'none'); | ||
return ! ( ! self.image.bgImage || 'none' === self.image.bgImage ); | ||
} | ||
canInitParallax() { | ||
return supportTransform && !this.options.disableParallax(); | ||
return supportTransform && ! this.options.disableParallax(); | ||
} | ||
@@ -355,12 +364,12 @@ | ||
if (!self.options.keepImg) { | ||
if ( ! self.options.keepImg ) { | ||
// save default user styles | ||
const curStyle = self.$item.getAttribute('style'); | ||
if (curStyle) { | ||
self.$item.setAttribute('data-jarallax-original-styles', curStyle); | ||
const curStyle = self.$item.getAttribute( 'style' ); | ||
if ( curStyle ) { | ||
self.$item.setAttribute( 'data-jarallax-original-styles', curStyle ); | ||
} | ||
if (self.image.useImgTag) { | ||
const curImgStyle = self.image.$item.getAttribute('style'); | ||
if (curImgStyle) { | ||
self.image.$item.setAttribute('data-jarallax-original-styles', curImgStyle); | ||
if ( self.image.useImgTag ) { | ||
const curImgStyle = self.image.$item.getAttribute( 'style' ); | ||
if ( curImgStyle ) { | ||
self.image.$item.setAttribute( 'data-jarallax-original-styles', curImgStyle ); | ||
} | ||
@@ -371,54 +380,54 @@ } | ||
// set relative position and z-index to the parent | ||
if (self.css(self.$item, 'position') === 'static') { | ||
self.css(self.$item, { | ||
if ( 'static' === self.css( self.$item, 'position' ) ) { | ||
self.css( self.$item, { | ||
position: 'relative', | ||
}); | ||
} ); | ||
} | ||
if (self.css(self.$item, 'z-index') === 'auto') { | ||
self.css(self.$item, { | ||
if ( 'auto' === self.css( self.$item, 'z-index' ) ) { | ||
self.css( self.$item, { | ||
zIndex: 0, | ||
}); | ||
} ); | ||
} | ||
// container for parallax image | ||
self.image.$container = document.createElement('div'); | ||
self.css(self.image.$container, containerStyles); | ||
self.css(self.image.$container, { | ||
self.image.$container = document.createElement( 'div' ); | ||
self.css( self.image.$container, containerStyles ); | ||
self.css( self.image.$container, { | ||
'z-index': self.options.zIndex, | ||
}); | ||
} ); | ||
// fix for IE https://github.com/nk-o/jarallax/issues/110 | ||
if (isIE) { | ||
self.css(self.image.$container, { | ||
if ( isIE ) { | ||
self.css( self.image.$container, { | ||
opacity: 0.9999, | ||
}); | ||
} ); | ||
} | ||
self.image.$container.setAttribute('id', `jarallax-container-${self.instanceID}`); | ||
self.$item.appendChild(self.image.$container); | ||
self.image.$container.setAttribute( 'id', `jarallax-container-${ self.instanceID }` ); | ||
self.$item.appendChild( self.image.$container ); | ||
// use img tag | ||
if (self.image.useImgTag) { | ||
imageStyles = self.extend({ | ||
if ( self.image.useImgTag ) { | ||
imageStyles = self.extend( { | ||
'object-fit': self.options.imgSize, | ||
'object-position': self.options.imgPosition, | ||
// support for plugin https://github.com/bfred-it/object-fit-images | ||
'font-family': `object-fit: ${self.options.imgSize}; object-position: ${self.options.imgPosition};`, | ||
'font-family': `object-fit: ${ self.options.imgSize }; object-position: ${ self.options.imgPosition };`, | ||
'max-width': 'none', | ||
}, containerStyles, imageStyles); | ||
}, containerStyles, imageStyles ); | ||
// use div with background image | ||
} else { | ||
self.image.$item = document.createElement('div'); | ||
if (self.image.src) { | ||
imageStyles = self.extend({ | ||
self.image.$item = document.createElement( 'div' ); | ||
if ( self.image.src ) { | ||
imageStyles = self.extend( { | ||
'background-position': self.options.imgPosition, | ||
'background-size': self.options.imgSize, | ||
'background-repeat': self.options.imgRepeat, | ||
'background-image': self.image.bgImage || `url("${self.image.src}")`, | ||
}, containerStyles, imageStyles); | ||
'background-image': self.image.bgImage || `url("${ self.image.src }")`, | ||
}, containerStyles, imageStyles ); | ||
} | ||
} | ||
if (self.options.type === 'opacity' || self.options.type === 'scale' || self.options.type === 'scale-opacity' || self.options.speed === 1) { | ||
if ( 'opacity' === self.options.type || 'scale' === self.options.type || 'scale-opacity' === self.options.type || 1 === self.options.speed ) { | ||
self.image.position = 'absolute'; | ||
@@ -430,10 +439,10 @@ } | ||
// 2. Check if parents have overflow scroll | ||
if (self.image.position === 'fixed') { | ||
const $parents = getParents(self.$item).filter((el) => { | ||
const styles = window.getComputedStyle(el); | ||
const parentTransform = styles['-webkit-transform'] || styles['-moz-transform'] || styles.transform; | ||
if ( 'fixed' === self.image.position ) { | ||
const $parents = getParents( self.$item ).filter( ( el ) => { | ||
const styles = window.getComputedStyle( el ); | ||
const parentTransform = styles[ '-webkit-transform' ] || styles[ '-moz-transform' ] || styles.transform; | ||
const overflowRegex = /(auto|scroll)/; | ||
return (parentTransform && parentTransform !== 'none') || overflowRegex.test(styles.overflow + styles['overflow-y'] + styles['overflow-x']); | ||
}); | ||
return ( parentTransform && 'none' !== parentTransform ) || overflowRegex.test( styles.overflow + styles[ 'overflow-y' ] + styles[ 'overflow-x' ] ); | ||
} ); | ||
@@ -447,19 +456,19 @@ self.image.position = $parents.length ? 'absolute' : 'fixed'; | ||
// insert parallax image | ||
self.css(self.image.$item, imageStyles); | ||
self.image.$container.appendChild(self.image.$item); | ||
self.css( self.image.$item, imageStyles ); | ||
self.image.$container.appendChild( self.image.$item ); | ||
// set initial position and size | ||
self.onResize(); | ||
self.onScroll(true); | ||
self.onScroll( true ); | ||
// call onInit event | ||
if (self.options.onInit) { | ||
self.options.onInit.call(self); | ||
if ( self.options.onInit ) { | ||
self.options.onInit.call( self ); | ||
} | ||
// remove default user background | ||
if (self.css(self.$item, 'background-image') !== 'none') { | ||
self.css(self.$item, { | ||
if ( 'none' !== self.css( self.$item, 'background-image' ) ) { | ||
self.css( self.$item, { | ||
'background-image': 'none', | ||
}); | ||
} ); | ||
} | ||
@@ -472,8 +481,8 @@ | ||
addToParallaxList() { | ||
jarallaxList.push({ | ||
jarallaxList.push( { | ||
instance: this, | ||
}); | ||
} ); | ||
if (jarallaxList.length === 1) { | ||
updateParallax(); | ||
if ( 1 === jarallaxList.length ) { | ||
window.requestAnimationFrame( updateParallax ); | ||
} | ||
@@ -486,7 +495,7 @@ } | ||
jarallaxList.forEach((data, key) => { | ||
if (data.instance.instanceID === self.instanceID) { | ||
jarallaxList.splice(key, 1); | ||
jarallaxList.forEach( ( data, key ) => { | ||
if ( data.instance.instanceID === self.instanceID ) { | ||
jarallaxList.splice( key, 1 ); | ||
} | ||
}); | ||
} ); | ||
} | ||
@@ -500,25 +509,25 @@ | ||
// return styles on container as before jarallax init | ||
const originalStylesTag = self.$item.getAttribute('data-jarallax-original-styles'); | ||
self.$item.removeAttribute('data-jarallax-original-styles'); | ||
const originalStylesTag = self.$item.getAttribute( 'data-jarallax-original-styles' ); | ||
self.$item.removeAttribute( 'data-jarallax-original-styles' ); | ||
// null occurs if there is no style tag before jarallax init | ||
if (!originalStylesTag) { | ||
self.$item.removeAttribute('style'); | ||
if ( ! originalStylesTag ) { | ||
self.$item.removeAttribute( 'style' ); | ||
} else { | ||
self.$item.setAttribute('style', originalStylesTag); | ||
self.$item.setAttribute( 'style', originalStylesTag ); | ||
} | ||
if (self.image.useImgTag) { | ||
if ( self.image.useImgTag ) { | ||
// return styles on img tag as before jarallax init | ||
const originalStylesImgTag = self.image.$item.getAttribute('data-jarallax-original-styles'); | ||
self.image.$item.removeAttribute('data-jarallax-original-styles'); | ||
const originalStylesImgTag = self.image.$item.getAttribute( 'data-jarallax-original-styles' ); | ||
self.image.$item.removeAttribute( 'data-jarallax-original-styles' ); | ||
// null occurs if there is no style tag before jarallax init | ||
if (!originalStylesImgTag) { | ||
self.image.$item.removeAttribute('style'); | ||
if ( ! originalStylesImgTag ) { | ||
self.image.$item.removeAttribute( 'style' ); | ||
} else { | ||
self.image.$item.setAttribute('style', originalStylesTag); | ||
self.image.$item.setAttribute( 'style', originalStylesTag ); | ||
} | ||
// move img tag to its default position | ||
if (self.image.$itemParent) { | ||
self.image.$itemParent.appendChild(self.image.$item); | ||
if ( self.image.$itemParent ) { | ||
self.image.$itemParent.appendChild( self.image.$item ); | ||
} | ||
@@ -528,12 +537,12 @@ } | ||
// remove additional dom elements | ||
if (self.$clipStyles) { | ||
self.$clipStyles.parentNode.removeChild(self.$clipStyles); | ||
if ( self.$clipStyles ) { | ||
self.$clipStyles.parentNode.removeChild( self.$clipStyles ); | ||
} | ||
if (self.image.$container) { | ||
self.image.$container.parentNode.removeChild(self.image.$container); | ||
if ( self.image.$container ) { | ||
self.image.$container.parentNode.removeChild( self.image.$container ); | ||
} | ||
// call onDestroy event | ||
if (self.options.onDestroy) { | ||
self.options.onDestroy.call(self); | ||
if ( self.options.onDestroy ) { | ||
self.options.onDestroy.call( self ); | ||
} | ||
@@ -549,3 +558,3 @@ | ||
// needed only when background in fixed position | ||
if (this.image.position !== 'fixed') { | ||
if ( 'fixed' !== this.image.position ) { | ||
return; | ||
@@ -558,17 +567,17 @@ } | ||
if (!self.$clipStyles) { | ||
self.$clipStyles = document.createElement('style'); | ||
self.$clipStyles.setAttribute('type', 'text/css'); | ||
self.$clipStyles.setAttribute('id', `jarallax-clip-${self.instanceID}`); | ||
const head = document.head || document.getElementsByTagName('head')[0]; | ||
head.appendChild(self.$clipStyles); | ||
if ( ! self.$clipStyles ) { | ||
self.$clipStyles = document.createElement( 'style' ); | ||
self.$clipStyles.setAttribute( 'type', 'text/css' ); | ||
self.$clipStyles.setAttribute( 'id', `jarallax-clip-${ self.instanceID }` ); | ||
const head = document.head || document.getElementsByTagName( 'head' )[ 0 ]; | ||
head.appendChild( self.$clipStyles ); | ||
} | ||
const styles = `#jarallax-container-${self.instanceID} { | ||
clip: rect(0 ${width}px ${height}px 0); | ||
clip: rect(0, ${width}px, ${height}px, 0); | ||
const styles = `#jarallax-container-${ self.instanceID } { | ||
clip: rect(0 ${ width }px ${ height }px 0); | ||
clip: rect(0, ${ width }px, ${ height }px, 0); | ||
}`; | ||
// add clip styles inline (this method need for support IE8 and less browsers) | ||
if (self.$clipStyles.styleSheet) { | ||
if ( self.$clipStyles.styleSheet ) { | ||
self.$clipStyles.styleSheet.cssText = styles; | ||
@@ -586,3 +595,3 @@ } else { | ||
const { speed } = self.options; | ||
const isScroll = self.options.type === 'scroll' || self.options.type === 'scroll-opacity'; | ||
const isScroll = 'scroll' === self.options.type || 'scroll-opacity' === self.options.type; | ||
let scrollDist = 0; | ||
@@ -593,21 +602,21 @@ let resultH = contH; | ||
// scroll parallax | ||
if (isScroll) { | ||
if ( isScroll ) { | ||
// scroll distance and height for image | ||
if (speed < 0) { | ||
scrollDist = speed * Math.max(contH, wndH); | ||
if ( 0 > speed ) { | ||
scrollDist = speed * Math.max( contH, wndH ); | ||
if (wndH < contH) { | ||
scrollDist -= speed * (contH - wndH); | ||
if ( wndH < contH ) { | ||
scrollDist -= speed * ( contH - wndH ); | ||
} | ||
} else { | ||
scrollDist = speed * (contH + wndH); | ||
scrollDist = speed * ( contH + wndH ); | ||
} | ||
// size for scroll parallax | ||
if (speed > 1) { | ||
resultH = Math.abs(scrollDist - wndH); | ||
} else if (speed < 0) { | ||
resultH = scrollDist / speed + Math.abs(scrollDist); | ||
if ( 1 < speed ) { | ||
resultH = Math.abs( scrollDist - wndH ); | ||
} else if ( 0 > speed ) { | ||
resultH = scrollDist / speed + Math.abs( scrollDist ); | ||
} else { | ||
resultH += (wndH - contH) * (1 - speed); | ||
resultH += ( wndH - contH ) * ( 1 - speed ); | ||
} | ||
@@ -622,19 +631,19 @@ | ||
// vertical center | ||
if (isScroll) { | ||
resultMT = (wndH - resultH) / 2; | ||
if ( isScroll ) { | ||
resultMT = ( wndH - resultH ) / 2; | ||
} else { | ||
resultMT = (contH - resultH) / 2; | ||
resultMT = ( contH - resultH ) / 2; | ||
} | ||
// apply result to item | ||
self.css(self.image.$item, { | ||
height: `${resultH}px`, | ||
marginTop: `${resultMT}px`, | ||
left: self.image.position === 'fixed' ? `${rect.left}px` : '0', | ||
width: `${rect.width}px`, | ||
}); | ||
self.css( self.image.$item, { | ||
height: `${ resultH }px`, | ||
marginTop: `${ resultMT }px`, | ||
left: 'fixed' === self.image.position ? `${ rect.left }px` : '0', | ||
width: `${ rect.width }px`, | ||
} ); | ||
// call onCoverImage event | ||
if (self.options.onCoverImage) { | ||
self.options.onCoverImage.call(self); | ||
if ( self.options.onCoverImage ) { | ||
self.options.onCoverImage.call( self ); | ||
} | ||
@@ -656,3 +665,3 @@ | ||
onScroll(force) { | ||
onScroll( force ) { | ||
const self = this; | ||
@@ -667,7 +676,7 @@ | ||
let viewportRect = rect; | ||
if (self.options.elementInViewport) { | ||
if ( self.options.elementInViewport ) { | ||
viewportRect = self.options.elementInViewport.getBoundingClientRect(); | ||
} | ||
self.isElementInViewport = viewportRect.bottom >= 0 | ||
&& viewportRect.right >= 0 | ||
self.isElementInViewport = 0 <= viewportRect.bottom | ||
&& 0 <= viewportRect.right | ||
&& viewportRect.top <= wndH | ||
@@ -677,3 +686,3 @@ && viewportRect.left <= window.innerWidth; | ||
// stop calculations if item is not in viewport | ||
if (force ? false : !self.isElementInViewport) { | ||
if ( force ? false : ! self.isElementInViewport ) { | ||
return; | ||
@@ -683,17 +692,17 @@ } | ||
// calculate parallax helping variables | ||
const beforeTop = Math.max(0, contT); | ||
const beforeTopEnd = Math.max(0, contH + contT); | ||
const afterTop = Math.max(0, -contT); | ||
const beforeBottom = Math.max(0, contT + contH - wndH); | ||
const beforeBottomEnd = Math.max(0, contH - (contT + contH - wndH)); | ||
const afterBottom = Math.max(0, -contT + wndH - contH); | ||
const fromViewportCenter = 1 - 2 * (wndH - contT) / (wndH + contH); | ||
const beforeTop = Math.max( 0, contT ); | ||
const beforeTopEnd = Math.max( 0, contH + contT ); | ||
const afterTop = Math.max( 0, -contT ); | ||
const beforeBottom = Math.max( 0, contT + contH - wndH ); | ||
const beforeBottomEnd = Math.max( 0, contH - ( contT + contH - wndH ) ); | ||
const afterBottom = Math.max( 0, -contT + wndH - contH ); | ||
const fromViewportCenter = 1 - 2 * ( ( wndH - contT ) / ( wndH + contH ) ); | ||
// calculate on how percent of section is visible | ||
let visiblePercent = 1; | ||
if (contH < wndH) { | ||
visiblePercent = 1 - (afterTop || beforeBottom) / contH; | ||
} else if (beforeTopEnd <= wndH) { | ||
if ( contH < wndH ) { | ||
visiblePercent = 1 - ( afterTop || beforeBottom ) / contH; | ||
} else if ( beforeTopEnd <= wndH ) { | ||
visiblePercent = beforeTopEnd / wndH; | ||
} else if (beforeBottomEnd <= wndH) { | ||
} else if ( beforeBottomEnd <= wndH ) { | ||
visiblePercent = beforeBottomEnd / wndH; | ||
@@ -703,3 +712,3 @@ } | ||
// opacity | ||
if (self.options.type === 'opacity' || self.options.type === 'scale-opacity' || self.options.type === 'scroll-opacity') { | ||
if ( 'opacity' === self.options.type || 'scale-opacity' === self.options.type || 'scroll-opacity' === self.options.type ) { | ||
styles.transform = 'translate3d(0,0,0)'; | ||
@@ -710,29 +719,29 @@ styles.opacity = visiblePercent; | ||
// scale | ||
if (self.options.type === 'scale' || self.options.type === 'scale-opacity') { | ||
if ( 'scale' === self.options.type || 'scale-opacity' === self.options.type ) { | ||
let scale = 1; | ||
if (self.options.speed < 0) { | ||
if ( 0 > self.options.speed ) { | ||
scale -= self.options.speed * visiblePercent; | ||
} else { | ||
scale += self.options.speed * (1 - visiblePercent); | ||
scale += self.options.speed * ( 1 - visiblePercent ); | ||
} | ||
styles.transform = `scale(${scale}) translate3d(0,0,0)`; | ||
styles.transform = `scale(${ scale }) translate3d(0,0,0)`; | ||
} | ||
// scroll | ||
if (self.options.type === 'scroll' || self.options.type === 'scroll-opacity') { | ||
if ( 'scroll' === self.options.type || 'scroll-opacity' === self.options.type ) { | ||
let positionY = self.parallaxScrollDistance * fromViewportCenter; | ||
// fix if parallax block in absolute position | ||
if (self.image.position === 'absolute') { | ||
if ( 'absolute' === self.image.position ) { | ||
positionY -= contT; | ||
} | ||
styles.transform = `translate3d(0,${positionY}px,0)`; | ||
styles.transform = `translate3d(0,${ positionY }px,0)`; | ||
} | ||
self.css(self.image.$item, styles); | ||
self.css( self.image.$item, styles ); | ||
// call onScroll event | ||
if (self.options.onScroll) { | ||
self.options.onScroll.call(self, { | ||
if ( self.options.onScroll ) { | ||
self.options.onScroll.call( self, { | ||
section: rect, | ||
@@ -749,3 +758,3 @@ | ||
fromViewportCenter, | ||
}); | ||
} ); | ||
} | ||
@@ -762,11 +771,9 @@ } | ||
// global definition | ||
const plugin = function (items) { | ||
const plugin = function( items, options, ...args ) { | ||
// check for dom element | ||
// thanks: http://stackoverflow.com/questions/384286/javascript-isdom-how-do-you-check-if-a-javascript-object-is-a-dom-object | ||
if (typeof HTMLElement === 'object' ? items instanceof HTMLElement : items && typeof items === 'object' && items !== null && items.nodeType === 1 && typeof items.nodeName === 'string') { | ||
items = [items]; | ||
if ( 'object' === typeof HTMLElement ? items instanceof HTMLElement : items && 'object' === typeof items && null !== items && 1 === items.nodeType && 'string' === typeof items.nodeName ) { | ||
items = [ items ]; | ||
} | ||
const options = arguments[1]; | ||
const args = Array.prototype.slice.call(arguments, 2); | ||
const len = items.length; | ||
@@ -776,12 +783,12 @@ let k = 0; | ||
for (k; k < len; k++) { | ||
if (typeof options === 'object' || typeof options === 'undefined') { | ||
if (!items[k].jarallax) { | ||
items[k].jarallax = new Jarallax(items[k], options); | ||
for ( k; k < len; k += 1 ) { | ||
if ( 'object' === typeof options || 'undefined' === typeof options ) { | ||
if ( ! items[ k ].jarallax ) { | ||
items[ k ].jarallax = new Jarallax( items[ k ], options ); | ||
} | ||
} else if (items[k].jarallax) { | ||
} else if ( items[ k ].jarallax ) { | ||
// eslint-disable-next-line prefer-spread | ||
ret = items[k].jarallax[options].apply(items[k].jarallax, args); | ||
ret = items[ k ].jarallax[ options ].apply( items[ k ].jarallax, args ); | ||
} | ||
if (typeof ret !== 'undefined') { | ||
if ( 'undefined' !== typeof ret ) { | ||
return ret; | ||
@@ -788,0 +795,0 @@ } |
import domReady from 'lite-ready'; | ||
import { window, jQuery } from 'global'; | ||
import jarallax from './jarallax.esm'; | ||
@@ -8,3 +9,3 @@ | ||
window.jarallax = jarallax; | ||
window.jarallax.noConflict = function () { | ||
window.jarallax.noConflict = function() { | ||
window.jarallax = oldPlugin; | ||
@@ -15,8 +16,7 @@ return this; | ||
// jQuery support | ||
if (typeof jQuery !== 'undefined') { | ||
const jQueryPlugin = function () { | ||
const args = arguments || []; | ||
Array.prototype.unshift.call(args, this); | ||
const res = jarallax.apply(window, args); | ||
return typeof res !== 'object' ? res : this; | ||
if ( 'undefined' !== typeof jQuery ) { | ||
const jQueryPlugin = function( ...args ) { | ||
Array.prototype.unshift.call( args, this ); | ||
const res = jarallax.apply( window, args ); | ||
return 'object' !== typeof res ? res : this; | ||
}; | ||
@@ -28,3 +28,3 @@ jQueryPlugin.constructor = jarallax.constructor; | ||
jQuery.fn.jarallax = jQueryPlugin; | ||
jQuery.fn.jarallax.noConflict = function () { | ||
jQuery.fn.jarallax.noConflict = function() { | ||
jQuery.fn.jarallax = oldJqPlugin; | ||
@@ -36,4 +36,4 @@ return this; | ||
// data-jarallax initialization | ||
domReady(() => { | ||
jarallax(document.querySelectorAll('[data-jarallax]')); | ||
}); | ||
domReady( () => { | ||
jarallax( document.querySelectorAll( '[data-jarallax]' ) ); | ||
} ); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
328203
3
31
3400
387
- Removedrafl@^1.2.2
- Removedglobal@4.3.2(transitive)
- Removedprocess@0.5.2(transitive)
- Removedrafl@1.2.2(transitive)
Updatedvideo-worker@^1.1.8