(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i 0 && this.init(); this._input = null; this._selectBox = null; this._selectedBox = null; }_createClass(RecommendPostWidgetHandle, [{ key: 'init', value: function init() { // event handle this._eventHandle(); // sortable this._sortableHandle(); } /** * handle sortable item * @private */ }, { key: '_sortableHandle', value: function _sortableHandle() { $('.recommend_post_selected_box:not(.ui-sortable)').sortable({ update: function update(ev, ui) { // update recommend posts id var idArr = []; ui.item.parent().children().map(function (k, el) { idArr.push(el.dataset.id); $(el).find('.num').text(k + 1); }); ui.item.parent().parent().find('.recommend_posts').val(idArr.join(',')); ui.item.parents('form').eq(0).find('.widget-control-save').get(0).disabled = false; } }); } /** * update element * @private */ }, { key: '_updateEl', value: function _updateEl( target) { var parent = $(target).parents('.widget-content').eq(0); this._input = parent.find('input.recommend_posts'); this._selectBox = parent.find('.recommend_post_select_box'); this._selectedBox = parent.find('.recommend_post_selected_box'); } /** * event handle * @private */ }, { key: '_eventHandle', value: function _eventHandle() {var _this = this; // search text $(document).on('keydown', '.recommend_post_select', function (ev) { var target = ev.currentTarget; _this._updateEl(target); if (ev.keyCode === 13) { ev.preventDefault(); _this._selectBox.html('Loading....'); _this._searchText(target.value.trim()); return false; } }); // add item $(document).on('click', '.recommend_post_item .dashicons-plus', function (ev) { var parent = $(ev.currentTarget).parent(); var id = parent.get(0).dataset.id; var name = parent.text(); _this._updateEl(parent.parents('form').eq(0).find('.recommend_post_select')); // check have exist var isExist = false; _this._selectedBox.children().map(function (k, el) { if (parseInt(el.dataset.id) === parseInt(id)) { isExist = true; } }); !isExist && _this._addItem(id, name); }); // remove item $(document).on('click', '.recommend_post_item .dashicons-no-alt', function (ev) {return _this._removeItem($(ev.currentTarget).parent());}); // ajax save widget successful $(document).ajaxSuccess(function (e, xhr, settings) { var widget_id_base = 'recommend-post'; if (settings && settings.data && settings.data.search && settings.data.search('action=save-widget') != -1 && settings.data.search('id_base=' + widget_id_base) != -1) { _this._sortableHandle(); } }); } /** * remove item * @private */ }, { key: '_removeItem', value: function _removeItem( item) { this._updateEl(item.parents('form').eq(0).find('.recommend_post_select')); item.parents('form').eq(0).find('.widget-control-save').get(0).disabled = false; // add to input var arr = this._input.val() ? this._input.val().split(',') : []; arr.splice(arr.indexOf(item.get(0).dataset.id), 1); this._input.val(arr.join(',')); item.remove(); } /** * add item * @param id * @param name * @private */ }, { key: '_addItem', value: function _addItem( id, name) { // add to input var arr = this._input.val() ? this._input.val().split(',') : []; arr.push(id); this._input.val(arr.join(',')); this._selectedBox.append('
\n ' + ( this._selectedBox.children().length + 1) + '\n ' + name + '\n \n
'); } /** * handle search text event * @private */ }, { key: '_searchText', value: function _searchText( value) {var _this2 = this; // before $.ajax({ url: window.ajaxurl, type: 'post', data: { action: 'get_posts_by_title', term: value, image_default: '' }, dataType: 'json' }). then(function (data) { if (data.length > 0) { _this2._selectBox.html(''); data.map(function (item, k) { _this2._selectBox.append('
' + item.text + '
'); }); } else { _this2._selectBox.html('Not Fined Post.'); } }); } }]);return RecommendPostWidgetHandle;}();exports.default = RecommendPostWidgetHandle; },{}],2:[function(require,module,exports){ "use strict";Object.defineProperty(exports, "__esModule", { value: true }); var fixedNavbar = function ($) { $(function () { // 页面滚动处理事件 document.addEventListener("scroll", function () { //执行移动端悬浮导航 mobile_fixed_navbar_event(); //执行PC 端悬浮导航 pc_fixed_navbar_event(); }); /** * 移动端悬浮导航处理 */ var m = 0; var mobile_fixed_navbar_event = function mobile_fixed_navbar_event() { //当屏幕小于 1024 即 移动端再执行下面代码 if (window.innerWidth > 1023) return; var $navbar = $(".site-container-wrap .menuMobileBox"); var scrollTop = $(window).scrollTop(); if (scrollTop > m) { if (scrollTop > $navbar.outerHeight() * 1.5) { // console.log($navbar); $navbar.css({ transform: "translateY(-120%)", "transition-delay": "0.15s" }); } m = scrollTop; } else { $navbar.css({ transform: "translateY(0)", "transition-delay": "0.4s" }); m = scrollTop; } }; /** * PC端悬浮导航处理 */ var $pcNavbar = $('nav.nav-secondary'); // 克隆原来的导航 var pc_clone_navbar = function pc_clone_navbar() { if (document.getElementById('navbar-fixed') || window.innerWidth < 1024) return; var navFixed = $(''); navFixed.html($pcNavbar.clone(true)); $('body').append(navFixed); //插入网站logo var host = "https://" + window.location.host; navFixed.find('.wrap').prepend(''); }; var pc_fixed_navbar_event = function pc_fixed_navbar_event() { var $navWarp = $('#navbar-fixed'); //当屏幕大于 1024 即 移动端再执行下面代码 if (window.innerWidth < 1024) return; var scrollTop = $(window).scrollTop(); if (scrollTop > $pcNavbar.outerHeight() * 4) { $navWarp.css({ transform: "translateY(0%)", "transition-delay": "0.15s" }).addClass('_sticky'); $navWarp.find('.logo').addClass('show'); } else { $navWarp.css({ transform: "translateY(-120%)", "transition-delay": "" }).removeClass('_sticky'); $navWarp.find('.logo').removeClass('show'); $navWarp.find('.widget_search').css({ 'display': '' }); } }; /** * @description 封装一个debounce * * @param {Function} fn Function to debounce. * @param {Fn, Number} delay * @return {Function} */ function debounce(fn, delay) {var _arguments = arguments; delay = delay || 240; var debounceTimeout = null; return function () { var args = Array.prototype.slice.apply(_arguments); clearTimeout(debounceTimeout); debounceTimeout = setTimeout(function () { fn.apply(window, args); }, delay); }; } $(window).on('resize', debounce(function () {return pc_clone_navbar();}, 300)).trigger('resize'); //记得用debounce /** * 悬浮导航搜索框显示 */ var $searchBtn = $('.searchBoxInsideNav__button'); $searchBtn.on('click', function (ev) { ev = ev || window.event; if ($('#navbar-fixed').hasClass('_sticky')) { $('#navbar-fixed').find('.widget_search').css({ 'display': 'block' }); } return false; }); // 防止搜索框冒泡 $('.widget_search').on('click', function (ev) { ev = ev || window.event; ev.stopPropagation(); }); $(document).on('click', function () { $('.widget_search').css({ 'display': '' }); }); }); return fixedNavbar; }($);exports.default = fixedNavbar; },{}],3:[function(require,module,exports){ '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;};}();function _classCallCheck(instance, Constructor) {if (!(instance instanceof Constructor)) {throw new TypeError("Cannot call a class as a function");}}var Footer = function () { function Footer() {_classCallCheck(this, Footer); this.$footer = $('#genesis-footer-widgets'); this.$menu = $('.menuMobile'); this.init(); }_createClass(Footer, [{ key: 'init', value: function init() { // create html this._createHtml(); } /** * create html * @private */ }, { key: '_createHtml', value: function _createHtml() { this.$footer.prepend(''); } }]);return Footer;}();exports.default = Footer; },{}],4:[function(require,module,exports){ '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;};}();function _classCallCheck(instance, Constructor) {if (!(instance instanceof Constructor)) {throw new TypeError("Cannot call a class as a function");}} /** * -------------------------------------------------------------------------- * Genesis Tabs (v1.0.0): * Licensed under WTFPL * -------------------------------------------------------------------------- */ window.$ = window.$ ? window.$ : window.jQuery; var GenesisTabs = function ($) { /** * ------------------------------------------------------------------------ * Constants * ------------------------------------------------------------------------ */ var NAME = 'genesis_tabs'; var VERSION = '1.0.0'; var DATA_KEY = 'genesis_tabs'; var JQUERY_NO_CONFLICT = $.fn[NAME]; /** * ------------------------------------------------------------------------ * Class Definition * ------------------------------------------------------------------------ */var GenesisTabs = function () { function GenesisTabs(element) {_classCallCheck(this, GenesisTabs); this._element = $(element); this._nav = this._element.find('.genesis-tabs-nav'); this._content = this._element.find('.genesisTabs__Box'); this.init(); }_createClass(GenesisTabs, [{ key: 'init', value: function init() {var _this = this; this._content.find('img').attr('srcset', ''); // init this._content.on('init', function () { _this._nav.children().eq(0).addClass('active'); _this._nav.children().click(function (ev) { var oTarget = ev.currentTarget; var index = $(oTarget).index(); _this._content.slick('slickGoTo', index); ev.preventDefault(); }); }); // before change this._content.on('beforeChange', function (event, slick, currentSlide, nextSlide) { _this._nav.children().eq(nextSlide).addClass('active').siblings().removeClass('active'); }); // call slick this._content.slick({ infinite: true, slidesToShow: 1, adaptiveHeight: true, slidesToScroll: 1, autoplay: true, autoplaySpeed: 3000, arrows: true, dots: false, prevArrow: '', nextArrow: '' }); } // Static }], [{ key: '_jQueryInterface', value: function _jQueryInterface() { return this.each(function () { var $element = $(this); var data = $element.data(DATA_KEY); if (!data) { data = new GenesisTabs(this); $element.data(DATA_KEY, data); } }); } }]);return GenesisTabs;}(); /** * ------------------------------------------------------------------------ * Data Api implementation * ------------------------------------------------------------------------ */ $(function () {return GenesisTabs._jQueryInterface.call($('.genesisTabs'));}); /** * ------------------------------------------------------------------------ * jQuery * ------------------------------------------------------------------------ */ $.fn[NAME] = GenesisTabs._jQueryInterface; $.fn[NAME].Constructor = GenesisTabs; $.fn[NAME].noConflict = function () { $.fn[NAME] = JQUERY_NO_CONFLICT; return GenesisTabs._jQueryInterface; }; return GenesisTabs; }($);exports.default = GenesisTabs; },{}],5:[function(require,module,exports){ '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;};}();function _classCallCheck(instance, Constructor) {if (!(instance instanceof Constructor)) {throw new TypeError("Cannot call a class as a function");}} /** * Menu */var Menu = function () { function Menu() {_classCallCheck(this, Menu); this.$menu = $('#menu-main'); this.init(); }_createClass(Menu, [{ key: 'init', value: function init() { // create menu html at mobile device this._createHtml(); // event handle this._eventHandle(); } /** * handle for new menu btn click * @private */ }, { key: '_eventHandle', value: function _eventHandle() {var _this = this; this.$input = $('.js-search-text-input'); this.$close = $('.munuMobile__search--close'); $('.menuMobileBox__btn--menu').on('click', function () { // $('#genesis-mobile-nav-secondary').click() $(window).trigger($.Event('menuClick')); }); $('.munuMobile__search').click(function (ev) { if (_this.$input.css('display') === 'none') { _this.$input.fadeIn(function () {return _this.$close.show();}); ev.preventDefault(); } }); this.$close.click(function (ev) { _this.$input.fadeOut(); _this.$close.hide(); }); } /** * create menu html at mobile device */ }, { key: '_createHtml', value: function _createHtml() { var oMenuClone = this.$menu.clone(); var oSearchInput = $('.widget_search input[type="search"]'); var isUsePlaceHolder = oSearchInput.attr('placeholder') ? true : false; var html = ''; $('.site-container-wrap').prepend(html); } }]);return Menu;}();exports.default = Menu; },{}],6:[function(require,module,exports){ '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;};}();function _classCallCheck(instance, Constructor) {if (!(instance instanceof Constructor)) {throw new TypeError("Cannot call a class as a function");}} /** * NewsTabs */var NewsTabs = function () { function NewsTabs() {_classCallCheck(this, NewsTabs); this.init(); }_createClass(NewsTabs, [{ key: 'init', value: function init() { // create menu html at mobile device this._listHtml(); this._createHtml(); this._postSlick(); // this._listTabs() } }, { key: '_listHtml', value: function _listHtml() {var _this = this; $(window).resize(function () { if (window.innerWidth > 1023) { $('.home-middle2 .month').map(function (k, i) { // console.log(k, i); var num = i.dataset.num; var key = '.home-middle2 .month[data-num="' + num + '"]'; // console.log($(key)); // if (window.innerWidth < 1024) return; _this._createHtml(key); }); } }).trigger('resize'); } /** * create menu html at mobile device */ }, { key: '_createHtml', value: function _createHtml( key) { var parWrapThums = $(key + ' .image'); // console.log(parWrapThums); var thums = $(key + ' .thums'); $(thums).html(parWrapThums); var newsTabFn = function newsTabFn(oList, oThums) { var aElem = oList.children(); $(oThums).hide().eq(0).show(); $(aElem).eq(0).addClass('active'); $(aElem).map(function (k, v) { $(v).on('mouseenter', function () { $(aElem).removeClass().eq(k).addClass('active'); $(oThums).hide().eq(k).show(); }); }); }; newsTabFn($(key + ' .news-list'), $(key + ' .thums .image')); } /** * create menu html at mobile device */ }, { key: '_postSlick', value: function _postSlick() { var more = $('.home-bottom .more-from-category'); $(window).resize(function () { if (!$('.js-posts-slick').hasClass('slick-slider') && window.innerWidth > 1023) { $('.js-posts-slick').slick({ infinite: false, responsive: [ { breakpoint: 1023, settings: "unslick" }] }); } }).trigger('resize'); $('.js-posts-slick').on('beforeChange', function (event, slick, currentSlide, nextSlide) { if (!$('.slick-next').hasClass('slick-disabled')) { // console.log(slick.nextArrow); $('.slick-next').html(more.html()); } }); // $('.slick-next').has('slick-disabled') } }, { key: '_listTabs', value: function _listTabs() { (function ($) { $.fn.hoverDelay = function (options) { var defaults = { hoverDuring: 200, outDuring: 200, hoverEvent: function hoverEvent() { $.noop(); }, outEvent: function outEvent() { $.noop(); } }; var sets = $.extend(defaults, options || {}); var hoverTimer, outTimer; return $(this).each(function () { $(this).hover(function () { clearTimeout(outTimer); hoverTimer = setTimeout(sets.hoverEvent, sets.hoverDuring); }, function () { clearTimeout(hoverTimer); outTimer = setTimeout(sets.outEvent, sets.outDuring); }); }); }; })(jQuery); $(".news-list .entry").each(function () { var that = $(this); var id = that.attr("id"); if (id) { that.hoverDelay({ hoverEvent: function hoverEvent() { $(".s1").attr("class", "s2"); that.attr("class", "s1"); $(this).attr("class", "s1"); } }); } else { that.hoverDelay({ outDuring: 1000, hoverEvent: function hoverEvent() { $("#tm").show(); }, outEvent: function outEvent() { $("#tm").hide(); } }); } }); } }]);return NewsTabs;}();exports.default = NewsTabs; },{}],7:[function(require,module,exports){ '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;};}();function _classCallCheck(instance, Constructor) {if (!(instance instanceof Constructor)) {throw new TypeError("Cannot call a class as a function");}} /** * -------------------------------------------------------------------------- * Photo Carousel (v1.0.0): * Licensed under WTFPL * -------------------------------------------------------------------------- */ window.$ = window.$ ? window.$ : window.jQuery; var PhotoCarousel = function ($) { /** * ------------------------------------------------------------------------ * Constants * ------------------------------------------------------------------------ */ var NAME = 'photo_carousel'; var VERSION = '1.0.0'; var DATA_KEY = 'photo_carousel'; var JQUERY_NO_CONFLICT = $.fn[NAME]; /** * ------------------------------------------------------------------------ * Class Definition * ------------------------------------------------------------------------ */var PhotoCarousel = function () { function PhotoCarousel(element) {_classCallCheck(this, PhotoCarousel); this._element = $(element); this._dots = this._element.find('.photo-carousel-content-dots'); this._content = this._element.find('.photo-carousel-content'); this.init(); }_createClass(PhotoCarousel, [{ key: 'init', value: function init() { // delete all image srcset this._content.find('img').attr('srcset', ''); // call slick this._content.slick({ infinite: true, slidesToShow: 1, adaptiveHeight: true, slidesToScroll: 1, autoplay: true, autoplaySpeed: 3000, arrows: true, dots: true, appendDots: this._dots, prevArrow: '', nextArrow: '' }); } // Static }], [{ key: '_jQueryInterface', value: function _jQueryInterface() { return this.each(function () { var $element = $(this); var data = $element.data(DATA_KEY); if (!data) { data = new PhotoCarousel(this); $element.data(DATA_KEY, data); } }); } }]);return PhotoCarousel;}(); /** * ------------------------------------------------------------------------ * Data Api implementation * ------------------------------------------------------------------------ */ $(function () { PhotoCarousel._jQueryInterface.call($('aside .photo-carousel')); window.setTimeout(function () {return $(window).resize();}, 2000); }); /** * ------------------------------------------------------------------------ * jQuery * ------------------------------------------------------------------------ */ $.fn[NAME] = PhotoCarousel._jQueryInterface; $.fn[NAME].Constructor = PhotoCarousel; $.fn[NAME].noConflict = function () { $.fn[NAME] = JQUERY_NO_CONFLICT; return PhotoCarousel._jQueryInterface; }; return PhotoCarousel; }($);exports.default = PhotoCarousel; },{}],8:[function(require,module,exports){ '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;};}();function _classCallCheck(instance, Constructor) {if (!(instance instanceof Constructor)) {throw new TypeError("Cannot call a class as a function");}} /** * Bitter Winter App Topics * @author: Carl * @date: 11/22/2018 * @version 1.0.0 */var BitterWinterApp = function () { function BitterWinterApp() {_classCallCheck(this, BitterWinterApp); this.breakPoints = { pc: 1188, tablet: 768, mobile: 0 }; this.init(); }_createClass(BitterWinterApp, [{ key: 'init', value: function init() { // image slick handle this._imageSlickHandle(); // content slick handle this._contentSlickHandle(); // features slick handle this._featuresSlickInit(); this._featuresSlickMobileHandle(); this._featuresSlickHandle(); // section bg load handle this._sectionBgLoadHandle(); // scroll reveal animate handle this._scrollRevealAnimateHandle(); // handle share box this._handleShareBox(); } /** * handle share box * @private */ }, { key: '_handleShareBox', value: function _handleShareBox() { var sAction = document.getElementById('shareBoxTemplate').innerHTML; $('.downloadApp__Action').html(sAction); var oP = $('.downloadApp__Action>p').eq(0).clone(); $('.downloadApp__Action>p').remove(); $('.downloadApp__Action').parent().prepend(oP.clone()); } /** * scroll reveal animate handle * @private */ }, { key: '_scrollRevealAnimateHandle', value: function _scrollRevealAnimateHandle() { var oSR = window.ScrollReveal({ reset: false, origin: 'bottom', duration: 1000, delay: 0, scale: 1, easing: 'ease-in-out', mobile: false, distance: '40px' }); oSR.reveal('.iphone', { delay: 100 }); oSR.reveal('.content-center', { delay: 0 }); oSR.reveal('.wrapper__section--three>.section-wrapper>h1', { delay: 0 }); oSR.reveal('.wrapper__section--three>.section-wrapper>p', { delay: 200 }); oSR.reveal('.wrapper__section--three>.section-wrapper>.contentSlick', { delay: 400 }); oSR.reveal('.wrapper__section--four>.section-wrapper>h1', { delay: 0 }); oSR.reveal('.wrapper__section--four>.section-wrapper>p', { delay: 200 }); oSR.reveal('.wrapper__section--four .features__box', { delay: 400 }); oSR.reveal('.wrapper__section--five>.section-wrapper>h1', { delay: 0 }); oSR.reveal('.wrapper__section--five>.section-wrapper .downloadApp', { delay: 200 }); } /** * section bg load handle * @private */ }, { key: '_sectionBgLoadHandle', value: function _sectionBgLoadHandle() {var _this = this; $('.coverBg').map(function (k, el) { var randomString = _this.randomString(); var innerWidth = window.innerWidth; var bgImg = ''; var oBg = { pc: el.dataset.coverBgPc, tablet: el.dataset.coverBgTablet, mobile: el.dataset.coverBgMobile // check breakpoints };if (innerWidth >= _this.breakPoints.pc) { bgImg = oBg.pc; } else if (innerWidth >= _this.breakPoints.tablet) { bgImg = oBg.tablet; } else { bgImg = oBg.mobile; } // set class el.classList.add(randomString); // render img _this.renderImgTag(bgImg).then(function (img) { _this.__setCoverBgStyle(oBg, randomString); el.classList.add('coverBgLoaded'); }); }); } /** * set cover bg style * @param oBg * @param randomString * @private */ }, { key: '__setCoverBgStyle', value: function __setCoverBgStyle( oBg, randomString) { this.writeStyle(randomString + 'Style', '\n @media(min-width: ' + this.breakPoints.mobile + 'px){.' + randomString + '::after{background-image: url(\'' + oBg.mobile + '\')}}\n @media(min-width: ' + this.breakPoints.tablet + 'px){.' + randomString + '::after{background-image: url(\'' + oBg.tablet + '\')}}\n @media(min-width: ' + this.breakPoints.pc + 'px){.' + randomString + '::after{background-image: url(\'' + oBg.pc + '\')}}\n '); } /** * features slick handle * @private */ }, { key: '_featuresSlickHandle', value: function _featuresSlickHandle() { var oSlick = $('.features .iphone .featuresSlick'); // slick handle oSlick.slick({ swipe: true, fade: true, dots: false, waitForAnimate: false, // 不等待animate执行结束 arrows: false, pauseOnDotsHover: true, infinite: true, slidesToShow: 1, cssEase: 'ease-out', slidesToScroll: 1, adaptiveHeight: false, // 自动高度取消 autoplay: true, autoplaySpeed: 4000 }). on('beforeChange', function (event, slick, currentSlide, nextSlide) { $('.features .features__item').removeClass('active'); $('.features .features__item[data-index="' + nextSlide + '"]').addClass('active'); }); // click change event handle $('.features .features__item').click(function (ev) { var oTarget = ev.currentTarget; var iIndex = oTarget.dataset.index; oSlick.slick('slickGoTo', iIndex); }); } }, { key: '_featuresSlickInit', value: function _featuresSlickInit() { var iconsArr = ['icon-search', 'icon-access_time', 'icon-mail', 'icon-message', 'icon-thumb_up', 'icon-language']; var oItems = $('.features__box--left .features__item'); oItems.map(function (k, el) {return $(el).prepend('');}); $('.features__box--right').append(oItems.slice(3, 6)); } }, { key: '_featuresSlickMobileHandle', value: function _featuresSlickMobileHandle() { var oDiv = $('
'); oDiv.append($('.features .iphone').clone()); oDiv.append($('
')); $('.features').after(oDiv); var oBox = $('.featuresMobileItemsBox'); $('.features__item').map(function (k, el) {return oBox.append($(el).clone());}); // call slick var oSlick = $('.featuresMobile .iphone .featuresSlick'); var oItems = $('.featuresMobile .featuresMobileItemsBox'); // slick handle oSlick.slick({ swipe: true, fade: true, dots: false, waitForAnimate: false, // 不等待animate执行结束 arrows: true, pauseOnDotsHover: true, infinite: true, slidesToShow: 1, cssEase: 'ease-out', slidesToScroll: 1, adaptiveHeight: false, // 自动高度取消 autoplay: true, autoplaySpeed: 4000, asNavFor: '.featuresMobileItemsBox', prevArrow: '', nextArrow: '' }); oItems.slick({ swipe: false, fade: true, dots: true, arrows: false, slidesToShow: 1, cssEase: 'ease-out', slidesToScroll: 1, adaptiveHeight: true, // 自动高度取消 asNavFor: '.featuresMobile .featuresSlick' }); } /** * content slick handle * @private */ }, { key: '_contentSlickHandle', value: function _contentSlickHandle() { // clone mobile slick var oDiv = $('
'); oDiv.html($('.contentSlick').html()); $('.contentSlick').after(oDiv); $('.contentSlick').slick({ slidesToShow: 3, variableWidth: true, slidesToScroll: 1, swipe: true, dots: false, waitForAnimate: false, // 不等待animate执行结束 arrows: true, infinite: true, cssEase: 'ease-out', adaptiveHeight: false, // 自动高度取消 centerMode: true, focusOnSelect: true, centerPadding: 0, prevArrow: '', nextArrow: '' }); } /** * image slick handle * @private */ }, { key: '_imageSlickHandle', value: function _imageSlickHandle() { $('.imageSlick').slick({ swipe: true, fade: true, dots: false, waitForAnimate: false, // 不等待animate执行结束 arrows: false, pauseOnDotsHover: true, infinite: true, slidesToShow: 1, cssEase: 'ease-out', slidesToScroll: 1, adaptiveHeight: false, // 自动高度取消 autoplay: true, autoplaySpeed: 4000 }); } /** * render Image * @param url * @returns {Promise} */ }, { key: 'renderImgTag', value: function renderImgTag( url) { return new Promise(function (res, rej) { if (url) { var img = new Image(); img.onload = function () { res(img); }; img.onerror = function () { rej(new Error('Could not load image at ' + url)); }; img.src = url; } }); } /** * write style inside head * @param styleClass * @param content */ }, { key: 'writeStyle', value: function writeStyle( styleClass, content) { if ($('.' + styleClass).length === 0) { var oStyleEl = $('') // let oStyle = $('.aside-sticky') var stickySidebar = $("
"); stickySidebar.append(oAside.children()); oAside.append(stickySidebar); $(window).resize(function () { // let left = oContent.offset().left + oContent.outerWidth() // oStyle.html(` // #genesis-sidebar-primary[sticky="stick"]{ // left:${left}px // } // `) if (window.innerWidth < 1030) { isSwitch = false; stickySidebar.trigger('sticky_kit:detach'); } else { if (!isSwitch) { isSwitch = true; setTimeout(function () { stickySidebar.stick_in_parent({ parent: '.content-sidebar-wrap', offset_top: 20, spacer: '' }). on('sticky_kit:stick', function (ev) {return oAside.attr('sticky', 'stick');}). on('sticky_kit:unstick', function (ev) {return oAside.attr('sticky', 'unstick');}). on('sticky_kit:bottom ', function (ev) {return oAside.attr('sticky-bottom', 'bottom');}). on('sticky_kit:unbottom ', function (ev) {return oAside.attr('sticky-bottom', 'unbottom');}); }, 500); } } }).trigger('resize'); } /** * set last update time for header right * @private */ // _setLastUpdateTime () { // let oLastUpdateTime = $('.lastUpdateTime') // // Update : [last_update_time] // let sTemplate = oLastUpdateTime.html() // this._getTimeFormat() // oLastUpdateTime.html(sTemplate.replace('[last_update_time]', this._getTimeFormat(window._lastPostUpdateTime))) // oLastUpdateTime.show().css('opacity', 1) // } /** * print last update time by diff lang * @private */ // _getTimeFormat (time) { // switch (window._siteLang) { // case 'zh-hk': // case 'ko': // case 'ja': // return window.moment(time, 'YYYYMMDD').format('LL'); // break; // case 'en': // case 'it': // case 'fr-ch': // case 'es': // case 'de': // return window.moment(time, 'YYYYMMDD').format('ddd, MMMM D, YYYY'); // break; // default: // return time // break; // } // } /** * set subscribe email widgets input placeholder * @private */ }, { key: "_setPlaceholder", value: function _setPlaceholder() { $('.mc4wp-form').map(function (k, el) { if ($(el).find('#mce-EMAIL').length > 0) { var oInput = $(el).find('#mce-EMAIL'); var placeholderText = oInput.prev().text().trim(); oInput.attr('placeholder', placeholderText); } }); } /** * put entry meta below the entry-content , cuz i dont wanna edit origin theme code * @private */ }, { key: "_moveEntryMetaBelowTheEntryContent", value: function _moveEntryMetaBelowTheEntryContent() { !$(document.body).hasClass('single-post') && $('.entry-meta').map(function (k, el) { var parent = $(el).parent(); if (parent.hasClass('entry-header') && parent.next().hasClass('entry-content')) { parent.next().append(el); } }); } /** * 移动端文章底部广告图切换 add JL 20191207 */ }, { key: "_mobile_post_bottom_ad", value: function _mobile_post_bottom_ad() { var imgMb = $('.donate-us img').data('mb'); var imgPc = $('.donate-us img').attr('src'); $(window).resize(function () { if ($(window).width() < 768) { $('.donate-us img').attr('src', imgMb); } else { $('.donate-us img').attr('src', imgPc); } }).trigger('resize'); } /** * 搜索必须输入内容才能提交 add JL 20191208 */ }, { key: "_search_can_not_empty", value: function _search_can_not_empty() { $('.search-form').find('input[type="submit"]').prop('disabled', true); $('.search-form').find('input[name="s"]').keyup(function () { if ($(this).val().trim() != '') { $('.search-form input[type="submit"]').prop('disabled', false); } }); } /** * 列表页页码处理 */ }, { key: "_list_pagenav", value: function _list_pagenav() { /* $('.archive-pagination ul .screen-reader-text').remove() let lastNum = $('.archive-pagination ul li:nth-last-of-type(2) a').text() let arrLi = $('.archive-pagination ul li') let firstUrl = '' $.map(arrLi,function(v,k) { if($(v).find('a').text() == 1) { firstUrl = $(v).find('a').attr('href'); } }) if ($('.archive-pagination ul li').hasClass('.pagination-next')) { console.log(1); }else{ console.log(2); } */ $('.archive-pagination .pagination-previous a').html(""); $('.archive-pagination .pagination-next a').html(""); /* if (lastNum > 5) { $('.archive-pagination ul').prepend(`
  • `) $('.archive-pagination ul').append(`
  • `) } */ } }]);return NewProModify;}(); $(function () {return new NewProModify();}); },{"./Backend/RecommendPostWidgetHandle.Class":1,"./Module/FixedNavbar.Class":2,"./Module/Footer.Class":3,"./Module/GenesisTabs.Class":4,"./Module/Menu.Class":5,"./Module/NewsTabs.Class":6,"./Module/PhotoCarousel.Class":7,"./Topics/MobileApp/index":8,"./modify/2019-04-18":10,"./modify/2019-06-17":11}],10:[function(require,module,exports){ '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;};}();function _classCallCheck(instance, Constructor) {if (!(instance instanceof Constructor)) {throw new TypeError("Cannot call a class as a function");}} /** * website change of 2019-04-18 */var ModifyTime20190418 = function () { function ModifyTime20190418() {_classCallCheck(this, ModifyTime20190418); this.init(); }_createClass(ModifyTime20190418, [{ key: 'init', value: function init() { if ($('#languageEntries').length > 0) { // add lang entries box this._addLangEntriesBox(); // add search box inside nav this._addSearchBoxInsideNav(); } // pc nav sticky // window.setTimeout(() => this._navSticky(), 1000) } /** * pc nav sticky * @private */ }, { key: '_navSticky', value: function _navSticky() { $(window).on('resize', function (ev) { if (window.innerWidth >= 1040) { $('.genesis-responsive-menu').stick_in_parent(); } else { $('.genesis-responsive-menu').trigger("sticky_kit:detach"); } }).trigger('resize'); } /** * add search box inside nav * @private */ }, { key: '_addSearchBoxInsideNav', value: function _addSearchBoxInsideNav() { // add search btn // window.__translate.search var oSearchBoxInsideNav = $('.searchBoxInsideNav'); oSearchBoxInsideNav.find('.widget_search input[type="submit"]').val(window.__translate.search); $('.searchBoxInsideNav__button').on('click', function (ev) { oSearchBoxInsideNav.find('.widget_search').show(); oSearchBoxInsideNav.find('.search-form-input').focus(); }); $(document).on('click', function (ev) { if ($(ev.target).parents('.searchBoxInsideNav').length === 0 && oSearchBoxInsideNav.find('.widget_search').css('display') === 'block') { oSearchBoxInsideNav.find('.widget_search').hide(); } }); oSearchBoxInsideNav.show(); } /** * lang entries box Handle * @private */ }, { key: '_addLangEntriesBox', value: function _addLangEntriesBox() { $('.site-container-wrap').append('
    ' + $('#languageEntries').html() + '
    '); } }]);return ModifyTime20190418;}();exports.default = ModifyTime20190418; },{}],11:[function(require,module,exports){ '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;};}();function _classCallCheck(instance, Constructor) {if (!(instance instanceof Constructor)) {throw new TypeError("Cannot call a class as a function");}} /** * website change of 2019-06-17 */var ModifyTime20190617 = function () { function ModifyTime20190617() {_classCallCheck(this, ModifyTime20190617); this._tmp = $('#mobileNavChange20190617'); this._el = null; this.$mobileMenu20190617 = null; this.isOpen = false; this.init(); }_createClass(ModifyTime20190617, [{ key: 'init', value: function init() {var _this = this; set_quote(); function set_quote() { var quote_num = $('blockquote').length; // console.log(quote_num); if (quote_num) { for (var i = 0; i < quote_num; i++) { var ele_num = document.getElementsByTagName('blockquote')[i].children.length; var p_text_first = document.getElementsByTagName('blockquote')[i].firstElementChild.innerText; var p_text = document.getElementsByTagName('blockquote')[i].children[ele_num - 1].innerText; // console.log(p_text_first); // p_text_first = '「'+' '+ p_text_first; // console.log(p_text_first); if (window._siteLang == "zh-hk") { p_text = p_text + ' ' + '」'; } else { p_text = p_text + ' ' + '"'; } // document.getElementsByTagName('blockquote')[i].firstElementChild.innerText =p_text_first; document.getElementsByTagName('blockquote')[i].children[ele_num - 1].innerText = p_text; } } } // 190929 add font-size start var dNum = 1; var fontSizeBtn = $('.a-font-size'); var font_h2 = $('.entry-content>h2'); //引导语 var fontEle = $('.entry-content.clearfix'); // 正文 var font_pic = $('.entry-content .wp-caption-text'); //图片标题 var smallBtn = fontSizeBtn.children('.js-font-size-small'); var bigBtn = fontSizeBtn.children('.js-font-size-big'); //引导语 window.defaultFontSize_h2 = parseInt(font_h2.css('fontSize')); window.maxFontSize_h2 = window.defaultFontSize_h2 + 3; window.minFontSize_h2 = window.defaultFontSize_h2 - 3; // 正文 var odefaultFontSize = window.defaultFontSize = parseInt(fontEle.css('fontSize')); window.maxFontSize = window.defaultFontSize + 6; window.minFontSize = window.defaultFontSize - 3; //图片标题 var odefaultFontSize_pic = parseInt(font_pic.css('fontSize')); window.defaultFontSize_pic = parseInt(font_pic.css('fontSize')); window.maxFontSize_pic = window.defaultFontSize_pic + 6; window.minFontSize_pic = window.defaultFontSize_pic - 3; smallBtn.on('click', function () { window.defaultFontSize_h2 -= dNum; window.defaultFontSize_h2 = window.defaultFontSize_h2 < window.minFontSize_h2 ? window.minFontSize_h2 : window.defaultFontSize_h2; font_h2.css('fontSize', window.defaultFontSize_h2); var ochange = window.defaultFontSize <= odefaultFontSize ? 1 : 2; window.defaultFontSize -= ochange; window.defaultFontSize = window.defaultFontSize < window.minFontSize ? window.minFontSize : window.defaultFontSize; fontEle.css('fontSize', window.defaultFontSize); var ochange_pic = window.defaultFontSize_pic <= odefaultFontSize_pic ? 1 : 2; window.defaultFontSize_pic -= ochange_pic; window.defaultFontSize_pic = window.defaultFontSize_pic < window.minFontSize_pic ? window.minFontSize_pic : window.defaultFontSize_pic; font_pic.css('fontSize', window.defaultFontSize_pic); }); bigBtn.on('click', function () { window.defaultFontSize_h2 += dNum; window.defaultFontSize_h2 = window.defaultFontSize_h2 > window.maxFontSize_h2 ? window.maxFontSize_h2 : window.defaultFontSize_h2; font_h2.css('fontSize', window.defaultFontSize_h2); var ochange = window.defaultFontSize < odefaultFontSize ? 1 : 2; window.defaultFontSize += ochange; window.defaultFontSize = window.defaultFontSize > window.maxFontSize ? window.maxFontSize : window.defaultFontSize; fontEle.css('fontSize', window.defaultFontSize); var ochange_pic = window.defaultFontSize_pic < odefaultFontSize_pic ? 1 : 2; window.defaultFontSize_pic += ochange_pic; window.defaultFontSize_pic = window.defaultFontSize_pic > window.maxFontSize_pic ? window.maxFontSize_pic : window.defaultFontSize_pic; font_pic.css('fontSize', window.defaultFontSize_pic); }); // 190929 add font-size end // add svg icon from lang $('.menuMobileBox__btn--lang').append('\n \n \n '); // add site title $('.menuMobileBox__item--left').after('

    ' + $('.site-title').eq(0).html() + '

    '); // create mobile menu if (this._tmp.length > 0) { this._el = $('
    '); this._el.html(this._tmp.html()); this._createMobileMenu(); this.$mobileMenu20190617 = $('.mobileMenu20190617'); this._mobileMenuEventHandle(); $(window).on('menuClick', function (ev) {return _this._menuClickEventHandle();}); $(window).resize(function () { if (window.innerWidth >= 1024) { _this.menuClose(); _this._langEntriesMobileHide(); } _this.calcMenuHeight(); }); } if ($('#languageEntries').length > 0) { // add lang entries in mobile this._langEntriesMobile(); } this._createOverlay(); } /** * add lang entries in mobile * @private */ }, { key: '_langEntriesMobile', value: function _langEntriesMobile() {var _this2 = this; var langsBtn = $('.menuMobileBox__btn--lang'); $('.site-inner .content-sidebar-wrap').append('
    ' + $('#languageEntries').html() + '
    '); langsBtn.on('click', function (ev) { if (langsBtn.hasClass('langsOpen')) { _this2._langEntriesMobileHide(); } else { _this2._langEntriesMobileShow(); } }); } }, { key: '_langEntriesMobileHide', value: function _langEntriesMobileHide() { var section = $('.languageEntriesBoxMobile'); section.removeClass('langsOpen'); $('.menuMobileBox__btn--lang').removeClass('langsOpen'); document.body.classList.remove('mobileMenuOpen'); this.close(); } }, { key: '_langEntriesMobileShow', value: function _langEntriesMobileShow() { var section = $('.languageEntriesBoxMobile'); this.menuClose(); // 计算高度 this.calcMenuHeight(); $('.menuMobileBox__btn--lang').addClass('langsOpen'); section.addClass('langsOpen'); document.body.classList.add('mobileMenuOpen'); this.open(); } /** * menu click event handle * @private */ }, { key: '_menuClickEventHandle', value: function _menuClickEventHandle() { $('.menuMobileBox__btn--menu').toggleClass('menuOpenIcon'); if (this.$mobileMenu20190617.hasClass('menuOpen')) { this.menuClose(); } else { this.menuOpen(); } } }, { key: 'menuClose', value: function menuClose() { $('.menuMobileBox__btn--menu').removeClass('menuOpenIcon'); this.$mobileMenu20190617.removeClass('menuOpen'); document.body.classList.remove('mobileMenuOpen'); this.close(); } }, { key: 'menuOpen', value: function menuOpen() { this._langEntriesMobileHide(); // 计算高度 this.calcMenuHeight(); this.$mobileMenu20190617.addClass('menuOpen'); document.body.classList.add('mobileMenuOpen'); this.open(); // 实现定位 if ($('.current-menu-item').length > 0) { var currentMenuId = $('.current-menu-item').get(0).id; $('.menuBox #' + currentMenuId).addClass('current-menu-item'); } } }, { key: 'calcMenuHeight', value: function calcMenuHeight() { var height = $(window).height() - $('.site-container').offset().top; this.$mobileMenu20190617.css('height', height + 'px'); $('.languageEntriesBoxMobile').css('height', height + 'px'); } // create mobile menu }, { key: '_createMobileMenu', value: function _createMobileMenu() { // create el var el = $('
    '); // add social icon el.append('
    ' + this._el.find('.socialIcon').html() + '
    '); // add subscribe and donate btn el.append('
    ' + this._el.find('.buttons').html() + '
    '); // add menu el.append(''); // add download app btn el.append('
    ' + this._el.find('.downloadBtn').html() + '
    '); $('.site-inner').append(el); } /** * mobile menu event handle * @private */ }, { key: '_mobileMenuEventHandle', value: function _mobileMenuEventHandle() { $('.menuBox .menu-item-has-children').append(''); $('.menuBox .menuArrow').on('click', function (ev) { var currentTarget = $(ev.currentTarget); var parent = currentTarget.parent(); $('.menuBox .childrenOpen').map(function (key, el) { if (el.id != parent.attr('id')) { el.classList.remove('childrenOpen'); } }); $(ev.currentTarget).parent().toggleClass('childrenOpen'); }); } /** * * @private */ }, { key: '_createOverlay', value: function _createOverlay() { var overlay = document.createElement('div'); this._closeBound = this.close.bind(this); overlay.classList.add('sidenav-overlay'); overlay.addEventListener('click', this._closeBound); document.body.appendChild(overlay); this._overlay = overlay; } }, { key: 'open', value: function open() { if (this.isOpen === true) { return; } this.isOpen = true; $(this._overlay).css({ display: 'block', opacity: 1 }); } }, { key: 'close', value: function close() { if (this.isOpen === false) { return; } this.isOpen = false; this._overlay.style.display = 'none'; this.menuClose(); this._langEntriesMobileHide(); } }]);return ModifyTime20190617;}();exports.default = ModifyTime20190617; },{}]},{},[9]) //# sourceMappingURL=news-pro-modify.js.map