diff --git a/assets/js/scripts.js b/assets/js/scripts.js index c4355ba..fdd563b 100644 --- a/assets/js/scripts.js +++ b/assets/js/scripts.js @@ -85,41 +85,27 @@ /******/ /******/ /******/ // Load entry module and return exports -/******/ return __webpack_require__(__webpack_require__.s = 5); +/******/ return __webpack_require__(__webpack_require__.s = "./variations/noto/ts/App.ts"); /******/ }) /************************************************************************/ -/******/ ([ -/* 0 */ -/***/ (function(module, exports) { - -module.exports = jQuery; - -/***/ }), -/* 1 */ -/***/ (function(module, exports) { - -module.exports = _gsScope; +/******/ ({ -/***/ }), -/* 2 */, -/* 3 */, -/* 4 */ -/***/ (function(module, exports) { - -module.exports = imagesLoaded; - -/***/ }), -/* 5 */ +/***/ "./components/base/ts/BaseTheme.ts": +/*!*****************************************!*\ + !*** ./components/base/ts/BaseTheme.ts ***! + \*****************************************/ +/*! exports provided: BaseTheme */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); - -// EXTERNAL MODULE: external "jQuery" -var external_jQuery_ = __webpack_require__(0); -var external_jQuery_default = /*#__PURE__*/__webpack_require__.n(external_jQuery_); - -// CONCATENATED MODULE: ./components/base/ts/services/Helper.ts +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "BaseTheme", function() { return BaseTheme; }); +/* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "jquery"); +/* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var _services_Helper__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./services/Helper */ "./components/base/ts/services/Helper.ts"); +/* harmony import */ var _services_window_service__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./services/window.service */ "./components/base/ts/services/window.service.ts"); +/* harmony import */ var _services_global_service__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./services/global.service */ "./components/base/ts/services/global.service.ts"); +/* harmony import */ var rxjs_operators__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! rxjs/operators */ "./node_modules/rxjs/_esm5/operators/index.js"); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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); } } @@ -127,1252 +113,747 @@ function _defineProperties(target, props) { for (var i = 0; i < props.length; i+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } -var Helper_Helper = + + + + +var BaseTheme = /*#__PURE__*/ function () { - function Helper() { - _classCallCheck(this, Helper); - } + function BaseTheme() { + _classCallCheck(this, BaseTheme); - _createClass(Helper, null, [{ - key: "isTouch", - value: function isTouch() { - // return 'ontouchstart' in window || 'DocumentTouch' in window && document instanceof DocumentTouch; - return 'ontouchstart' in window || 'DocumentTouch' in window; - } - }, { - key: "handleCustomCSS", - value: function handleCustomCSS($container) { - var $elements = typeof $container !== 'undefined' ? $container.find('[data-css]') : external_jQuery_default()('[data-css]'); + this.$body = jquery__WEBPACK_IMPORTED_MODULE_0___default()('body'); + this.$window = jquery__WEBPACK_IMPORTED_MODULE_0___default()(window); + this.$html = jquery__WEBPACK_IMPORTED_MODULE_0___default()('html'); + this.ev = jquery__WEBPACK_IMPORTED_MODULE_0___default()(); + this.frameRendered = false; + this.subscriptionActive = true; + this.$html.toggleClass('is-IE', _services_Helper__WEBPACK_IMPORTED_MODULE_1__["Helper"].getIEversion() && _services_Helper__WEBPACK_IMPORTED_MODULE_1__["Helper"].getIEversion() < 12); + this.bindEvents(); + this.renderLoop(); + } - if ($elements.length) { - $elements.each(function (index, obj) { - var $element = external_jQuery_default()(obj); - var css = $element.data('css'); + _createClass(BaseTheme, [{ + key: "bindEvents", + value: function bindEvents() { + _services_global_service__WEBPACK_IMPORTED_MODULE_3__["GlobalService"].onReady().pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_4__["take"])(1)).subscribe(this.onReadyAction.bind(this)); + _services_window_service__WEBPACK_IMPORTED_MODULE_2__["WindowService"].onLoad().pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_4__["take"])(1)).subscribe(this.onLoadAction.bind(this)); + _services_window_service__WEBPACK_IMPORTED_MODULE_2__["WindowService"].onResize().pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_4__["debounceTime"])(500)).subscribe(this.onResizeAction.bind(this)); + _services_window_service__WEBPACK_IMPORTED_MODULE_2__["WindowService"].onScroll().subscribe(this.onScrollAction.bind(this)); // Leave comments area visible by default and + // show it only if the URL links to a comment - if (typeof css !== 'undefined') { - $element.replaceWith(''); - } - }); + if (window.location.href.indexOf('#comment') === -1) { + jquery__WEBPACK_IMPORTED_MODULE_0___default()('.trigger-comments').removeAttr('checked'); } - } - /** - * Search every image that is alone in a p tag and wrap it - * in a figure element to behave like images with captions - * - * @param $container - */ + this.$window.on('beforeunload', this.fadeOut.bind(this)); + this.ev.on('render', this.update.bind(this)); + } }, { - key: "unwrapImages", - value: function unwrapImages() { - var $container = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : Helper.$body; - $container.find('p > img:first-child:last-child, p > a:first-child:last-child > img').each(function (index, obj) { - var $obj = external_jQuery_default()(obj); - var $image = $obj.closest('img'); - var className = $image.attr('class'); - var $p = $image.closest('p'); - var $figure = external_jQuery_default()('').attr('class', className); - - if (external_jQuery_default.a.trim($p.text()).length) { - return; - } - - $figure.append($image.removeAttr('class')).insertAfter($p); - $p.remove(); - }); + key: "onScrollAction", + value: function onScrollAction() { + this.frameRendered = false; } }, { - key: "wrapEmbeds", - value: function wrapEmbeds() { - var $container = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : Helper.$body; - $container.children('iframe, embed, object').wrap('
'); + key: "onReadyAction", + value: function onReadyAction() { + this.$html.addClass('is-ready'); } - /** - * Initialize video elements on demand from placeholders - * - * @param $container - */ - }, { - key: "handleVideos", - value: function handleVideos() { - var $container = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : Helper.$body; - $container.find('.video-placeholder').each(function (index, obj) { - var $placeholder = external_jQuery_default()(obj); - var video = document.createElement('video'); - var $video = external_jQuery_default()(video).addClass('c-hero__video'); // play as soon as possible - - video.onloadedmetadata = function () { - return video.play(); - }; - - video.src = $placeholder.data('src'); - video.poster = $placeholder.data('poster'); - video.muted = true; - video.loop = true; - $placeholder.replaceWith($video); - }); + key: "onLoadAction", + value: function onLoadAction() { + this.$html.addClass('is-loaded'); + this.fadeIn(); } }, { - key: "smoothScrollTo", - value: function smoothScrollTo() { - var to = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0; - var duration = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1000; - var easing = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'swing'; - external_jQuery_default()('html, body').stop().animate({ - scrollTop: to - }, duration, easing); - } // Returns a function, that, as long as it continues to be invoked, will not - // be triggered. The function will be called after it stops being called for - // N milliseconds. If `immediate` is passed, trigger the function on the - // leading edge, instead of the trailing. - + key: "onResizeAction", + value: function onResizeAction() {} }, { - key: "debounce", - value: function debounce(func, wait, immediate) { - var _this = this, - _arguments = arguments; - - var timeout; - return function () { - var context = _this; - var args = _arguments; - - var later = function later() { - timeout = null; + key: "destroy", + value: function destroy() { + this.subscriptionActive = false; + } + }, { + key: "renderLoop", + value: function renderLoop() { + var _this = this; - if (!immediate) { - func.apply(context, args); - } - }; + if (this.frameRendered === false) { + this.ev.trigger('render'); + } - var callNow = immediate && !timeout; - clearTimeout(timeout); - timeout = setTimeout(later, wait); + requestAnimationFrame(function () { + _this.renderLoop(); - if (callNow) { - func.apply(context, args); - } - }; - } // Returns a function, that, when invoked, will only be triggered at most once - // during a given window of time. Normally, the throttled function will run - // as much as it can, without ever going more than once per `wait` duration; - // but if you'd like to disable the execution on the leading edge, pass - // `{leading: false}`. To disable execution on the trailing edge, ditto. + _this.frameRendered = true; + _this.ev.trigger('afterRender'); + }); + } }, { - key: "throttle", - value: function throttle(callback, limit) { - var wait = false; - return function () { - if (!wait) { - callback(); - wait = true; - setTimeout(function () { - wait = false; - }, limit); - } - }; + key: "update", + value: function update() { + this.backToTop(); } }, { - key: "mq", - value: function mq(direction, query) { - var $temp = external_jQuery_default()('