' + '';
element.appendChild(element.__resizeTriggers__);
resetTriggers(element);
element.addEventListener('scroll', scrollListener, true);
/* Listen for a css animation to detect element display/re-attach */
animationstartevent && element.__resizeTriggers__.addEventListener(animationstartevent, function (e) {
if (e.animationName == animationName) {
resetTriggers(element);
}
});
}
element.__resizeListeners__.push(fn);
}
};
window.removeResizeListener = function (element, fn) {
if (attachEvent) {
element.detachEvent('onresize', fn);
} else {
if (!(element && element.__resizeListeners__ && element.__resizeTriggers__)) {
return;
}
element.__resizeListeners__.splice(element.__resizeListeners__.indexOf(fn), 1);
if (!element.__resizeListeners__.length) {
element.removeEventListener('scroll', scrollListener);
element.__resizeTriggers__ = !element.removeChild(element.__resizeTriggers__);
}
}
};
/***/ }),
/* 129 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _classCallCheck2 = __webpack_require__(43);
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
var _createClass2 = __webpack_require__(44);
var _createClass3 = _interopRequireDefault(_createClass2);
var _colibri = __webpack_require__(104);
var _colibri2 = _interopRequireDefault(_colibri);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var ColibriFrontComponent = function () {
(0, _createClass3.default)(ColibriFrontComponent, null, [{
key: 'componentName',
value: function componentName() {
throw new TypeError('name getter should be implemented');
}
}]);
function ColibriFrontComponent(element, options) {
(0, _classCallCheck3.default)(this, ColibriFrontComponent);
this.$ = jQuery;
this.namespace = this.constructor.componentName();
this.utils = new _colibri2.default.Utils();
this.detect = new _colibri2.default.Detect();
this.init();
_colibri2.default.apply(this, arguments);
this.start();
if (this.isCustomizerPreview()) {
this.wpCustomize(wp.customize);
}
return this;
}
(0, _createClass3.default)(ColibriFrontComponent, [{
key: 'init',
value: function init() {}
}, {
key: 'isCustomizerPreview',
value: function isCustomizerPreview() {
return _colibri2.default.isCustomizerPreview();
}
}, {
key: 'wpCustomize',
value: function wpCustomize(api) {}
}, {
key: 'wpSettingBind',
value: function wpSettingBind(setting_id, callback) {
window.wp.customize(setting_id, function (setting) {
setting.bind(callback);
});
}
}, {
key: 'updateData',
value: function updateData(data) {
this.opts = jQuery.extend({}, this.opts, data);
this.restart();
}
}, {
key: 'restart',
value: function restart() {}
}, {
key: 'start',
value: function start() {}
}]);
return ColibriFrontComponent;
}();
exports.default = ColibriFrontComponent;
/***/ }),
/* 130 */
/***/ (function(module, exports, __webpack_require__) {
module.exports = { "default": __webpack_require__(131), __esModule: true };
/***/ }),
/* 131 */
/***/ (function(module, exports, __webpack_require__) {
__webpack_require__(132);
var $Object = __webpack_require__(3).Object;
module.exports = function defineProperty(it, key, desc) {
return $Object.defineProperty(it, key, desc);
};
/***/ }),
/* 132 */
/***/ (function(module, exports, __webpack_require__) {
var $export = __webpack_require__(16);
// 19.1.2.4 / 15.2.3.6 Object.defineProperty(O, P, Attributes)
$export($export.S + $export.F * !__webpack_require__(8), 'Object', { defineProperty: __webpack_require__(7).f });
/***/ }),
/* 133 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
var _slideshow = __webpack_require__(134);
var _slideshow2 = _interopRequireDefault(_slideshow);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var CustomizableSlideshow = function (_Slideshow) {
_inherits(CustomizableSlideshow, _Slideshow);
function CustomizableSlideshow() {
_classCallCheck(this, CustomizableSlideshow);
return _possibleConstructorReturn(this, (CustomizableSlideshow.__proto__ || Object.getPrototypeOf(CustomizableSlideshow)).apply(this, arguments));
}
_createClass(CustomizableSlideshow, [{
key: "start",
value: function start() {
_get(CustomizableSlideshow.prototype.__proto__ || Object.getPrototypeOf(CustomizableSlideshow.prototype), "start", this).call(this);
if (!this.customizerBinded) {
this.wpCustomize(wp.customize);
this.customizerBinded = true;
}
}
}, {
key: "wpCustomize",
value: function wpCustomize(api) {
var _this2 = this;
var _loop = function _loop(opt) {
if (_this2.opts.wpSettings.hasOwnProperty(opt)) {
var setting = _this2.opts.wpSettings[opt];
_this2.wpSettingBind(setting, function (newValue) {
_this2.opts[opt] = parseInt(newValue);
_this2.stop();
setTimeout(function () {
_this2.start();
}, 100);
});
}
};
for (var opt in this.opts.wpSettings) {
_loop(opt);
}
}
}, {
key: "wpSettingBind",
value: function wpSettingBind(setting_id, callback) {
window.wp.customize(setting_id, function (setting) {
setting.bind(callback);
});
}
}]);
return CustomizableSlideshow;
}(_slideshow2.default);
exports.default = CustomizableSlideshow;
/***/ }),
/* 134 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _getPrototypeOf = __webpack_require__(54);
var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);
var _classCallCheck2 = __webpack_require__(43);
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
var _createClass2 = __webpack_require__(44);
var _createClass3 = _interopRequireDefault(_createClass2);
var _possibleConstructorReturn2 = __webpack_require__(59);
var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
var _inherits2 = __webpack_require__(60);
var _inherits3 = _interopRequireDefault(_inherits2);
var _index = __webpack_require__(64);
var _lodash = __webpack_require__(103);
var _lodash2 = _interopRequireDefault(_lodash);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var Slideshow = function (_ColibriFrontComponen) {
(0, _inherits3.default)(Slideshow, _ColibriFrontComponen);
function Slideshow() {
(0, _classCallCheck3.default)(this, Slideshow);
return (0, _possibleConstructorReturn3.default)(this, (Slideshow.__proto__ || (0, _getPrototypeOf2.default)(Slideshow)).apply(this, arguments));
}
(0, _createClass3.default)(Slideshow, [{
key: 'init',
value: function init() {
var _this2 = this;
this.currentIndex = 0;
this.interval = -1;
this.debouncedRestart = (0, _lodash2.default)(function () {
_this2.stop();
_this2.start();
}, 500);
}
}, {
key: 'addImageEffect',
value: function addImageEffect(image, index) {
var duration = this.opts.slideDuration;
var speed = this.opts.slideSpeed;
var delay = duration - speed;
if (delay < 0) {
delay = 0;
}
this.$(image).css({
transition: 'opacity ' + speed + 'ms ease ' + delay + 'ms',
zIndex: this.$images.length - index
});
}
}, {
key: 'slideImage',
value: function slideImage() {
this.$images.eq(this.currentIndex).removeClass('current');
var nextIndex = this.currentIndex + 1 === this.$images.length ? 0 : this.currentIndex + 1;
this.$images.eq(nextIndex).addClass('current').removeClass('next');
this.currentIndex = nextIndex;
var futureIndex = this.currentIndex + 1 === this.$images.length ? 0 : this.currentIndex + 1;
this.$images.eq(futureIndex).addClass('next');
}
}, {
key: 'restart',
value: function restart() {
this.debouncedRestart();
}
}, {
key: 'start',
value: function start() {
var _this3 = this;
this.$images = this.$element.find('.slideshow-image');
this.$images.removeClass('current');
this.$images.eq(0).addClass('current');
this.currentIndex = 0;
this.$images.each(function (index, image) {
_this3.addImageEffect(image, index);
});
this.interval = setInterval(function () {
_this3.slideImage();
}, parseInt(this.opts.slideDuration));
}
}, {
key: 'stop',
value: function stop() {
clearInterval(this.interval);
this.$images.css({
transition: '',
opacity: ''
});
this.$images.removeClass('current next');
this.$images.eq(0).addClass('current');
this.currentIndex = 0;
}
}], [{
key: 'componentName',
value: function componentName() {
return 'slideshow';
}
}]);
return Slideshow;
}(_index.ColibriFrontComponent);
exports.default = Slideshow;
/***/ }),
/* 135 */
/***/ (function(module, exports, __webpack_require__) {
__webpack_require__(136);
module.exports = __webpack_require__(3).Object.getPrototypeOf;
/***/ }),
/* 136 */
/***/ (function(module, exports, __webpack_require__) {
// 19.1.2.9 Object.getPrototypeOf(O)
var toObject = __webpack_require__(41);
var $getPrototypeOf = __webpack_require__(58);
__webpack_require__(90)('getPrototypeOf', function () {
return function getPrototypeOf(it) {
return $getPrototypeOf(toObject(it));
};
});
/***/ }),
/* 137 */
/***/ (function(module, exports, __webpack_require__) {
module.exports = { "default": __webpack_require__(138), __esModule: true };
/***/ }),
/* 138 */
/***/ (function(module, exports, __webpack_require__) {
__webpack_require__(139);
module.exports = __webpack_require__(3).Object.setPrototypeOf;
/***/ }),
/* 139 */
/***/ (function(module, exports, __webpack_require__) {
// 19.1.3.19 Object.setPrototypeOf(O, proto)
var $export = __webpack_require__(16);
$export($export.S, 'Object', { setPrototypeOf: __webpack_require__(140).set });
/***/ }),
/* 140 */
/***/ (function(module, exports, __webpack_require__) {
// Works with __proto__ only. Old v8 can't work with null proto objects.
/* eslint-disable no-proto */
var isObject = __webpack_require__(13);
var anObject = __webpack_require__(17);
var check = function (O, proto) {
anObject(O);
if (!isObject(proto) && proto !== null) throw TypeError(proto + ": can't set as prototype!");
};
module.exports = {
set: Object.setPrototypeOf || ('__proto__' in {} ? // eslint-disable-line
function (test, buggy, set) {
try {
set = __webpack_require__(56)(Function.call, __webpack_require__(53).f(Object.prototype, '__proto__').set, 2);
set(test, []);
buggy = !(test instanceof Array);
} catch (e) { buggy = true; }
return function setPrototypeOf(O, proto) {
check(O, proto);
if (buggy) O.__proto__ = proto;
else set(O, proto);
return O;
};
}({}, false) : undefined),
check: check
};
/***/ }),
/* 141 */
/***/ (function(module, exports, __webpack_require__) {
module.exports = { "default": __webpack_require__(142), __esModule: true };
/***/ }),
/* 142 */
/***/ (function(module, exports, __webpack_require__) {
__webpack_require__(143);
var $Object = __webpack_require__(3).Object;
module.exports = function create(P, D) {
return $Object.create(P, D);
};
/***/ }),
/* 143 */
/***/ (function(module, exports, __webpack_require__) {
var $export = __webpack_require__(16);
// 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties])
$export($export.S, 'Object', { create: __webpack_require__(40) });
/***/ }),
/* 144 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
var _videoBg = __webpack_require__(145);
var _videoBg2 = _interopRequireDefault(_videoBg);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var CustomizableVideoBackground = function (_VideoBackground) {
_inherits(CustomizableVideoBackground, _VideoBackground);
function CustomizableVideoBackground(element, options) {
var _ret;
_classCallCheck(this, CustomizableVideoBackground);
var _this = _possibleConstructorReturn(this, (CustomizableVideoBackground.__proto__ || Object.getPrototypeOf(CustomizableVideoBackground)).call(this, element, options));
return _ret = _this, _possibleConstructorReturn(_this, _ret);
}
_createClass(CustomizableVideoBackground, [{
key: "wpCustomize",
value: function wpCustomize(api) {
var _this2 = this;
this.API_URL = hillstar_ADDITIONAL_JS_DATA.api_url;
var _loop = function _loop(opt) {
if (_this2.opts.wpSettings.hasOwnProperty(opt)) {
var setting = _this2.opts.wpSettings[opt];
_this2.wpSettingBind(setting, function (newValue) {
if (opt === "externalUrl") {
_this2.restartYouTubeVideo(newValue);
}
if (opt === "internalUrl") {
_this2.restartSelfHostedVideo(newValue);
}
if (opt === "videoType") {
var videoType = "native";
if (newValue == "external") videoType = "youtube";
_this2.changeProvider(videoType);
}
if (opt === "posterUrl") {
_this2.$element.css({
backgroundImage: "url(" + newValue + ")"
});
_this2.videoData.poster = newValue;
}
});
}
};
for (var opt in this.opts.wpSettings) {
_loop(opt);
}
}
}, {
key: "changeProvider",
value: function changeProvider(newValue) {
if (newValue === "youtube") {
this.restartYouTubeVideo(wp.customize(this.opts.wpSettings['externalUrl']).get());
} else {
this.restartSelfHostedVideo(wp.customize(this.opts.wpSettings['internalUrl']).get());
}
}
}, {
key: "restartYouTubeVideo",
value: function restartYouTubeVideo(value) {
this.videoData.videoUrl = value;
this.videoData.mimeType = "video/x-youtube";
_get(CustomizableVideoBackground.prototype.__proto__ || Object.getPrototypeOf(CustomizableVideoBackground.prototype), "generateVideo", this).call(this);
}
}, {
key: "restartSelfHostedVideo",
value: function restartSelfHostedVideo(value) {
var _this3 = this;
if (!value) {
this.videoData.videoUrl = "";
this.videoData.mimeType = "video/mp4";
_get(CustomizableVideoBackground.prototype.__proto__ || Object.getPrototypeOf(CustomizableVideoBackground.prototype), "generateVideo", this).call(this);
} else {
this.$.getJSON(this.API_URL + "/attachment-data/" + value, function (data) {
_this3.videoData.videoUrl = data.url;
_this3.videoData.mimeType = data.mime_type;
_get(CustomizableVideoBackground.prototype.__proto__ || Object.getPrototypeOf(CustomizableVideoBackground.prototype), "generateVideo", _this3).call(_this3);
});
}
}
}]);
return CustomizableVideoBackground;
}(_videoBg2.default);
exports.default = CustomizableVideoBackground;
/***/ }),
/* 145 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _getPrototypeOf = __webpack_require__(54);
var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);
var _classCallCheck2 = __webpack_require__(43);
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
var _createClass2 = __webpack_require__(44);
var _createClass3 = _interopRequireDefault(_createClass2);
var _possibleConstructorReturn2 = __webpack_require__(59);
var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
var _inherits2 = __webpack_require__(60);
var _inherits3 = _interopRequireDefault(_inherits2);
var _index = __webpack_require__(64);
var _handlers = __webpack_require__(146);
var _handlers2 = _interopRequireDefault(_handlers);
var _isMobile = __webpack_require__(153);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var VideoBackground = function (_ColibriFrontComponen) {
(0, _inherits3.default)(VideoBackground, _ColibriFrontComponen);
function VideoBackground() {
(0, _classCallCheck3.default)(this, VideoBackground);
return (0, _possibleConstructorReturn3.default)(this, (VideoBackground.__proto__ || (0, _getPrototypeOf2.default)(VideoBackground)).apply(this, arguments));
}
(0, _createClass3.default)(VideoBackground, [{
key: 'init',
value: function init() {
this.videoData = {};
this.handler = false;
this.debouncedSetPosition = jQuery.debounce(this.updateVideoBackground.bind(this), 100);
}
}, {
key: 'generateVideo',
value: function generateVideo() {
var _this2 = this;
for (var handle in _handlers2.default) {
if (_handlers2.default.hasOwnProperty(handle) && _handlers2.default[handle].test(this.videoData)) {
this.$element.empty();
this.handler = new _handlers2.default[handle](this.$element[0], this.videoData);
break;
}
}
this.handler.onLoad(function () {
_this2.$element.children('iframe,video').addClass('h-hide-sm-force');
_this2.debouncedSetPosition();
_this2.handler.onResize(function () {
return _this2.debouncedSetPosition();
});
});
if (window.hop) {
window.addResizeListener(this.$element.closest('.background-wrapper').parent()[0], this.debouncedSetPosition);
this.debouncedSetPosition();
}
}
}, {
key: 'stopVideo',
value: function stopVideo() {
if (this.handler.stopVideo) {
this.handler.stopVideo();
}
}
}, {
key: 'play',
value: function play() {
if (this.handler.play) {
this.handler.play();
}
}
}, {
key: 'updateVideoBackground',
value: function updateVideoBackground() {
if (this.handler.updateVideoSize) {
this.handler.updateVideoSize();
}
this.setPosition();
}
}, {
key: 'setPosition',
value: function setPosition() {
var _this3 = this;
this.handler.pause();
if (this.$element.children('iframe,video').eq(0).css('display') === 'none') {
return;
}
var $video = this.$element.children('iframe,video').eq(0),
posX = $video.is('iframe') ? 50 : this.opts.positionX,
posY = $video.is('iframe') ? 50 : this.opts.positionY,
x = Math.max($video.width() - this.$element.width(), 0) * parseFloat(posX) / 100,
y = Math.max($video.height() - this.$element.height(), 0) * parseFloat(posY) / 100;
$video.css({
transform: 'translate(-' + x + 'px,-' + y + 'px)',
'-webkit-transform': 'translate(-' + x + 'px,-' + y + 'px)'
});
this.$element.addClass('visible');
setTimeout(function () {
_this3.handler.play();
}, 100);
}
}, {
key: 'start',
value: function start() {
this.videoData = {
mimeType: this.opts.mimeType,
poster: this.opts.poster,
videoUrl: this.opts.video
};
if (!(0, _isMobile.isMobile)()) {
this.generateVideo();
}
}
}, {
key: 'stop',
value: function stop() {
window.removeResizeListener(this.$element.closest('.background-wrapper').parent()[0], this.debouncedSetPosition);
}
}, {
key: 'restart',
value: function restart() {
this.stop();
this.start();
}
}], [{
key: 'componentName',
value: function componentName() {
return 'video-background';
}
}]);
return VideoBackground;
}(_index.ColibriFrontComponent);
exports.default = VideoBackground;
/***/ }),
/* 146 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _nativeHandler = __webpack_require__(147);
var _nativeHandler2 = _interopRequireDefault(_nativeHandler);
var _youtubeHandler = __webpack_require__(148);
var _youtubeHandler2 = _interopRequireDefault(_youtubeHandler);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var Handlers = {
native: _nativeHandler2.default,
youtube: _youtubeHandler2.default
};
exports.default = Handlers;
/***/ }),
/* 147 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _getPrototypeOf = __webpack_require__(54);
var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);
var _classCallCheck2 = __webpack_require__(43);
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
var _createClass2 = __webpack_require__(44);
var _createClass3 = _interopRequireDefault(_createClass2);
var _possibleConstructorReturn2 = __webpack_require__(59);
var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
var _inherits2 = __webpack_require__(60);
var _inherits3 = _interopRequireDefault(_inherits2);
var _baseHandler = __webpack_require__(105);
var _baseHandler2 = _interopRequireDefault(_baseHandler);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var NativeHandler = function (_BaseHandler) {
(0, _inherits3.default)(NativeHandler, _BaseHandler);
function NativeHandler() {
(0, _classCallCheck3.default)(this, NativeHandler);
return (0, _possibleConstructorReturn3.default)(this, (NativeHandler.__proto__ || (0, _getPrototypeOf2.default)(NativeHandler)).apply(this, arguments));
}
(0, _createClass3.default)(NativeHandler, [{
key: 'isPaused',
value: function isPaused() {
return this.video.paused;
}
}, {
key: 'ready',
value: function ready() {
var _this2 = this;
if (this.settings.poster) {
this.element.style.backgroundImage = 'url("' + this.settings.poster + '")';
}
if (!this.settings.videoUrl) {
return;
}
var video = document.createElement('video');
video.id = this.settings.id || '';
// video.autoplay = 'autoplay';
video.loop = 'loop';
video.muted = 'muted';
if (this.settings.width) {
video.width = this.settings.width;
}
if (this.settings.height) {
video.height = this.settings.height;
}
video.addEventListener('play', function () {
_this2.trigger('play');
});
video.addEventListener('pause', function () {
_this2.trigger('pause');
});
video.addEventListener('loadeddata', function () {
_this2.loaded();
});
this.video = video;
this.setVideo(video);
video.src = this.settings.videoUrl;
}
}, {
key: 'pause',
value: function pause() {
this.video.pause();
}
}, {
key: 'stopVideo',
value: function stopVideo() {
this.video.pause();
this.video.currentTime = 0;
}
}, {
key: 'play',
value: function play() {
this.video.play();
}
}], [{
key: 'test',
value: function test(settings) {
var video = document.createElement('video');
return video.canPlayType(settings.mimeType);
}
}]);
return NativeHandler;
}(_baseHandler2.default);
exports.default = NativeHandler;
/***/ }),
/* 148 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _getPrototypeOf = __webpack_require__(54);
var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);
var _classCallCheck2 = __webpack_require__(43);
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
var _createClass2 = __webpack_require__(44);
var _createClass3 = _interopRequireDefault(_createClass2);
var _possibleConstructorReturn2 = __webpack_require__(59);
var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
var _get2 = __webpack_require__(149);
var _get3 = _interopRequireDefault(_get2);
var _inherits2 = __webpack_require__(60);
var _inherits3 = _interopRequireDefault(_inherits2);
var _baseHandler = __webpack_require__(105);
var _baseHandler2 = _interopRequireDefault(_baseHandler);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var VIDEO_ID_REGEX = /^.*(?:(?:youtu\.be\/|v\/|vi\/|u\/\w\/|embed\/)|(?:(?:watch)?\?v(?:i)?=|&v(?:i)?=))([^#&?]*).*/; /** @global YT */
var YouTubeHandler = function (_BaseHandler) {
(0, _inherits3.default)(YouTubeHandler, _BaseHandler);
function YouTubeHandler(element, settings) {
var _ret;
(0, _classCallCheck3.default)(this, YouTubeHandler);
var _this = (0, _possibleConstructorReturn3.default)(this, (YouTubeHandler.__proto__ || (0, _getPrototypeOf2.default)(YouTubeHandler)).call(this, element, settings));
return _ret = _this, (0, _possibleConstructorReturn3.default)(_this, _ret);
}
(0, _createClass3.default)(YouTubeHandler, [{
key: 'ready',
value: function ready() {
var _this2 = this;
if (this.settings.poster) {
this.element.style.backgroundImage = 'url("' + this.settings.poster + '")';
}
if ('YT' in window) {
window.YT.ready(function () {
_this2.loadVideo();
});
} else {
var tag = document.createElement('script');
tag.src = 'https://www.youtube.com/iframe_api';
tag.onload = function () {
window.YT.ready(function () {
_this2.loadVideo();
});
};
document.getElementsByTagName('head')[0].appendChild(tag);
}
}
}, {
key: 'getVideoID',
value: function getVideoID() {
var matches = this.settings.videoUrl.match(VIDEO_ID_REGEX);
if (matches && matches.length >= 2) {
return matches[1];
}
return null;
}
}, {
key: 'getYTOptions',
value: function getYTOptions() {
var _this3 = this;
var options = {
videoId: this.getVideoID(),
events: {
onReady: function onReady(e) {
var ytVideo = e.target;
//added mute param, not sure if this mute function call is needed anymore.
ytVideo.mute();
top.yt1 = ytVideo;
ytVideo.setPlaybackQuality('auto');
_this3.play();
_this3.loaded();
},
onStateChange: function onStateChange(e) {
if (window.YT.PlayerState.PLAYING === e.data) {
_this3.trigger('play');
} else if (window.YT.PlayerState.PAUSED === e.data) {
_this3.trigger('pause');
} else if (window.YT.PlayerState.ENDED === e.data) {
e.target.playVideo();
}
},
onError: function onError(e) {
_this3.player.getIframe().style.display = 'none';
}
},
playerVars: {
autoplay: 1,
controls: 0,
disablekb: 1,
fs: 0,
iv_load_policy: 3,
loop: 1,
modestbranding: 1,
playsinline: 1,
rel: 0,
showinfo: 0,
/**
* Sometimes the mute function used in the onRead event did not work, but using this options the videos are
* always muted
*/
mute: 1
}
};
if (this.settings.height) {
options['height'] = this.settings.height;
} else {
options['height'] = 1080;
}
if (this.settings.width) {
options['width'] = this.settings.width;
} else {
options['width'] = 1920;
}
// height: this.settings.height,
// width: this.settings.width,
return options;
}
}, {
key: 'loadVideo',
value: function loadVideo() {
var video = document.createElement('div'),
YT = window.YT;
this.setVideo(video);
this.player = new window.YT.Player(video, this.getYTOptions());
}
}, {
key: 'updateVideoSize',
value: function updateVideoSize() {
if (!this.player) {
return;
}
var $iframe = jQuery(this.player.getIframe()),
size = this.calcVideosSize();
$iframe.css(size);
$iframe.addClass('ready');
}
}, {
key: 'calcVideosSize',
value: function calcVideosSize() {
var width = jQuery(this.element).outerWidth(),
height = jQuery(this.element).outerHeight(),
aspectRatio = '16:9'.split(':'),
proportion = aspectRatio[0] / aspectRatio[1],
keepWidth = width / height > proportion,
magnifier = 1;
return {
width: magnifier * (keepWidth ? width : height * proportion),
height: magnifier * (keepWidth ? width / proportion : height)
};
}
}, {
key: 'play',
value: function play() {
if (!!this.player && !!this.player.playVideo) {
if (!this.isPlaying) {
this.isPlaying = true;
this.player.playVideo();
}
}
}
}, {
key: 'stopVideo',
value: function stopVideo() {
if (!!this.player && !!this.player.stopVideo) {
if (this.isPlaying) {
this.isPlaying = false;
this.player.stopVideo();
}
}
}
}, {
key: 'pause',
value: function pause() {
if (!!this.player && !!this.player.pauseVideo && !this.isPlaying) {
this.isPlaying = false;
this.player.pauseVideo();
}
}
}, {
key: 'isPaused',
value: function isPaused() {
return YT.PlayerState.PAUSED === this.player.getPlayerState();
}
}, {
key: 'loaded',
value: function loaded() {
this.updateVideoSize();
(0, _get3.default)(YouTubeHandler.prototype.__proto__ || (0, _getPrototypeOf2.default)(YouTubeHandler.prototype), 'loaded', this).call(this);
}
}, {
key: 'addResizeBind',
value: function addResizeBind() {
var _this4 = this;
this.onResize(function () {
return _this4.updateVideoSize();
}, 50);
(0, _get3.default)(YouTubeHandler.prototype.__proto__ || (0, _getPrototypeOf2.default)(YouTubeHandler.prototype), 'addResizeBind', this).call(this);
}
}], [{
key: 'test',
value: function test(settings) {
return 'video/x-youtube' === settings.mimeType;
}
}]);
return YouTubeHandler;
}(_baseHandler2.default);
exports.default = YouTubeHandler;
/***/ }),
/* 149 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
exports.__esModule = true;
var _getPrototypeOf = __webpack_require__(54);
var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);
var _getOwnPropertyDescriptor = __webpack_require__(150);
var _getOwnPropertyDescriptor2 = _interopRequireDefault(_getOwnPropertyDescriptor);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = function get(object, property, receiver) {
if (object === null) object = Function.prototype;
var desc = (0, _getOwnPropertyDescriptor2.default)(object, property);
if (desc === undefined) {
var parent = (0, _getPrototypeOf2.default)(object);
if (parent === null) {
return undefined;
} else {
return get(parent, property, receiver);
}
} else if ("value" in desc) {
return desc.value;
} else {
var getter = desc.get;
if (getter === undefined) {
return undefined;
}
return getter.call(receiver);
}
};
/***/ }),
/* 150 */
/***/ (function(module, exports, __webpack_require__) {
module.exports = { "default": __webpack_require__(151), __esModule: true };
/***/ }),
/* 151 */
/***/ (function(module, exports, __webpack_require__) {
__webpack_require__(152);
var $Object = __webpack_require__(3).Object;
module.exports = function getOwnPropertyDescriptor(it, key) {
return $Object.getOwnPropertyDescriptor(it, key);
};
/***/ }),
/* 152 */
/***/ (function(module, exports, __webpack_require__) {
// 19.1.2.6 Object.getOwnPropertyDescriptor(O, P)
var toIObject = __webpack_require__(9);
var $getOwnPropertyDescriptor = __webpack_require__(53).f;
__webpack_require__(90)('getOwnPropertyDescriptor', function () {
return function getOwnPropertyDescriptor(it, key) {
return $getOwnPropertyDescriptor(toIObject(it), key);
};
});
/***/ }),
/* 153 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
module.exports = isMobile;
module.exports.isMobile = isMobile;
var mobileRE = /(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series[46]0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i;
var tabletRE = /(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series[46]0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino|android|ipad|playbook|silk/i;
function isMobile(opts) {
if (!opts) {
opts = {};
}
var ua = opts.ua;
if (!ua && typeof navigator !== 'undefined') {
ua = navigator.userAgent;
}
if (ua && ua.headers && typeof ua.headers['user-agent'] === 'string') {
ua = ua.headers['user-agent'];
}
if (typeof ua !== 'string') {
return false;
}
return opts.tablet ? tabletRE.test(ua) : mobileRE.test(ua);
}
/***/ }),
/* 154 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _linksDefineSamePage = __webpack_require__(106);
var _linksDefineSamePage2 = _interopRequireDefault(_linksDefineSamePage);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
(function ($) {
function inCustomizer() {
return Colibri.isCustomizerPreview();
}
if (window.location.hash === '#page-top') {
changeUrlHash('', 5);
}
var __toCheckOnScroll = {
items: {},
eachCategory: function eachCategory(callback) {
for (var id in this.items) {
if (!this.items.hasOwnProperty(id)) {
continue;
}
callback(this.items[id]);
}
},
addItem: function addItem(id, item) {
if (!this.items[id]) {
this.items[id] = [];
}
this.items[id].push(item);
},
all: function all() {
var result = [];
for (var id in this.items) {
if (!this.items.hasOwnProperty(id)) {
continue;
}
result = result.concat(this.items[id]);
}
return result;
}
};
var __alreadyScrolling = false;
function getScrollToValue(elData) {
var offset = !isNaN(parseFloat(elData.options.offset)) ? elData.options.offset : elData.options.offset.call(elData.target);
var scrollToValue = elData.target.offset().top - offset - $('body').offset().top;
return scrollToValue;
}
function changeUrlHash(hash, timeout) {
if (hash === location.hash.replace('#', '') || hash === 'page-top' && '' === location.hash.replace('#', '')) {
return;
}
setTimeout(function () {
if (hash) {
if (hash === 'page-top') {
hash = ' ';
} else {
hash = '#' + hash;
}
} else {
hash = ' ';
}
if (history && history.replaceState) {
history.replaceState({}, '', hash);
}
}, timeout || 100);
/* safari issue fixed by throtteling the event */
}
function scrollItem(elData) {
if (__alreadyScrolling) {
return;
}
__alreadyScrolling = true;
var scrollToValue = getScrollToValue(elData);
$('html, body').animate({ scrollTop: scrollToValue }, {
easing: 'linear',
complete: function complete() {
// check for any updates
var scrollToValue = getScrollToValue(elData);
$('html, body').animate({ scrollTop: scrollToValue }, {
easing: 'linear',
duration: 100,
complete: function complete() {
__alreadyScrolling = false;
changeUrlHash(elData.id, 5);
}
});
}
});
}
function getPageBaseUrl() {
return [location.protocol, '//', location.host, location.pathname].join('');
}
function fallbackUrlParse(url) {
return url.split('?')[0].split('#')[0];
}
function getABaseUrl(element) {
var href = jQuery(element)[0].href || '';
var url = '#';
try {
var _url = new window.URL(href);
url = [_url.protocol, '//', _url.host, _url.pathname].join('');
} catch (e) {
url = fallbackUrlParse(href);
}
return url;
}
function getTargetForEl(element) {
var targetId = (element.attr('href') || '').split('#').pop(),
hrefBase = getABaseUrl(element),
target = null,
pageURL = getPageBaseUrl();
if (hrefBase.length && hrefBase !== pageURL) {
return target;
}
if (targetId.trim().length) {
try {
target = $('[id="' + targetId + '"]');
} catch (e) {
console.log('error scrollSpy', e);
}
}
if (target && target.length) {
return target;
}
return null;
}
$.fn.smoothScrollAnchor = function (options) {
if (inCustomizer()) {
return;
}
var elements = $(this);
options = jQuery.extend({
offset: function offset() {
var $fixed = $('.h-navigation_sticky');
if ($fixed.length) {
return $fixed[0].getBoundingClientRect().height;
}
return 0;
}
}, options);
elements.each(function () {
var element = $(this);
//if the target options is not set or the href is not for the same page don't add smoothscroll
if (!options.target && !(0, _linksDefineSamePage2.default)(document.location.href, this.href)) {
return;
}
var target = options.target || getTargetForEl(element);
if (target && target.length && !target.attr('skip-smooth-scroll')) {
var targetId = target.attr('id');
var targetSel = null;
if (targetId) {
targetSel = '[id="' + targetId.trim() + '"]';
}
var elData = {
element: element,
options: options,
target: target,
targetSel: options.targetSel || targetSel,
id: (target.attr('id') || '').trim()
};
element.off('click.smooth-scroll tap.smooth-scroll').on('click.smooth-scroll tap.smooth-scroll', function (event) {
if ($(this).data('skip-smooth-scroll') || $(event.target).data('skip-smooth-scroll')) {
return;
}
event.preventDefault();
if (!$(this).data('allow-propagation')) {
event.stopPropagation();
}
scrollItem(elData);
if (elData.options.clickCallback) {
elData.options.clickCallback.call(this, event);
}
});
}
});
};
$.fn.scrollSpy = function (options) {
if (inCustomizer()) {
return;
}
var elements = $(this);
var id = 'spy-' + parseInt(Date.now() * Math.random());
elements.each(function () {
var element = $(this);
var settings = jQuery.extend({
onChange: function onChange() {},
onLeave: function onLeave() {},
clickCallback: function clickCallback() {},
smoothScrollAnchor: false,
offset: 0
}, options);
if (element.is('a') && (element.attr('href') || '').indexOf('#') !== -1) {
var target = getTargetForEl(element);
if (target && !target.attr('skip-scroll-spy')) {
var elData = {
element: element,
options: settings,
target: target,
targetSel: '[id="' + target.attr('id').trim() + '"]',
id: target.attr('id').trim()
};
__toCheckOnScroll.addItem(id, elData);
element.data('scrollSpy', elData);
if (options.smoothScrollAnchor) {
element.smoothScrollAnchor(options);
}
}
}
});
};
function update() {
__toCheckOnScroll.eachCategory(function (items) {
var ordered = items.sort(function (itemA, itemB) {
return itemA.target.offset().top - itemB.target.offset().top;
});
var lastItem = ordered.filter(function (item) {
var scrollY = window.pageYOffset !== undefined ? window.pageYOffset : (document.documentElement || document.body.parentNode || document.body).scrollTop;
return item.target.offset().top <= scrollY + window.innerHeight * 0.25;
}).pop();
ordered.forEach(function (item) {
if (lastItem && item.element.is(lastItem.element)) {
changeUrlHash(item.id, 5);
item.options.onChange.call(item.element);
} else {
item.options.onLeave.call(item.element);
}
});
});
}
function goToCurrentHash() {
var hash = window.location.hash.replace('#', '');
var currentItem = __toCheckOnScroll.all().filter(function (item) {
return item.targetSel === '[id="' + decodeURIComponent(hash).trim() + '"]';
});
$(window).on('load', function () {
if (currentItem.length) {
scrollItem(currentItem[0]);
}
update();
});
}
if (!inCustomizer()) {
$(window).scroll(update);
$(window).bind('smoothscroll.update', update);
$(window).bind('smoothscroll.update', goToCurrentHash);
$(goToCurrentHash);
}
})(jQuery);
/***/ }),
/* 155 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
(function ($, Colibri) {
var className = 'dropdown-menu';
var arrowRightSvg = '';
var arrowDownSvg = '';
var arrowUpSvg = '';
var Component = function Component(element, options) {
this.namespace = className;
this.defaults = {
menuSelector: '.colibri-menu',
offCanvasWrapper: '.colibri-menu-container',
arrowSelector: 'svg.svg-inline--fa',
linkSelector: '.menu-item-has-children > a, .page_item_has_children > a',
menuLinkSelector: ' > .menu-item-has-children > a, > .page_item_has_children > a',
subMenuLinkSelector: ' ul .menu-item-has-children > a, ul .page_item_has_children > a',
$menu: null
};
// Parent Constructor
Colibri.apply(this, arguments);
// Initialization
this.start();
};
Component.prototype = {
start: function start() {
var _this = this;
var $menu = this.$element.find(this.opts.menuSelector).first();
this.opts.$menu = $menu;
this.stop();
this.addListener();
this.addFocusListener();
this.addSvgArrows();
this.addReverseMenuLogic();
/** TODO @catalin table menu logic needs work because it does not work*/
this.addTabletMenuLogic();
$(document).ready(function () {
_this.addMenuScrollSpy($menu);
});
},
stop: function stop() {
this.removeAllSvgArrows();
this.removeListeners();
},
copyLiEventTaA: function copyLiEventTaA(e) {
var tagName = '';
if (e.target && e.target.tagName) {
tagName = e.target.tagName;
}
if (tagName.toLowerCase() === 'a') {
return;
}
var a = $(e.target).find('> a');
a[0].click();
},
addListener: function addListener() {
this.opts.$menu.find('li').on('click', this.copyLiEventTaA);
},
toggleFocus: function toggleFocus(item) {
var enable = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
while (this.opts.$menu[0] !== item) {
if ('li' === item.tagName.toLowerCase()) {
if (!enable) {
item.classList.remove('hover');
} else {
item.classList.add('hover');
}
}
item = item.parentElement;
}
},
addFocusListener: function addFocusListener() {
var _this2 = this;
var links = this.opts.$menu.find('a');
links.on('focus', function (event) {
_this2.toggleFocus(event.currentTarget);
});
links.on('blur', function (event) {
_this2.toggleFocus(event.currentTarget, false);
});
},
addSvgArrows: function addSvgArrows() {
/**
* Some clients had 3 arrows when the page loaded, could not find the cause. Probably the start function was called more times
*then stop function. Because of this the arrows are removed before they are added again
*/
this.removeAllSvgArrows();
var menuType = this.opts.data ? this.opts.data.type ? this.opts.data.type : null : null;
switch (menuType) {
case 'horizontal':
this.addHorizontalMenuSvgArrows();
break;
case 'vertical':
this.addVerticalMenuSvgArrow();
break;
}
},
addHorizontalMenuSvgArrows: function addHorizontalMenuSvgArrows() {
var $menu = this.opts.$menu;
var arrowSelector = this.opts.arrowSelector;
var menuLinkSelector = this.opts.menuLinkSelector;
var subMenuLinkSelector = this.opts.subMenuLinkSelector;
$menu.find(menuLinkSelector).each(function () {
if ($(this).children(arrowSelector).length === 0) {
$(this).append(arrowDownSvg);
// $(this).append(arrowUpSvg);
}
});
$menu.find(subMenuLinkSelector).each(function () {
if ($(this).children(arrowSelector).length === 0) {
$(this).append(arrowRightSvg);
}
});
},
addVerticalMenuSvgArrow: function addVerticalMenuSvgArrow() {
var $menu = this.opts.$menu;
var arrowSelector = this.opts.arrowSelector;
var linkSelector = this.opts.linkSelector;
$menu.find(linkSelector).each(function () {
if ($(this).children(arrowSelector).length === 0) {
$(this).append(arrowRightSvg);
}
});
},
removeAllSvgArrows: function removeAllSvgArrows() {
if (this.opts.$menu) {
this.opts.$menu.find(this.opts.arrowSelector).remove();
}
},
removeListeners: function removeListeners() {
var $menu = this.opts.$menu;
$menu.off('mouseover.navigation');
$menu.find('li').off('click', this.copyLiEventTaA);
this.removeTabletLogic();
},
removeTabletLogic: function removeTabletLogic() {
var $menu = this.opts.$menu;
$menu.off('tap.navigation');
},
addReverseMenuLogic: function addReverseMenuLogic() {
var $menu = this.opts.$menu;
var self = this;
$menu.on('mouseover.navigation', 'li', function () {
$menu.find('li.hover').removeClass('hover');
self.setOpenReverseClass($menu, $(this));
});
},
setOpenReverseClass: function setOpenReverseClass($menu, $item) {
// level 0 - not in dropdown
if (this.getItemLevel($menu, $item) > 0) {
var $submenu = $item.children('ul');
var subItemDoesNotFit = $submenu.length && $item.offset().left + $item.width() + 300 > window.innerWidth;
var parentsAreReversed = $submenu.length && $item.closest('.open-reverse').length;
if (subItemDoesNotFit || parentsAreReversed) {
$submenu.addClass('open-reverse');
} else {
if ($submenu.length) {
$submenu.removeClass('open-reverse');
}
}
}
},
getItemLevel: function getItemLevel($menu, $item) {
var menuSelector = this.opts.menuSelector;
var temp2 = $item.parentsUntil(menuSelector);
var temp = temp2.filter('li');
return temp.length;
},
addTabletMenuLogic: function addTabletMenuLogic() {
var self = this;
var $menu = this.opts.$menu;
if (!this.opts.clickOnLink) {
this.opts.clickOnLink = this.clickOnLink.bind(this);
}
if (!this.opts.clickOnArrow) {
this.opts.clickOnArrow = this.clickOnArrow.bind(this);
}
$menu.off('tap.navigation', this.opts.clickOnArrow);
$menu.on('tap.navigation', 'li.menu-item > a svg', this.opts.clickOnArrow);
$menu.off('tap.navigation', this.opts.clickOnLink);
$menu.on('tap.navigation', 'li.menu-item > a', this.opts.clickOnLink);
},
clickOnLink: function clickOnLink(event) {
var arrowWasClicked = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
var self = this;
var $this = $(event.target);
var $item = $this.closest('li');
var $link = $this.closest('a');
var $menu = this.opts.$menu;
var $submenu = $item.children('ul');
if ($submenu.length) {
if (self.isSelectedItem($item)) {
var href = $link.attr('href');
// do nothing if nothing
if (href.indexOf('#') === 0) {
var anchor = href.replace('#', '').trim();
if (!anchor || !$('#' + anchor).length) {
return;
}
}
event.stopPropagation();
if (arrowWasClicked) {
event.preventDefault();
}
self.deselectItems($menu, $item);
} else {
event.stopPropagation();
event.preventDefault();
self.selectItem($menu, $item);
}
} else {
event.stopPropagation();
if (arrowWasClicked || !arrowWasClicked && self.isSelectedItem($item)) {
event.preventDefault();
}
self.deselectItems($menu, $item);
}
},
clickOnArrow: function clickOnArrow(event) {
this.clickOnLink(event, true);
},
selectItem: function selectItem($menu, $item) {
this.deselectItems($menu, $item);
$item.attr('data-selected-item', true);
this.clearMenuHovers($menu, $item);
$item.addClass('hover');
this.setOpenReverseClass($menu, $item);
var self = this;
$('body').on('tap.navigation-clear-selection', '*', function () {
var $this = jQuery(this);
self.clearSelectionWhenTapOutside($this, $menu);
});
$(window).on('scroll.navigation-clear-selection', function () {
var $this = jQuery(this);
self.clearSelectionWhenTapOutside($this, $menu);
});
},
deselectItems: function deselectItems($menu, $item) {
$item.removeClass('hover');
$menu.find('[data-selected-item]').each(function () {
var $item = $(this);
$item.removeAttr('data-selected-item');
var $submenu = $menu.children('ul');
//TODO @catalin, check if this mobile menu code is needed
if ($menu.is('.mobile-menu')) {
$submenu.slideDown();
}
});
},
isSelectedItem: function isSelectedItem($item) {
return $item.is('[data-selected-item]');
},
clearMenuHovers: function clearMenuHovers($menu, except) {
var self = this;
$menu.find('li.hover').each(function () {
if (except && self.containsSelectedItem($(this))) {
return;
}
$(this).removeClass('hover');
});
},
containsSelectedItem: function containsSelectedItem($item) {
return $item.find('[data-selected-item]').length > 0 || $item.is('[data-selected-item]');
},
clearSelectionWhenTapOutside: function clearSelectionWhenTapOutside($this, $menu) {
$('body').off('tap.navigation-clear-selection');
$(window).off('scroll.navigation-clear-selection');
if ($this.is($menu) || $.contains($menu[0], this)) {
return;
}
this.clearMenuHovers($menu);
},
addMenuScrollSpy: function addMenuScrollSpy(startFrom) {
var $menu = startFrom;
if ($.fn.scrollSpy) {
$menu.find('a').scrollSpy({
onChange: function onChange() {
$menu.find(' > .current-menu-item, > .current_page_item').removeClass('current-menu-item current_page_item');
$(this).closest('li').addClass('current-menu-item current_page_item');
},
onLeave: function onLeave() {
$(this).closest('li').removeClass('current-menu-item current_page_item');
},
smoothScrollAnchor: true,
offset: function offset() {
//offset is needed only for sticky menu
var $fixed = $menu.closest('.h-navigation_sticky');
if ($fixed.length) {
return $fixed[0].getBoundingClientRect().height;
}
return 0;
}
});
}
$(window).trigger('smoothscroll.update');
}
};
Component.inherits(Colibri);
Colibri[className] = Component;
Colibri.Plugin.create(className);
Colibri.Plugin.autoload(className);
})(jQuery, Colibri);
/***/ }),
/* 156 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _linksDefineSamePage = __webpack_require__(106);
var _linksDefineSamePage2 = _interopRequireDefault(_linksDefineSamePage);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
(function ($, Colibri) {
var className = 'accordion-menu';
var arrowRightSvg = '';
var arrowDownSvg = '';
arrowRightSvg = '
' + arrowRightSvg + '
';
arrowDownSvg = '
' + arrowDownSvg + '
';
var Component = function Component(element, options) {
this.namespace = className;
this.defaults = {
menuSelector: '.colibri-menu',
offCanvasWrapper: '.colibri-menu-container',
linkSelector: '.menu-item-has-children > a, .page_item_has_children > a',
linkLeafsSelector: 'li:not(.menu-item-has-children):not(.page_item_has_children) > a',
arrowSelector: ['.menu-item-has-children > a > .arrow-wrapper, .page_item_has_children > a > .arrow-wrapper', '.menu-item-has-children > a > svg, .page_item_has_children > a > svg'].join(','),
linkSelectorInLink: 'svg',
$menu: null
};
// Parent Constructor
Colibri.apply(this, arguments);
// Initialization
this.initBindedFunctions();
this.initEventListenersData();
this.start();
};
Component.prototype = {
start: function start() {
var $menu = this.$element.find(this.opts.menuSelector).first();
this.opts.$menu = $menu;
this.addSvgArrows();
this.opts.$menu.find('a').data('allow-propagation', true);
this.removeEventListeners();
this.addEventListeners();
this.addFocusListener();
this.addMenuScrollSpy($menu);
},
initBindedFunctions: function initBindedFunctions() {
this.debounceApplyDropdownLogic = $.debounce(this.applyDropdownLogic.bind(this), 10);
this.bindedLinkEventHandler = this.linkEventHandler.bind(this);
this.bindedLinkArrowEventHandler = this.linkArrowEventHandler.bind(this);
},
initEventListenersData: function initEventListenersData() {
var menuNamespace = '.accordion-menu';
var events = ['click', 'tap'];
var eventBase = events.map(function (event) {
return '' + event + menuNamespace;
});
var linkSelectorEvent = eventBase.map(function (item) {
return item + '.link-selector';
}).join(' ');
var arrowSelectorEvent = eventBase.map(function (item) {
return item + '.arrow-selector';
}).join(' ');
var offCanvasEvent = eventBase.map(function (item) {
return item + '.off-canvas';
}).join(' ');
this._eventOptions = {
menuNamespace: menuNamespace,
linkSelectorEvent: linkSelectorEvent,
arrowSelectorEvent: arrowSelectorEvent,
offCanvasEvent: offCanvasEvent
};
},
toggleFocus: function toggleFocus(item) {
while (this.opts.$menu[0] !== item) {
if ('li' === item.tagName.toLowerCase()) {
if (-1 !== item.className.indexOf('hover')) {
item.className = item.className.replace(' hover', '');
} else {
item.className += ' hover';
}
}
item = item.parentElement;
}
},
addFocusListener: function addFocusListener() {
var _this = this;
var links = this.opts.$menu.find('a');
links.on('focus', function (event) {
_this.toggleFocus(event.currentTarget);
});
links.on('blur', function (event) {
_this.toggleFocus(event.currentTarget, false);
});
},
addEventListeners: function addEventListeners() {
var $menu = this.opts.$menu;
var eventOptions = this._eventOptions;
$menu.on(eventOptions.arrowSelectorEvent, this.opts.arrowSelector, this.bindedLinkArrowEventHandler);
if (window.wp && window.wp.customize) {
$menu.off(eventOptions.linkSelectorEvent, this.opts.linkSelector);
}
$menu.on(eventOptions.linkSelectorEvent, this.opts.linkSelector, this.bindedLinkEventHandler);
$menu.on(eventOptions.offCanvasEvent, this.opts.linkLeafsSelector, this.closeOffcanvasPanel);
$(document).on('keyup.' + this.namespace, $.proxy(this.handleKeyboard, this));
},
removeEventListeners: function removeEventListeners() {
var $menu = this.opts.$menu;
var eventOptions = this._eventOptions;
$menu.off(eventOptions.menuNamespace);
$(document).on('keyup.' + this.namespace);
},
stop: function stop() {
this.removeEventListeners();
this.removeAllSvgArrows();
},
handleKeyboard: function handleKeyboard(e) {
var item = e.target;
if ($.contains(this.opts.$menu[0], item)) {
if ($(item).siblings('ul').length) {
if (e.which === 37) {
this.closeDropDown($(item).closest('li'));
}
if (e.which === 39) {
this.openDropDown($(item).closest('li'));
}
}
}
},
openDropDown: function openDropDown(item) {
if (!item) {
return;
}
if ($(item).is('a')) {
item = $(item).closest('li');
} else {
item = $(item);
}
item.addClass('open');
item.children('ul').slideDown(100);
},
closeDropDown: function closeDropDown(item) {
if (!item) {
return;
}
if ($(item).is('a')) {
item = $(item).closest('li');
} else {
item = $(item);
}
item.removeClass('open');
item.children('ul').slideUp(100);
},
isDropDownOpen: function isDropDownOpen($parent) {
return $parent.is('.open');
},
closeOffcanvasPanel: function closeOffcanvasPanel() {
if (window.wp && window.wp.customize) {
return;
}
//some mobile menus do not work without this timeout, because the panel gets hidden before the link logic happens
//and some browser stop the link for security reasons because it got fired from hidden elements.
setTimeout(function () {
$('.offscreen-overlay').trigger('click');
}, 500);
},
linkEventHandler: function linkEventHandler(event, isForArrow) {
var inCustomizer = window.wp && window.wp.customize;
if (inCustomizer) {
event.preventDefault();
}
var $this = $(event.target);
var $li = $this.closest('li');
if (!isForArrow && $li.hasClass('open') && !inCustomizer) {
this.closeOffcanvasPanel();
return;
}
//when the arrows are clicked the link should not redirect you, or when the item li is not opened. also stop
//propagation to the link event handler
if (isForArrow || !isForArrow && !$li.hasClass('open')) {
event.preventDefault();
// do not trigger bubbling events e.g for offcanvas
event.stopPropagation();
}
// event.stopPropagation();
/**
* For mobile devices the event handler function is called two times one for the click event and the other time for
* tap event. Because of this we had to split the logic in things that needs to be called for every call and things
* that needs to be called once when the tap/click events are called at the same time. We use the debounce function
* to apply the dropdown logic only once
*/
this.debounceApplyDropdownLogic(event, isForArrow);
},
linkArrowEventHandler: function linkArrowEventHandler(event) {
this.linkEventHandler(event, true);
},
applyDropdownLogic: function applyDropdownLogic(event, isForArrow) {
var $this = $(event.target);
var $li = $this.closest('li');
if (!($li.hasClass('menu-item-has-children') || $li.hasClass('page_item_has_children'))) {
this.closeOffcanvasPanel();
return;
}
if (isForArrow && this.isDropDownOpen($li)) {
this.closeDropDown($li);
} else {
this.openDropDown($li);
}
},
addSvgArrows: function addSvgArrows() {
var $menu = this.opts.$menu;
var linkSelectorInLink = this.opts.linkSelectorInLink;
$menu.find(this.opts.linkSelector).each(function () {
var _this2 = this;
if ($(this).children(linkSelectorInLink).parent('.arrow-wrapper').length === 0) {
$(this).children(linkSelectorInLink).remove();
$(this).append(arrowRightSvg);
$(this).append(arrowDownSvg);
} else {
if ($(this).children(linkSelectorInLink).length === 0) {
$(this).append(arrowRightSvg);
$(this).append(arrowDownSvg);
}
}
setTimeout(function () {
$(_this2).find('.h-global-transition-disable').removeClass('h-global-transition-disable');
}, 1000);
});
},
removeAllSvgArrows: function removeAllSvgArrows() {
if (this.opts.$menu) {
this.opts.$menu.find(this.opts.arrowSelector).remove();
}
},
addMenuScrollSpy: function addMenuScrollSpy(startFrom) {
var $menu = startFrom;
var _offset = 20;
var component = this;
if ($.fn.scrollSpy) {
var linkSelector = component.opts.linkSelector;
var arrowSelector = component.opts.arrowSelector;
$menu.find('a').not(linkSelector).not(arrowSelector).scrollSpy({
onChange: function onChange() {
$menu.find('.current-menu-item,.current_page_item').removeClass('current-menu-item current_page_item');
$(this).closest('li').addClass('current-menu-item current_page_item');
},
onLeave: function onLeave() {
$(this).closest('li').removeClass('current-menu-item current_page_item');
},
clickCallback: function clickCallback() {
component.closeOffcanvasPanel();
},
smoothScrollAnchor: true,
offset: function offset() {
var $fixed = $menu.closest('[data-colibri-component="navigation"]');
if ($fixed.length) {
return $fixed[0].getBoundingClientRect().height + _offset;
}
return _offset;
}
});
}
$(window).trigger('smoothscroll.update');
}
};
Component.inherits(Colibri);
Colibri[className] = Component;
Colibri.Plugin.create(className);
Colibri.Plugin.autoload(className);
})(jQuery, Colibri);
/***/ }),
/* 157 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
(function ($, Colibri) {
var className = 'navigation';
var Component = function Component(element, options) {
this.namespace = className;
this.defaults = {
data: {
sticky: {
className: 'h-navigation_sticky',
startAfterNode: {
enabled: false,
selector: ''
},
animations: {
enabled: false,
currentInAnimationClass: '',
currentOutAnimationClass: '',
allInAnimationsClasses: '',
allOutAnimationsClasses: '',
duration: 0
},
zIndex: 9999,
responsiveWidth: true,
center: true,
useShrink: true,
toBottom: false,
useNativeSticky: false,
always: false
},
overlap: false,
overlapIsActive: false
}
};
// Parent Constructor
Colibri.apply(this, arguments);
this.computeOverlapPaddingDelayed = jQuery.debounce(this.computeOverlapPadding.bind(this), 10);
//The script still is called two times but now both of the calls pass the check
// if (!this.scriptCallIsValid()) {
// return;
// }
// Initialization
this.start();
};
Component.prototype = {
start: function start() {
var data = {};
if (this.opts.data) {
data = this.opts.data;
}
if (data.sticky) {
this.startSticky(data.sticky);
}
if (data.overlap) {
this.startOverlap();
}
},
//TODO @catalin this is a temporary workaround, until the issue: #0030376 is fixed
scriptCallIsValid: function scriptCallIsValid() {
var isInCustomizer = Colibri.isCustomizerPreview();
if (!isInCustomizer) {
return true;
}
var vueNavSelector = '.h-navigation_outer';
var vueNav = $(this.$element).closest(vueNavSelector).get(0);
if (!vueNav) {
return true;
}
if (vueNav.__vue__) {
return true;
}
return false;
},
startOverlap: function startOverlap() {
var self = this;
var $target = this.$element.closest('[data-colibri-navigation-overlap]');
//for backward compatibility reasons
if ($target.length === 0) {
$target = this.$element;
}
this.overlapTarget = $target.get(0);
this.overlapIsActive = true;
$(window).bind('resize.overlap orientationchange.overlap', this.computeOverlapPaddingDelayed);
window.addResizeListener(this.overlapTarget, this.computeOverlapPaddingDelayed);
self.computeOverlapPadding();
},
stopOverlap: function stopOverlap() {
this.overlapIsActive = false;
if (this.$sheet) {
document.head.removeChild(this.$sheet);
this.$sheet = null;
}
$(window).off('.overlap');
window.removeResizeListener(this.overlapTarget, this.computeOverlapPaddingDelayed);
},
computeOverlapPadding: function computeOverlapPadding() {
if (!this.overlapIsActive) {
return;
}
if (!this.$sheet) {
this.$sheet = document.createElement('style');
document.head.appendChild(this.$sheet);
}
var paddingTop = this.overlapTarget.offsetHeight + 'px !important;';
this.$sheet.innerHTML = '.h-navigation-padding{padding-top:' + paddingTop + '}';
},
startSticky: function startSticky(data) {
var self = this;
this.$element.data('stickData', data);
this.$element.fixTo('body', data);
if (!Colibri.isCustomizerPreview()) {
this.prepareSticky();
}
this.$element.bind('fixto-added.sticky', function () {
self.$element.attr('data-in-sticky-state', true);
});
var navOuter = this.$element.closest('.h-navigation_outer');
this.$element.bind('fixto-add.sticky', function () {
self.clearResetTimeouts();
var navOuter = self.$element.closest('.h-navigation_outer');
navOuter.css('animation-duration', '');
navOuter.css('min-height', navOuter[0].offsetHeight);
});
this.$element.bind('fixto-removed.sticky', function () {
self.$element.removeAttr('data-in-sticky-state');
self.resetParentHeight();
});
$(window).bind('resize.sticky orientationchange.sticky', function () {
setTimeout(self.resizeCallback.bind(self), 50);
});
$(window).trigger('resize.sticky');
},
stopSticky: function stopSticky() {
var instance = this.fixToInstance();
if (instance) {
instance.destroy();
$(window).off('.sticky');
this.$element.removeData('fixto-instance');
this.resetParentHeight();
}
},
resetParentHeight: function resetParentHeight() {
this.clearResetTimeouts();
var navOuter = this.$element.closest('.h-navigation_outer');
var delay = parseFloat(this.$element.css('animation-duration')) * 1000;
navOuter.css('animation-duration', '0s');
this.resetTimeoutHeight = setTimeout(function () {
navOuter.css('min-height', '');
}, 1000);
this.resetTimeoutAnimation = setTimeout(function () {
navOuter.css('animation-duration', '');
}, delay + 50);
},
clearResetTimeouts: function clearResetTimeouts() {
clearTimeout(this.resetTimeoutHeight);
clearTimeout(this.resetTimeoutAnimation);
},
stop: function stop() {
this.stopSticky();
this.stopOverlap();
},
prepareSticky: function prepareSticky() {
var self = this;
this.normal = this.$element.find('[data-nav-normal]');
this.sticky = this.$element.find('[data-nav-sticky]');
this.sticky.find('span[data-placeholder]').each(function () {
$(this).parent().attr('data-placeholder', $(this).attr('data-placeholder'));
$(this).remove();
});
if (!this.sticky.length || !this.sticky.children().length) {
return;
}
this.$element.bind('fixto-added.sticky', function () {
self.moveElementsToSticky();
});
this.$element.bind('fixto-removed.sticky', function () {
self.moveElementsToNormal();
});
},
moveElementsToSticky: function moveElementsToSticky() {
var stickyEls = this.sticky.find('[data-placeholder]');
var self = this;
stickyEls.each(function (index, el) {
$this = $(this);
var type = $this.attr('data-placeholder');
var content = self.normal.find('[data-placeholder-provider=' + type + '] .h-column__content >');
var stickyEquiv = $this;
if (stickyEquiv && content.length) {
$(stickyEquiv).append(content);
}
});
this.normal.hide();
this.sticky.show();
},
moveElementsToNormal: function moveElementsToNormal() {
var stickyEls = this.sticky.find('[data-placeholder]');
var self = this;
stickyEls.each(function (index, el) {
$this = $(this);
var type = $this.attr('data-placeholder');
var content = self.sticky.find('[data-placeholder=' + type + '] >');
var equiv = self.normal.find('[data-placeholder-provider=' + type + '] .h-column__content');
if (equiv && content.length) {
$(equiv).append(content);
}
});
this.normal.show();
this.sticky.hide();
},
fixToInstance: function fixToInstance() {
var data = this.$element.data();
if (data && data.fixtoInstance) {
return data.fixtoInstance;
}
return false;
},
resizeCallback: function resizeCallback() {
if (window.innerWidth < 1024) {
var data = this.$element.data();
var stickData = data.stickData;
if (!stickData) {
return;
}
var fixToInstance = data.fixtoInstance;
if (!fixToInstance) {
return true;
}
if (window.innerWidth <= 767) {
if (!stickData.stickyOnMobile) {
fixToInstance.stop();
}
} else {
if (!stickData.stickyOnTablet) {
fixToInstance.stop();
}
}
} else {
var data = this.$element.data();
if (!data) {
return;
}
var fixToInstance = data.fixtoInstance;
if (!fixToInstance) {
return true;
}
fixToInstance.refresh();
fixToInstance.start();
}
}
};
Component.inherits(Colibri);
Colibri[className] = Component;
Colibri.Plugin.create(className);
Colibri.Plugin.autoload(className);
})(jQuery, Colibri);
/***/ }),
/* 158 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
(function ($, window, document) {
// Start Computed Style. Please do not modify this module here. Modify it from its own repo. See address below.
/*! Computed Style - v0.1.0 - 2012-07-19
* https://github.com/bbarakaci/computed-style
* Copyright (c) 2012 Burak Barakaci; Licensed MIT */
var computedStyle = function () {
var computedStyle = {
getAll: function getAll(element) {
return document.defaultView.getComputedStyle(element);
},
get: function get(element, name) {
return this.getAll(element)[name];
},
toFloat: function toFloat(value) {
return parseFloat(value, 10) || 0;
},
getFloat: function getFloat(element, name) {
return this.toFloat(this.get(element, name));
},
_getAllCurrentStyle: function _getAllCurrentStyle(element) {
return element.currentStyle;
}
};
if (document.documentElement.currentStyle) {
computedStyle.getAll = computedStyle._getAllCurrentStyle;
}
return computedStyle;
}();
// End Computed Style. Modify whatever you want to.
var mimicNode = function () {
/*
Class Mimic Node
Dependency : Computed Style
Tries to mimick a dom node taking his styles, dimensions. May go to his repo if gets mature.
*/
function MimicNode(element) {
this.element = element;
this.replacer = document.createElement('div');
this.replacer.style.visibility = 'hidden';
this.hide();
element.parentNode.insertBefore(this.replacer, element);
}
MimicNode.prototype = {
replace: function replace() {
var rst = this.replacer.style;
var styles = computedStyle.getAll(this.element);
// rst.width = computedStyle.width(this.element) + 'px';
// rst.height = this.element.offsetHeight + 'px';
// Setting offsetWidth
rst.width = this._width();
rst.height = this._height();
// Adopt margins
rst.marginTop = styles.marginTop;
rst.marginBottom = styles.marginBottom;
rst.marginLeft = styles.marginLeft;
rst.marginRight = styles.marginRight;
// Adopt positioning
rst.cssFloat = styles.cssFloat;
rst.styleFloat = styles.styleFloat; //ie8;
rst.position = styles.position;
rst.top = styles.top;
rst.right = styles.right;
rst.bottom = styles.bottom;
rst.left = styles.left;
// rst.borderStyle = styles.borderStyle;
rst.display = styles.display;
},
hide: function hide() {
this.replacer.style.display = 'none';
},
_width: function _width() {
return this.element.getBoundingClientRect().width + 'px';
},
_widthOffset: function _widthOffset() {
return this.element.offsetWidth + 'px';
},
_height: function _height() {
return jQuery(this.element).outerHeight() + 'px';
},
_heightOffset: function _heightOffset() {
return this.element.offsetHeight + 'px';
},
destroy: function destroy() {
$(this.replacer).remove();
// set properties to null to break references
for (var prop in this) {
if (this.hasOwnProperty(prop)) {
this[prop] = null;
}
}
}
};
var bcr = document.documentElement.getBoundingClientRect();
if (!bcr.width) {
MimicNode.prototype._width = MimicNode.prototype._widthOffset;
MimicNode.prototype._height = MimicNode.prototype._heightOffset;
}
return {
MimicNode: MimicNode,
computedStyle: computedStyle
};
}();
// Class handles vendor prefixes
function Prefix() {
// Cached vendor will be stored when it is detected
this._vendor = null;
//this._dummy = document.createElement('div');
}
Prefix.prototype = {
_vendors: {
webkit: {
cssPrefix: '-webkit-',
jsPrefix: 'Webkit'
},
moz: {
cssPrefix: '-moz-',
jsPrefix: 'Moz'
},
ms: {
cssPrefix: '-ms-',
jsPrefix: 'ms'
},
opera: {
cssPrefix: '-o-',
jsPrefix: 'O'
}
},
_prefixJsProperty: function _prefixJsProperty(vendor, prop) {
return vendor.jsPrefix + prop[0].toUpperCase() + prop.substr(1);
},
_prefixValue: function _prefixValue(vendor, value) {
return vendor.cssPrefix + value;
},
_valueSupported: function _valueSupported(prop, value, dummy) {
// IE8 will throw Illegal Argument when you attempt to set a not supported value.
try {
dummy.style[prop] = value;
return dummy.style[prop] === value;
} catch (er) {
return false;
}
},
/**
* Returns true if the property is supported
* @param {string} prop Property name
* @returns {boolean}
*/
propertySupported: function propertySupported(prop) {
// Supported property will return either inine style value or an empty string.
// Undefined means property is not supported.
return document.documentElement.style[prop] !== undefined;
},
/**
* Returns prefixed property name for js usage
* @param {string} prop Property name
* @returns {string|null}
*/
getJsProperty: function getJsProperty(prop) {
// Try native property name first.
if (this.propertySupported(prop)) {
return prop;
}
// Prefix it if we know the vendor already
if (this._vendor) {
return this._prefixJsProperty(this._vendor, prop);
}
// We don't know the vendor, try all the possibilities
var prefixed;
for (var vendor in this._vendors) {
prefixed = this._prefixJsProperty(this._vendors[vendor], prop);
if (this.propertySupported(prefixed)) {
// Vendor detected. Cache it.
this._vendor = this._vendors[vendor];
return prefixed;
}
}
// Nothing worked
return null;
},
/**
* Returns supported css value for css property. Could be used to check support or get prefixed value string.
* @param {string} prop Property
* @param {string} value Value name
* @returns {string|null}
*/
getCssValue: function getCssValue(prop, value) {
// Create dummy element to test value
var dummy = document.createElement('div');
// Get supported property name
var jsProperty = this.getJsProperty(prop);
// Try unprefixed value
if (this._valueSupported(jsProperty, value, dummy)) {
return value;
}
var prefixedValue;
// If we know the vendor already try prefixed value
if (this._vendor) {
prefixedValue = this._prefixValue(this._vendor, value);
if (this._valueSupported(jsProperty, prefixedValue, dummy)) {
return prefixedValue;
}
}
// Try all vendors
for (var vendor in this._vendors) {
prefixedValue = this._prefixValue(this._vendors[vendor], value);
if (this._valueSupported(jsProperty, prefixedValue, dummy)) {
// Vendor detected. Cache it.
this._vendor = this._vendors[vendor];
return prefixedValue;
}
}
// No support for value
return null;
}
};
var prefix = new Prefix();
// We will need this frequently. Lets have it as a global until we encapsulate properly.
var transformJsProperty = prefix.getJsProperty('transform');
// Will hold if browser creates a positioning context for fixed elements.
var fixedPositioningContext;
// Checks if browser creates a positioning context for fixed elements.
// Transform rule will create a positioning context on browsers who follow the spec.
// Ie for example will fix it according to documentElement
// TODO: Other css rules also effects. perspective creates at chrome but not in firefox. transform-style preserve3d effects.
function checkFixedPositioningContextSupport() {
var support = false;
var parent = document.createElement('div');
var child = document.createElement('div');
parent.appendChild(child);
parent.style[transformJsProperty] = 'translate(0)';
// Make sure there is space on top of parent
parent.style.marginTop = '10px';
parent.style.visibility = 'hidden';
child.style.position = 'fixed';
child.style.top = 0;
document.body.appendChild(parent);
var rect = child.getBoundingClientRect();
// If offset top is greater than 0 meand transformed element created a positioning context.
if (rect.top > 0) {
support = true;
}
// Remove dummy content
document.body.removeChild(parent);
return support;
}
// It will return null if position sticky is not supported
var nativeStickyValue = prefix.getCssValue('position', 'sticky');
// It will return null if position fixed is not supported
var fixedPositionValue = prefix.getCssValue('position', 'fixed');
// Dirty business
var ie = navigator.appName === 'Microsoft Internet Explorer';
var ieversion;
if (ie) {
ieversion = parseFloat(navigator.appVersion.split('MSIE')[1]);
}
function FixTo(child, parent, options) {
this.child = child;
this._$child = $(child);
this.parent = parent;
this.options = {
className: 'fixto-fixed',
startAfterNode: {
enabled: false,
selector: ''
},
animations: {
enabled: false,
currentInAnimationClass: '',
currentOutAnimationClass: '',
allInAnimationsClasses: '',
allOutAnimationsClasses: '',
duration: 0
},
top: 0,
zIndex: ''
};
this._setOptions(options);
this._initAnimations();
}
FixTo.prototype = {
// Returns the total outerHeight of the elements passed to mind option. Will return 0 if none.
_mindtop: function _mindtop() {
var top = 0;
if (this._$mind) {
var el;
var rect;
var height;
for (var i = 0, l = this._$mind.length; i < l; i++) {
el = this._$mind[i];
rect = el.getBoundingClientRect();
if (rect.height) {
top += rect.height;
} else {
var styles = computedStyle.getAll(el);
top += el.offsetHeight + computedStyle.toFloat(styles.marginTop) + computedStyle.toFloat(styles.marginBottom);
}
}
}
return top;
},
_updateOutAnimationDuration: function _updateOutAnimationDuration() {
var animationDuration = this.options.animations.duration;
if (isNaN(animationDuration)) {
animationDuration = 0;
}
this._animationDuration = animationDuration;
},
_initAnimations: function _initAnimations() {
var animations = this.options.animations;
this._$child.removeClass(animations.allInAnimationsClasses);
this._$child.removeClass(animations.allOutAnimationsClasses);
var self = this;
this._updateOutAnimationDuration();
this._animationOutDebounce = $.debounce(function () {
self._$child.removeClass(self.options.animations.allOutAnimationsClasses);
self._inOutAnimation = false;
self._unfix();
self._removeTransitionFromOutAnimation();
}, 100);
this._animationInDebounce = $.debounce(function () {
self._inInAnimation = false;
self._$child.removeClass(self.options.animations.allInAnimationsClasses);
}, this._animationDuration);
},
_removeTransitionFromOutAnimation: function _removeTransitionFromOutAnimation() {
var noTransitionClass = 'h-global-transition-disable';
this._$child.addClass(noTransitionClass);
var childTransitionDuration = this._$child.css('transition-duration');
var isNumberRegex = /\d+/;
var transitionDurationInS = childTransitionDuration.match(isNumberRegex)[0];
if (!transitionDurationInS) {
transitionDurationInS = 0;
}
var transitionDurationInMs = transitionDurationInS * 1000;
var transitionBuffer = 500;
var transitionDuration = transitionDurationInMs + transitionBuffer;
var self = this;
setTimeout(function () {
if (!self._$child) {
return;
}
self._$child.removeClass(noTransitionClass);
}, transitionDuration);
},
_passedStartAfterNode: function _passedStartAfterNode() {
var $startAfterNode = this._$startAfterNode;
if ($startAfterNode && $startAfterNode.length > 0) {
var offsetTop = this._afterElementOffsetTop;
var height = $startAfterNode.outerHeight();
return this._scrollTop > offsetTop + height;
}
return true;
},
// Public method to stop the behaviour of this instance.
stop: function stop() {
this._stop();
this._running = false;
},
// Public method starts the behaviour of this instance.
start: function start() {
// Start only if it is not running not to attach event listeners multiple times.
if (!this._running) {
this._start();
this._running = true;
}
},
//Public method to destroy fixto behaviour
destroy: function destroy() {
this.stop();
this._destroy();
// Remove jquery data from the element
this._$child.removeData('fixto-instance');
// set properties to null to break references
for (var prop in this) {
if (this.hasOwnProperty(prop)) {
this[prop] = null;
}
}
},
_setOptions: function _setOptions(options) {
$.extend(true, this.options, options);
if (this.options.mind) {
this._$mind = $(this.options.mind);
}
if (this.options.startAfterNode.enabled && this.options.startAfterNode.selector) {
this._$startAfterNode = $(this.options.startAfterNode.selector);
}
},
setOptions: function setOptions(options) {
this._setOptions(options);
this.refresh();
},
// Methods could be implemented by subclasses
_stop: function _stop() {},
_start: function _start() {},
_destroy: function _destroy() {},
refresh: function refresh() {}
};
// Class FixToContainer
function FixToContainer(child, parent, options) {
/** FIXME If you have a saved navigation with sticky, when you enter the page, this class creates two objects
* and because of that there are two events listeners. There should be only one instance of this class for each
* navigation
*/
//The script still is called two times but now both of the calls pass the check
// if (!child || !this._scriptCallIsValid(child)) {
// return;
// }
FixTo.call(this, child, parent, options);
this._replacer = new mimicNode.MimicNode(child);
this._ghostNode = this._replacer.replacer;
this._saveStyles();
this._saveViewportHeight();
// Create anonymous functions and keep references to register and unregister events.
this._proxied_onscroll = this._bind(this._onscroll, this);
this._proxied_onresize = this._bind(this._onresize, this);
this.start();
}
FixToContainer.prototype = new FixTo();
$.extend(FixToContainer.prototype, {
// Returns an anonymous function that will call the given function in the given context
_bind: function _bind(fn, context) {
return function () {
return fn.call(context);
};
},
// at ie8 maybe only in vm window resize event fires everytime an element is resized.
_toresize: ieversion === 8 ? document.documentElement : window,
//TODO @catalin this is a temporary workaround, until the issue: #0030376 is fixed
_scriptCallIsValid: function _scriptCallIsValid(child) {
var isInCustomizer = Colibri.isCustomizerPreview();
if (!isInCustomizer) {
return true;
}
var vueNavSelector = '.h-navigation_outer';
var vueNav = $(child).closest(vueNavSelector).get(0);
if (!vueNav) {
return true;
}
if (vueNav.__vue__) {
return true;
}
return false;
},
_onscroll: function _onscroll() {
/**
* TODO @catalin, now sometimes the child height is 0, other times is correct that ruins the out animation logic,
* until that is fixed this is a workaround to that problem. When the child height will always be correct remove
* this condition.
*/
this._scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
this._parentBottom = this.parent.offsetHeight + this._fullOffset('offsetTop', this.parent);
if (this.options.startAfterNode && !this._passedStartAfterNode()) {
if (this.fixed && !this._inOutAnimation) {
this._unfixFromScrollListener();
}
return;
}
// if (this.options.mindBottomPadding !== false) {
// this._parentBottom -= computedStyle.getFloat(this.parent, 'paddingBottom');
// }
// if (this.options.toBottom) {
// this._fix();
// this._adjust();
// return
// }
// if (this.options.toBottom) {
// this.options.top = this._viewportHeight - computedStyle.toFloat(computedStyle.getAll(this.child).height) - this.options.topSpacing;
// }
if (!this.fixed) {
var childStyles = computedStyle.getAll(this.child);
if (this._scrollTop < this._parentBottom && this._scrollTop > this._fullOffset('offsetTop', this.child) - this.options.top - this._mindtop() && this._viewportHeight > this.child.offsetHeight + computedStyle.toFloat(childStyles.marginTop) + computedStyle.toFloat(childStyles.marginBottom) || this.options.toBottom) {
this._fix();
this._adjust();
}
} else {
if (this.options.toBottom) {
if (this._scrollTop >= this._fullOffset('offsetTop', this._ghostNode)) {
this._unfixFromScrollListener();
return;
}
} else {
if (this._scrollTop > this._parentBottom || this._scrollTop <= this._fullOffset('offsetTop', this._ghostNode) - this.options.top - this._mindtop()) {
this._unfixFromScrollListener();
return;
}
}
this._adjust();
}
},
_adjust: function _adjust() {
var top = 0;
var mindTop = this._mindtop();
var diff = 0;
var childStyles = computedStyle.getAll(this.child);
var context = null;
if (fixedPositioningContext) {
// Get positioning context.
context = this._getContext();
if (context) {
// There is a positioning context. Top should be according to the context.
top = Math.abs(context.getBoundingClientRect().top);
}
}
diff = this._parentBottom - this._scrollTop - (this.child.offsetHeight + computedStyle.toFloat(childStyles.marginBottom) + mindTop + this.options.top);
if (diff > 0) {
diff = 0;
}
if (this.options.toBottom) {
// this.child.style.top = (diff + mindTop + top + this.options.top) - computedStyle.toFloat(childStyles.marginTop) + 'px';
} else {
var _top = this.options.top;
if (_top === 0) {
_top = $('body').offset().top;
}
this.child.style.top = Math.round(diff + mindTop + top + _top - computedStyle.toFloat(childStyles.marginTop)) + 'px';
}
},
// Calculate cumulative offset of the element.
// Optionally according to context
_fullOffset: function _fullOffset(offsetName, elm, context) {
var offset = elm[offsetName];
var offsetParent = elm.offsetParent;
// Add offset of the ascendent tree until we reach to the document root or to the given context
while (offsetParent !== null && offsetParent !== context) {
offset = offset + offsetParent[offsetName];
offsetParent = offsetParent.offsetParent;
}
return offset;
},
// Get positioning context of the element.
// We know that the closest parent that a transform rule applied will create a positioning context.
_getContext: function _getContext() {
var parent;
var element = this.child;
var context = null;
var styles;
// Climb up the treee until reaching the context
while (!context) {
parent = element.parentNode;
if (parent === document.documentElement) {
return null;
}
styles = computedStyle.getAll(parent);
// Element has a transform rule
if (styles[transformJsProperty] !== 'none') {
context = parent;
break;
}
element = parent;
}
return context;
},
_fix: function _fix() {
var child = this.child;
var childStyle = child.style;
var childStyles = computedStyle.getAll(child);
var left = child.getBoundingClientRect().left;
var width = childStyles.width;
this._$child.trigger('fixto-add');
this._saveStyles();
if (document.documentElement.currentStyle) {
// Function for ie<9. When hasLayout is not triggered in ie7, he will report currentStyle as auto, clientWidth as 0. Thus using offsetWidth.
// Opera also falls here
width = child.offsetWidth;
if (childStyles.boxSizing !== 'border-box') {
width = width - (computedStyle.toFloat(childStyles.paddingLeft) + computedStyle.toFloat(childStyles.paddingRight) + computedStyle.toFloat(childStyles.borderLeftWidth) + computedStyle.toFloat(childStyles.borderRightWidth));
}
width += 'px';
}
// Ie still fixes the container according to the viewport.
if (fixedPositioningContext) {
var context = this._getContext();
// if(context) {
// // There is a positioning context. Left should be according to the context.
// left = child.getBoundingClientRect().left - context.getBoundingClientRect().left;
// } else {
left = this._$child.offset().left;
// }
}
this._replacer.replace();
childStyle.left =
/*left + "px"; */left - computedStyle.toFloat(childStyles.marginLeft) + 'px';
childStyle.width = width;
childStyle.position = 'fixed';
if (this.options.toBottom) {
childStyle.top = '';
childStyle.bottom = this.options.top + computedStyle.toFloat(childStyles.marginBottom) + 'px';
} else {
childStyle.bottom = '';
var _top = this.options.top;
if (_top === 0) {
_top = $('body').offset().top;
}
childStyle.top = this._mindtop() + _top - computedStyle.toFloat(childStyles.marginTop) + 'px';
}
if (this.options.zIndex) {
this.child.style.zIndex = this.options.zIndex;
}
this._$child.addClass(this.options.className);
var animations = this.options.animations;
this._$child.removeClass(animations.allInAnimationsClasses);
if (animations.enabled) {
this._$child.addClass(animations.currentInAnimationClass);
if (!this._inInAnimation) {
this._inInAnimation = true;
this._animationInDebounce();
}
}
this.fixed = true;
this._$child.trigger('fixto-added');
},
_unfixFromScrollListener: function _unfixFromScrollListener() {
this._$child.trigger('fixto-unnfix-from-scroll');
if (this.options.animations.enabled) {
this._unfixTriggerAnimation();
} else {
this._unfix();
}
},
_getAfterElementOffsetTop: function _getAfterElementOffsetTop() {
var $node = this._$startAfterNode;
var defaultValue = 0;
if ($node && $node.length > 0) {
var elem = $node.get(0);
var distance = 0;
do {
// Increase our distance counter
distance += elem.offsetTop;
// Set the element to it's parent
elem = elem.offsetParent;
} while (elem);
distance = distance < defaultValue ? defaultValue : distance;
return distance;
}
return defaultValue;
},
_unfix: function _unfix() {
this._replacer.hide();
var childStyle = this.child.style;
childStyle.position = this._childOriginalPosition;
childStyle.top = this._childOriginalTop;
childStyle.bottom = this._childOriginalBottom;
childStyle.width = this._childOriginalWidth;
childStyle.left = this._childOriginalLeft;
childStyle.zIndex = this._childOriginalZIndex;
if (!this.options.always) {
this._$child.removeClass(this.options.className);
this._$child.trigger('fixto-removed');
}
this.fixed = false;
},
_unfixTriggerAnimation: function _unfixTriggerAnimation() {
this._$child.trigger('fixto-animated-remove');
this._animationInDebounce.flush();
var animations = this.options.animations;
this._$child.removeClass(animations.allInAnimationsClasses);
this._$child.removeClass(animations.allOutAnimationsClasses);
if (animations.enabled) {
this._$child.addClass(animations.currentOutAnimationClass);
}
this._inOutAnimation = true;
this._animationOutDebounce();
},
_saveStyles: function _saveStyles() {
this._animationOutDebounce.flush();
var childStyle = this.child.style;
this._childOriginalPosition = childStyle.position;
if (this.options.toBottom) {
this._childOriginalTop = '';
this._childOriginalBottom = childStyle.bottom;
} else {
this._childOriginalTop = childStyle.top;
this._childOriginalBottom = '';
}
this._childOriginalWidth = childStyle.width;
this._childOriginalLeft = childStyle.left;
this._childOriginalZIndex = childStyle.zIndex;
this._afterElementOffsetTop = this._getAfterElementOffsetTop();
},
_onresize: function _onresize() {
this.refresh();
},
_saveViewportHeight: function _saveViewportHeight() {
// ie8 doesn't support innerHeight
this._viewportHeight = window.innerHeight || document.documentElement.clientHeight;
},
_stop: function _stop() {
// Unfix the container immediately.
this._unfix();
// remove event listeners
$(window).unbind('scroll.fixto mousewheel', this._proxied_onscroll);
$(this._toresize).unbind('resize.fixto', this._proxied_onresize);
},
_start: function _start() {
// Trigger onscroll to have the effect immediately.
this._onscroll();
// Attach event listeners
$(window).bind('scroll.fixto mousewheel', this._proxied_onscroll);
$(this._toresize).bind('resize.fixto', this._proxied_onresize);
},
_destroy: function _destroy() {
// Destroy mimic node instance
this._replacer.destroy();
},
refresh: function refresh() {
this._saveViewportHeight();
this._unfix();
this._onscroll();
}
});
function NativeSticky(child, parent, options) {
FixTo.call(this, child, parent, options);
this.start();
}
NativeSticky.prototype = new FixTo();
$.extend(NativeSticky.prototype, {
_start: function _start() {
var childStyles = computedStyle.getAll(this.child);
this._childOriginalPosition = childStyles.position;
this._childOriginalTop = childStyles.top;
this.child.style.position = nativeStickyValue;
this.refresh();
},
_stop: function _stop() {
this.child.style.position = this._childOriginalPosition;
this.child.style.top = this._childOriginalTop;
},
refresh: function refresh() {
this.child.style.top = this._mindtop() + this.options.top + 'px';
}
});
var fixTo = function fixTo(childElement, parentElement, options) {
if (nativeStickyValue && !options || nativeStickyValue && options && options.useNativeSticky !== false) {
// Position sticky supported and user did not disabled the usage of it.
return new NativeSticky(childElement, parentElement, options);
} else if (fixedPositionValue) {
// Position fixed supported
if (fixedPositioningContext === undefined) {
// We don't know yet if browser creates fixed positioning contexts. Check it.
fixedPositioningContext = checkFixedPositioningContextSupport();
}
return new FixToContainer(childElement, parentElement, options);
} else {
return 'Neither fixed nor sticky positioning supported';
}
};
/*
No support for ie lt 8
*/
if (ieversion < 8) {
fixTo = function fixTo() {
return 'not supported';
};
}
// Let it be a jQuery Plugin
$.fn.fixTo = function (targetSelector, options) {
var $targets = $(targetSelector);
var i = 0;
return this.each(function () {
// Check the data of the element.
var instance = $(this).data('fixto-instance');
// If the element is not bound to an instance, create the instance and save it to elements data.
if (!instance) {
$(this).data('fixto-instance', fixTo(this, $targets[i], options));
} else {
// If we already have the instance here, expect that targetSelector parameter will be a string
// equal to a public methods name. Run the method on the instance without checking if
// it exists or it is a public method or not. Cause nasty errors when necessary.
var method = targetSelector;
instance[method].call(instance, options);
}
i++;
});
};
/*
Expose
*/
return {
FixToContainer: FixToContainer,
fixTo: fixTo,
computedStyle: computedStyle,
mimicNode: mimicNode
};
})(window.jQuery, window, document);
/***/ }),
/* 159 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
(function ($, Colibri) {
var className = 'overlap';
var Component = function Component(element, options) {
this.namespace = className;
this.defaults = {
data: {}
};
// Parent Constructor
Colibri.apply(this, arguments);
// Initialization
this.start();
};
Component.prototype = {
start: function start() {
var self = this;
$(window).bind('resize.overlap orientationchange.overlap', function () {
setTimeout(self.resizeCallback.bind(self), 50);
});
self.resizeCallback();
},
stop: function stop() {
$(window).off('.overlap');
if (this.$sheet) {
document.head.removeChild(this.$sheet);
this.$sheet = null;
}
},
computePadding: function computePadding() {
if (!this.$sheet) {
this.$sheet = document.createElement('style');
document.head.appendChild(this.$sheet);
}
var paddingTop = this.$element[0].getBoundingClientRect().height + 'px !important;';
this.$sheet.innerHTML = '.h-navigation-padding{padding-top:' + paddingTop + '}';
},
resizeCallback: function resizeCallback() {
this.computePadding();
}
};
Component.inherits(Colibri);
Colibri[className] = Component;
Colibri.Plugin.create(className);
Colibri.Plugin.autoload(className);
})(jQuery, Colibri);
/***/ }),
/* 160 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
(function ($, Colibri) {
var className = 'masonry';
var Component = function Component(element, options) {
this.namespace = className;
this.defaults = {};
// Parent Constructor
Colibri.apply(this, arguments);
this.bindedRestart = $.debounce(this.restart.bind(this), 50);
this.start();
};
function attributeExistsAndFalse($node, attrName) {
if ($node[0].hasAttribute(attrName) && $node.attr(attrName) != 'true') {
return true;
}
}
function showMasonry($node) {
// check for old version of masonry, atribute not used anymore//
if (attributeExistsAndFalse($node, 'data-show-masonry') || attributeExistsAndFalse($node, 'show-masonry')) {
return false;
}
return true;
}
Component.prototype = {
start: function start() {
var masonry = this.$element;
if (this.opts.data && this.opts.data.targetSelector) {
masonry = this.$element.find(this.opts.data.targetSelector);
}
this.$masonry = masonry;
if (!showMasonry(this.$element)) {
return;
}
this.$masonry.masonry({
itemSelector: '.masonry-item',
columnWidth: '.masonry-item',
percentPosition: true
});
this.addEventListeners();
(function () {
var images = masonry.find('img');
var loadedImages = 0;
var completed = 0;
function imageLoaded() {
loadedImages++;
if (images.length === loadedImages) {
try {
masonry.data().masonry.layout();
} catch (e) {
console.error(e);
}
}
}
images.each(function () {
if (this.complete) {
completed++;
imageLoaded();
} else {
$(this).on('load', imageLoaded);
$(this).on('error', imageLoaded);
}
});
if (images.length !== completed) {
if (document.readyState == 'complete') {
setTimeout(function () {
masonry.data().masonry.layout();
}, 10);
}
}
$(window).on('load', function () {
masonry.data().masonry.layout();
});
})();
},
stop: function stop() {
this.removeEventListeners();
try {
this.$masonry.masonry('destroy');
} catch (e) {}
},
restart: function restart() {
this.stop();
this.start();
},
addEventListeners: function addEventListeners() {
this.$element.on('colibriContainerOpened', this.bindedRestart);
},
removeEventListeners: function removeEventListeners() {
this.$element.off('colibriContainerOpened', this.bindedRestart);
},
loadImages: function loadImages() {}
};
Component.inherits(Colibri);
Colibri[className] = Component;
Colibri.Plugin.create(className);
Colibri.Plugin.autoload(className);
})(jQuery, Colibri);
/***/ }),
/* 161 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _keys = __webpack_require__(162);
var _keys2 = _interopRequireDefault(_keys);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
(function ($, Colibri) {
var className = 'footer-parallax';
var Component = function Component(element, options) {
var _this = this;
this.namespace = className;
this.defaults = {
activeClasses: {
header: 'h-footer-parallax-header-class',
content: 'h-footer-parallax-content-class',
footer: 'h-footer-parallax',
container: 'new-stacking-context'
},
selectors: {
header: ' > .page-header,> .header',
content: '> .page-content,> .content',
container: '#page-top'
}
};
this.bindedResizeListener = $.debounce(this.resizeListener.bind(this), 100);
// Parent Constructor
Colibri.apply(this, arguments);
// Initialization
this.scriptStarted = false;
this.initMediaById();
this.start();
window.addResizeListener(this.$element.get(0), this.bindedResizeListener);
//sometimes the size in the preview is not correct, so i force a refresh to have the correct content margin bottom
setTimeout(function () {
_this.bindedResizeListener();
}, 5000);
};
Component.prototype = {
start: function start() {
this.scriptStarted = true;
this.isEnabled = this.$element.attr('data-enabled');
//backward compatible with the version with no attribute
this.isEnabled = this.isEnabled !== undefined ? this.isEnabled == 'true' : true;
if (this.getCurrentMedia() !== 'desktop' || !this.isEnabled) {
return;
}
var selectors = this.opts.selectors;
var activeClasses = this.opts.activeClasses;
this.$container = $(selectors.container);
this.$content = this.$container.find(selectors.content).first();
this.$header = this.$container.find(selectors.header).first();
this.$container.addClass(activeClasses.container);
this.$header.addClass(activeClasses.header);
this.$content.addClass(activeClasses.content);
this.$element.addClass(activeClasses.footer);
this.updateSiblingStyle();
},
stop: function stop() {
this.scriptStarted = false;
var activeClasses = this.opts.activeClasses;
if (!this.$container) {
return;
}
this.$container.removeClass(activeClasses.container);
this.$header.removeClass(activeClasses.header);
this.$content.removeClass(activeClasses.content);
this.$element.removeClass(activeClasses.footer);
this.$content.css('margin-bottom', '');
},
restart: function restart() {
this.stop();
this.start();
},
resizeListener: function resizeListener() {
// if (!this.resizeInited) {
// this.resizeInited = true;
// return;
// }
this.updateSiblingStyle();
if (this.getCurrentMedia() !== 'desktop') {
this.stop();
} else {
if (this.isEnabled && !this.footerParallaxStarted()) {
this.start();
}
}
},
footerParallaxStarted: function footerParallaxStarted() {
return this.scriptStarted;
},
initMediaById: function initMediaById() {
this.mediaById = {
desktop: {
min: 1024
},
tablet: {
min: 768,
max: 1023
},
mobile: {
max: 767
}
};
},
isDragging: function isDragging() {
return !!document.querySelector('body.h-ui-dragging');
},
getCurrentMedia: function getCurrentMedia() {
var _this2 = this;
var windowWidth = window.innerWidth;
var media = null;
(0, _keys2.default)(this.mediaById).forEach(function (mediaId) {
var limits = _this2.mediaById[mediaId];
if ((!limits.min || limits.min && windowWidth >= limits.min) && (!limits.max || limits.max && windowWidth <= limits.max)) {
media = mediaId;
}
});
return media;
},
updateSiblingStyle: function updateSiblingStyle() {
if (!this.$content) {
return;
}
if (!this.footerParallaxStarted()) {
return;
}
var footerHeight = this.$element.outerHeight();
this.$content.css('margin-bottom', footerHeight + 'px');
}
};
Component.inherits(Colibri);
Colibri[className] = Component;
Colibri.Plugin.create(className);
Colibri.Plugin.autoload(className);
})(jQuery, Colibri);
/***/ }),
/* 162 */
/***/ (function(module, exports, __webpack_require__) {
module.exports = { "default": __webpack_require__(163), __esModule: true };
/***/ }),
/* 163 */
/***/ (function(module, exports, __webpack_require__) {
__webpack_require__(164);
module.exports = __webpack_require__(3).Object.keys;
/***/ }),
/* 164 */
/***/ (function(module, exports, __webpack_require__) {
// 19.1.2.14 Object.keys(O)
var toObject = __webpack_require__(41);
var $keys = __webpack_require__(20);
__webpack_require__(90)('keys', function () {
return function keys(it) {
return $keys(toObject(it));
};
});
/***/ }),
/* 165 */
/***/ (function(module, exports) {
// removed by extract-text-webpack-plugin
/***/ }),
/* 166 */
/***/ (function(module, exports) {
// removed by extract-text-webpack-plugin
/***/ }),
/* 167 */
/***/ (function(module, exports) {
// removed by extract-text-webpack-plugin
/***/ }),
/* 168 */
/***/ (function(module, exports) {
// removed by extract-text-webpack-plugin
/***/ }),
/* 169 */
/***/ (function(module, exports) {
// removed by extract-text-webpack-plugin
/***/ })
/******/ ]);