/******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) { /******/ return installedModules[moduleId].exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ i: moduleId, /******/ l: false, /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ /******/ // Flag the module as loaded /******/ module.l = true; /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /******/ /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; /******/ /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; /******/ /******/ // define getter function for harmony exports /******/ __webpack_require__.d = function(exports, name, getter) { /******/ if(!__webpack_require__.o(exports, name)) { /******/ Object.defineProperty(exports, name, { /******/ configurable: false, /******/ enumerable: true, /******/ get: getter /******/ }); /******/ } /******/ }; /******/ /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = function(module) { /******/ var getter = module && module.__esModule ? /******/ function getDefault() { return module['default']; } : /******/ function getModuleExports() { return module; }; /******/ __webpack_require__.d(getter, 'a', getter); /******/ return getter; /******/ }; /******/ /******/ // Object.prototype.hasOwnProperty.call /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; /******/ /******/ // __webpack_public_path__ /******/ __webpack_require__.p = ""; /******/ /******/ // Load entry module and return exports /******/ return __webpack_require__(__webpack_require__.s = 26); /******/ }) /************************************************************************/ /******/ ({ /***/ 26: /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.PostitialPromo = void 0; var VideoChecker_1 = __webpack_require__(9); var ImagePlayer_1 = __webpack_require__(5); var PostitialPromo = (function () { function PostitialPromo() { var _this = this; this.currentThumb = 0; this.onVideoEnd = function () { _this.loadNext(); }; this.loadNext = function () { _this.changeThumb(_this.currentThumb + 1); }; this.receiveMessage = function (e) { if (!e || !e.data || !e.data.className) { return; } document.body.className = e.data.className; setParentHeight(); }; this.videoContentEl = document.getElementById('videoContent'); this.videoEl = document.getElementById('videoEl'); if (!this.videoEl) { return; } this.videoEl.setAttribute('loop', 'loop'); this.embedVideo(this.videoEl.getAttribute('src')); window.addEventListener('message', this.receiveMessage, false); if (window.parent) { window.parent.postMessage({ getClass: true }, '*'); } onResize(); } PostitialPromo.prototype.changeThumb = function (index) { var activeClass = 'af_active'; var thumbs = document.querySelectorAll('.af_video_thumb'); if (index < 0) { index = thumbs.length - 1; } else if (index >= thumbs.length) { index = 0; } this.currentThumb = index; for (var i = 0; i < thumbs.length; i++) { var thumb = thumbs[i]; thumb.className = thumb.className.replace(activeClass, '').trim(); if (index === i) { thumb.className += " ".concat(activeClass); } } var activeThumb = thumbs[index]; this.updateVideo(activeThumb.getAttribute('data-stream'), activeThumb.getAttribute('data-link')); }; PostitialPromo.prototype.updateVideo = function (stream, url) { this.embedVideo(stream); var linksEl = document.querySelectorAll('.js-clickOverlay'); for (var i = 0; i < linksEl.length; i++) { linksEl[i].setAttribute('href', url); } }; PostitialPromo.prototype.embedVideo = function (stream) { var _this = this; (0, VideoChecker_1.videoAvailableChecker)(this.videoEl, function () { if (stream && _this.videoEl.getAttribute('src') !== stream) { _this.videoEl.setAttribute('src', stream); } }, function () { _this.videoContentEl.className = 'image_player'; new ImagePlayer_1.ImagePlayer(_this.videoContentEl, stream.substr(0, stream.lastIndexOf('/')) + '/thumbs', { frameRatio: 255 / 400 }); }); }; return PostitialPromo; }()); exports.PostitialPromo = PostitialPromo; window.addEventListener('resize', onResize, false); function onResize() { var isStandalone = document.body.className.indexOf('standalone') !== -1; var iMobile = document.body.className.indexOf('mobile') !== -1; if (isStandalone && iMobile) { var width = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth; var height = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight; var isLandscape = width > height; document.body.className = "standalone mobile ".concat(isLandscape ? 'bcpsttl_land' : 'bcpsttl_port'); return; } if (iMobile) { fitTextFontSize('.af_thumbs_btn_inner'); } setParentHeight(); } function setParentHeight() { setTimeout(function () { var gridHeight = document.getElementById('js-grid').offsetHeight; window.parent.postMessage({ gridHeight: gridHeight }, '*'); var overlayWidth = document.getElementById('af_overlay').offsetWidth; if (document.getElementById('bcpsttl_iframe_body').classList.contains('desktop_small')) { document.getElementById('af_container').style.width = (overlayWidth - 16) + 'px'; } else { document.getElementById('af_container').style.width = ''; } }, 100); } function fitTextFontSize(selector, parent, options) { if (parent === void 0) { parent = document.body; } if (options === void 0) { options = { syncSize: false }; } function isFit(el) { return el.scrollWidth <= el.offsetWidth && el.scrollHeight <= el.offsetHeight; } function dichotomy(min, max, el) { if (max - min < 1) { el.style.fontSize = min + 'px'; return min; } else { var mid = (max + min) / 2; el.style.fontSize = mid + 'px'; if (isFit(el)) { return dichotomy(mid, max, el); } else { return dichotomy(min, mid, el); } } } var commonMinFS = Infinity; var elements = parent.querySelectorAll(selector); var i; for (i = 0; i < elements.length; i++) { var el = elements[i]; el.style.fontSize = ''; var fsize = parseInt(window.getComputedStyle(el)['font-size'], 10); commonMinFS = Math.min(commonMinFS, isFit(el) ? fsize : dichotomy(1, fsize, el)); } if (options.syncSize) { for (i = 0; i < elements.length; i++) { elements[i].style.fontSize = commonMinFS + 'px'; } } } window.addEventListener('load', function () { new PostitialPromo(); }); /***/ }), /***/ 5: /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ImagePlayer = void 0; var ImagePlayer = (function () { function ImagePlayer(el, path, options) { this.frameCount = 1; this.loadTimeout = 400; this.el = el; this.el.innerHTML = ''; this.canvasEl = document.createElement('canvas'); this.el.appendChild(this.canvasEl); this.pathToFrames = path; this.imgType = options && options.imgType || 'jpg'; this.frameRatio = options && options.frameRatio || 3 / 4; if (this.pathToFrames) { this.loadFrame(); } } ImagePlayer.prototype.stopRequests = function () { clearTimeout(this.loadTimer); this.pathToFrames = null; }; ImagePlayer.prototype.updatePath = function (path) { clearTimeout(this.loadTimer); this.frameCount = 1; this.pathToFrames = path; if (this.pathToFrames) { this.loadFrame(); } }; ImagePlayer.prototype.loadFrame = function () { var _this = this; var img = new Image(); var stamp = Date.now(); img.onload = function () { _this.drawFrame(img); _this.waitLoadTimeout(Date.now() - stamp); }; img.onerror = function () { if (_this.frameCount === 1) { _this.frameCount++; } else { _this.frameCount = 1; } _this.waitLoadTimeout(Date.now() - stamp); }; img.src = "".concat(this.pathToFrames, "/").concat(this.frameCount, ".").concat(this.imgType); }; ImagePlayer.prototype.waitLoadTimeout = function (loadTime) { var _this = this; if (this.pathToFrames) { clearTimeout(this.loadTimer); this.loadTimer = window.setTimeout(function () { _this.loadFrame(); }, this.loadTimeout - loadTime); } }; ImagePlayer.prototype.drawFrame = function (image) { var displayContext = this.canvasEl.getContext('2d'); this.el.style.width = ''; this.el.style.height = ''; this.el.style.marginLeft = ''; var elWidth = this.el.offsetWidth; var elHeight = this.el.offsetHeight; var newWidth; var newHeight; if (elWidth < elHeight) { newHeight = elHeight; newWidth = elHeight / this.frameRatio; } else { newWidth = elWidth; newHeight = elWidth * this.frameRatio * 1.1; } this.frameCount++; this.canvasEl.width = newWidth; this.canvasEl.height = newHeight; this.el.style.width = "".concat(newWidth, "px"); this.el.style.height = "".concat(newHeight, "px"); if (newWidth > elWidth) { this.el.style.marginLeft = "-".concat((newWidth - elWidth) / 2, "px"); } if (displayContext != null) { try { displayContext.drawImage(image, 0, 0, image.width, image.height, 0, 0, this.el.offsetWidth, this.el.offsetHeight); } catch (e) { } } }; ; return ImagePlayer; }()); exports.ImagePlayer = ImagePlayer; /***/ }), /***/ 9: /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.videoAvailableChecker = void 0; function videoAvailableChecker(videoEl, onAvailable, onError) { if (onAvailable === void 0) { onAvailable = function () { }; } if (onError === void 0) { onError = function () { }; } var ua = navigator.userAgent.toLowerCase(); var isIOS = /ipad|iphone|ipod/.test(ua) && !window['MSStream']; var isIOSPuffin = isIOS && /puffin/.test(ua); var isOldIOS = isIOS && /os (5|6|7|8|9)_/.test(ua); var isUC = /ucbrowser/.test(ua) && !window['MSStream']; var isIE = /trident|msie /.test(ua); if (!videoEl || isUC || isOldIOS || isIOSPuffin) { return onError(); } try { var promise = videoEl.play(); if (isIE) { return onAvailable(); } if (!promise) { return onError(); } promise .then(onAvailable) .catch(function (e) { if (typeof e !== 'string') { e = e.message || e.toString(); } if (e.indexOf('play() request was interrupted') !== -1 || e.indexOf('was aborted') !== -1) { return; } onError(); }); } catch (e) { onError(); } } exports.videoAvailableChecker = videoAvailableChecker; /***/ }) /******/ });