var pending_sections = []; var sign_in_translation = 'SIGNED'; var section_threshold = 500; var more_loading = false; var posts_que = window.posts_que || {}; const host = getMainHost(window.location) const CONFIG = { 'epochtimes.com.br': { siteId: 'epochtimes.br', siteIdForSocialApi: 'www.epochtimes.com.br', lang: 'pt', flowId: 'brazil-et' }, 'theepochtimes.com': { siteId: 'es.theepochtimes.com', siteIdForSocialApi: 'es.theepochtimes.com', lang: 'es', flowId: 'live-global', } } window.siteConfig = CONFIG[host] var is_spanish = typeof ntd_language_active !== 'undefined' && 'ntd_spanish' === ntd_language_active; var is_portuguese = typeof ntd_language_active !== 'undefined' && 'ntd_portuguese' === ntd_language_active; if( is_spanish ) { sign_in_translation = 'FIRMARON'; (function (w, d) { w.PushEngage = w.PushEngage || []; w._peq = w._peq || []; PushEngage.push(['init', { appId: '996d32e7c0b26be1057ebc03d9f77ffa' }]); var e = d.createElement('script'); e.src = 'https://clientcdn.pushengage.com/sdks/pushengage-web-sdk.js'; e.async = true; e.type = 'text/javascript'; d.head.appendChild(e); })(window, document); } jQuery.loadAsync = function(url, success_callback) { return jQuery.ajax({ url: url, dataType: "script", cache: true, async: true, success: success_callback || jQuery.noop, }) }; function add_lazy_load_section(selector, callback, threshold) { var offset = jQuery(selector).offset(); if (!offset) return; if (!threshold || threshold < 0) threshold = section_threshold; pending_sections.push({ selector: selector, callback: callback, threshold: threshold }); } $(document).ready(function () { if( $('body.single').length > 0 ) { if( $('body.ntd-video').length > 0 ) { $('.article > .social').after('
'); } else { $('.upper_row > .social_email').after(''); } } if (is_portuguese || is_spanish) { init_paywall_express(); } if (is_portuguese) { var url_path = decodeURI(window.location.pathname); if (url_path.indexOf('epochtimes.com.br') > 0) { var arr_path = url_path.split('epochtimes.com.br'); if (arr_path.length === 2) { url_path = arr_path[1]; } } } if (!is_spanish) { $('#header').after($('#ntd_cookie_bar')); } if ($('#ntd_date').length > 0) { $('#ntd_date').empty().append(met_get_date()); } function met_get_date() { if (typeof (ntd_language_active) != "undefined" && $('body.' + ntd_language_active).length > 0) { if (is_spanish) { moment.locale('es-us'); var value_es = moment().format('dddd, LL'); return value_es.charAt(0).toUpperCase() + value_es.slice(1); } if (is_portuguese) { moment.locale('pt-br'); var value_br = moment().format('dddd, LL'); return value_br.charAt(0).toUpperCase() + value_br.slice(1); } return moment().format('dddd, MMM D, YYYY'); } else { var today = new Date(); var weekday = new Array("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"); var month = new Array("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"); var dd = today.getDate(); var mm = month[today.getMonth()]; var yyyy = today.getFullYear(); weekday = weekday[today.getDay()]; today = weekday + ', ' + mm + ' ' + dd + ', ' + yyyy; return today; } } var page_num = 2; $('#category_load_more span').click(function () { var page_total = $(this).parent().data('page-num'); url = window.location.href; if (page_num <= page_total) { if ($('#category_load_more').hasClass('is_search')) { //url = url.replace('/?s=', ('/page/' + page_num + '/?s=')); url = url.replace('/?s=', ('/search/')); url += '/page/' + page_num; } $.ajax({ type: 'GET', url: url, success: function (data) { page_num++; var content = $(data).find('.article_list ul').html(); if (content) { var location = $('#category_load_more').offset().top - 100; $('.article_list ul').append(content); if (location) { $("body,html").animate({ scrollTop: location }, 800); } } }, complete: function (data) { if (page_num >= page_total) { $('#category_load_more').hide(); } if ($.fn.laziestloader) { $("img.lazy").laziestloader({ threshold: 500 }); } } }); } return false; }); if ($.fn.laziestloader) { $("img.lazy").laziestloader({ threshold: 500 }); $(window).trigger('scroll'); } //resize ratio for video from vhostapi.ntd.tv $.each($('.video_fit_container > iframe, .video_fit_container > div.wp-video, .video_fit_container > div.player-container'), function () { var attr = $(this).attr('data-ratio'); if (!attr) { attr = $(this).siblings('script').attr('data-ratio'); } if (typeof (attr) !== 'undefined' && attr !== false) { $(this).parent('.video_fit_container').css('padding-top', attr); } }); // open links in post content in new window/tab $('.post_content a').each(function () { $(this).attr("target", "_blank"); }); var epoch_gdpr_agreement = localStorage.getItem("epoch_gdpr_agreement"); /* show or hide cookie bar in the bottom of the page * followed French CNIL request * 2. to condition this registration and this access to a prior positive action of the persons concerned; * all the field should be deselect as default. */ if (!is_spanish) { setTimeout(function () { var epoch_gdpr_userid = eet_ymk_userID(); var preferSelectedAll= ['ntd-gdpr-basic,ntd-analytics-storage','ntd-media-storage','ntd-advertisment-storage']; var ntd_storage_prefer = localStorage.getItem('ntd_storage_prefer'); if ( epoch_gdpr_agreement !== '1' ) { $(".cookie-bar").show(); } $(".accept-btn").click(function () { $.ajax({ type: "GET", url: "https://www.youmaker.com/g/log?user=" + epoch_gdpr_userid, complete: function (data) { if ( data.statusText === "OK" || data.statusText === "ok" || data === "ok" || data.responseText === "ok" ) { localStorage.setItem('epoch_gdpr_agreement', '1'); } } }); $(".cookie-bar").slideUp(); return false; }); $("#x_close").click(function () { $(".cookie-bar").slideUp(); return false; }); }, 2000); } var edition = localStorage.getItem("ntd_homepage_edition"); var geo_country = localStorage.getItem('ntd_geo_country') // const edition_countries = ["mx", "es"]; const edition_countries = ["mx"]; if ( epoch_gdpr_agreement !== null && ( typeof( $("body.home.ntd_spanish" )[0] ) != "undefined" )){ if (geo_country === null || typeof(geo_country) === "undefined") { $.ajax({ type: 'GET', url: 'https://pwe.epochbase.com/geo', success: function(res) { if (res.status === 'ok') { localStorage.setItem('ntd_geo_country', res.data.country.toLowerCase()); geo_country = res.data.country; } }, }); } (function() { if (typeof(edition)== "undefined" || edition == null || edition.length < 1) { if (edition_countries.indexOf(geo_country)>-1) { var local_versions = { "mx": ["mx", "mx", "MÉXICO"], // "es": ["es", "es", "España"], }; ntd_show_edition_popup(local_versions[geo_country][0], local_versions[geo_country][1], local_versions[geo_country][2]); } } $(".toprow .language_panel li.esall").click(function() { if (edition_countries.indexOf(edition)<0) return true; localStorage.setItem("backup_homepage_edition", edition); localStorage.setItem("ntd_homepage_edition", "esall"); return true; }); var editionBackup = localStorage.getItem("backup_homepage_edition"); if (document.location.pathname != "/") return true; setTimeout(function() { if ((edition_countries.indexOf(editionBackup)>-1) && edition == "esall") { localStorage.setItem("ntd_homepage_edition", editionBackup ); edition = editionBackup; return true; } }, 5000); })(); } if ($('.premium_programs_home .show_list').length > 0) { var slick_settings = { slidesToShow: 5, slidesToScroll: 5, dots: true, infinite: false, prevArrow: '', nextArrow: '', responsive: [{ breakpoint: 1024, settings: { slidesToShow: 3, slidesToScroll: 3, infinite: true, dots: true } }, { breakpoint: 540, settings: { slidesToShow: 1, slidesToScroll: 1, infinite: true, centerMode: true, dots: true } }] }; $('.premium_programs_home .show_list').slick(slick_settings); } if (typeof ntd_language_active !== 'undefined') { var initEngageCat = ''; if (typeof ntd_page_type === 'undefined') { ntd_page_type = 'home'; } if (ntd_page_type == 'home') { initEngageCat = 'front-page'; } else if (ntd_page_type == 'category') { initEngageCat = ntd_cat_names; } else if (ntd_page_type == 'post') { initEngageCat = ntd_primary_category_name; } } }); /* end document ready */ function ntd_show_edition_popup(geo_country, geo_country_url, geo_country_name) { $("body").append( '