PageSourceSearch

https://newpost.gr/wp-content/themes/newpost/assets/js/script.js?ver=1784541524

js newpost.gr collected 2026-10-02 07:19:11 UTC 9,144 bytes, 276 lines download raw bytes

1jQuery(document).ready(function (jQuery) {
2
3  jQuery("ul.mainmenu li:has(ul)").addClass("sub-menu");
4  jQuery("a.menulinks").click(function (event) {
5    event.preventDefault();
6    var isOpen = !jQuery("body").hasClass("cross");
7    var menu = jQuery(this).siblings(".menu-top-menu-container").find("ul.mainmenu").first();
8
9    jQuery("body").toggleClass("cross", isOpen);
10    jQuery(this).attr("aria-expanded", isOpen ? "true" : "false");
11    menu.stop(true, true).fadeToggle(180);
12    jQuery("ul.mainmenu li.sub-menu ul").slideUp(250);
13    jQuery("a.child-triggerm").attr("aria-expanded", "false").removeClass("active");
14  });
15  jQuery(".mainmenu li.sub-menu > a").after(
16    '<a class="child-triggerm" href="#" role="button" aria-label="Άνοιγμα υπομενού" aria-expanded="false"><span aria-hidden="true"></span></a>'
17  );
18  //jQuery('.mainmenu li.sub-menu > a').after('<a class="arrow"><span></span></a>');
19
20  jQuery(".mainmenu a.child-triggerm").click(function (event) {
21    event.preventDefault();
22    jQuery(this).attr("aria-expanded", jQuery(this).attr("aria-expanded") === "true" ? "false" : "true");
23    jQuery(this)
24      .parent()
25      .siblings("li")
26      .find("a.child-triggerm")
27      .attr("aria-expanded", "false")
28      .removeClass("active");
29    jQuery(this).parent().siblings("li").find("ul").slideUp(250);
30    jQuery(this).next("ul.sub-menu").slideToggle(350);
31    jQuery(this).toggleClass("active");
32  });
33
34  jQuery(window).scroll(function () {
35    if (jQuery(window).scrollTop() >= 150) {
36      jQuery("header").addClass("fixed-header");
37    } else {
38      jQuery("header").removeClass("fixed-header");
39    }
40  });
41
42  jQuery(window).on("scroll", function () {
43    if (jQuery(this).scrollTop() > 150) jQuery(".back-to-top").fadeIn("slow");
44    else jQuery(".back-to-top").fadeOut("slow");
45  });
46
47  jQuery(document).on("click", ".back-to-top", function () {
48    jQuery("html, body").animate(
49      {
50        scrollTop: 0,
51      },
52      800
53    );
54    return false;
55  });
56
57  function initNewspaperSliders(scope) {
58    if (typeof Swiper === "undefined") {
59      return;
60    }
61
62    (scope || document).querySelectorAll(".newspaper-slider").forEach(function (slider) {
63      if (slider.swiper || slider.classList.contains("swiper-initialized")) {
64        return;
65      }
66
67      var wrap = slider.closest(".newspaper-wrap") || slider;
68      new Swiper(slider, {
69        grabCursor: true,
70        simulateTouch: true,
71        touchRatio: 1,
72        slidesPerView: "auto",
73        freeMode: {
74          enabled: true,
75          momentum: true,
76        },
77        spaceBetween: 32,
78        autoplay: {
79          delay: 2500,
80          disableOnInteraction: false,
81          pauseOnMouseEnter: true,
82        },
83        navigation: {
84          nextEl: slider.querySelector(".swiper-button-next") || wrap.querySelector(".swiper-button-next"),
85          prevEl: slider.querySelector(".swiper-button-prev") || wrap.querySelector(".swiper-button-prev"),
86        },
87      });
88    });
89  }
90
91  if (typeof Swiper !== 'undefined') {
92    if (window.matchMedia("(max-width: 700px)").matches) {
93      var swiper = new Swiper(".latest-news", {
94        grabCursor: true,
95        autoHeight: true,
96        autoplay: {
97          delay: 2500,
98          disableOnInteraction: false,
99        },
100        pagination: {
101          el: ".swiper-pagination",
102        },
103      });
104
105      var swiper = new Swiper(".economy-slider", {
106        grabCursor: true,
107        autoplay: {
108          delay: 2500,
109          disableOnInteraction: false,
110        },
111        pagination: {
112          el: ".swiper-pagination",
113        },
114      });
115    }
116
117    initNewspaperSliders(document);
118  }
119
120
121  function alignArticleShareRail() {
122    var sections = document.querySelectorAll(".artical-details-section.has-ai-takeaways");
123    sections.forEach(function (section) {
124      var share = section.querySelector(".col-md-1 > .social-details");
125      var takeaways = section.querySelector(".newpost-ai-takeaways");
126      if (!share) {
127        return;
128      }
129
130      if (!takeaways || !window.matchMedia("(min-width: 769px)").matches) {
131        share.style.marginTop = "";
132        share.style.transform = "";
133        return;
134      }
135
136      share.style.marginTop = "";
137      share.style.transform = "";
138      var shareRect = share.getBoundingClientRect();
139      var shareLink = share.querySelector("a");
140      var shareLinkRect = shareLink ? shareLink.getBoundingClientRect() : shareRect;
141      var takeawaysRect = takeaways.getBoundingClientRect();
142      var targetX = Math.round(takeawaysRect.left - shareLinkRect.right);
143      var targetY = Math.round(takeawaysRect.top - shareRect.top + 24);
144      share.style.transform = "translate(" + targetX + "px, " + targetY + "px)";
145    });
146  }
147
148  function setDate() {
149    const options = {
150      weekday: "long",
151      year: "numeric",
152      month: "long",
153      day: "numeric",
154    };
155    options.timeZoneName = "short";
156    const now = new Date();
157    const clock = new Intl.DateTimeFormat("el-GR", {
158      dateStyle: "full",
159      hour12: false,
160      timeStyle: "medium",
161    }).format(now);
162    // const now = new Date().toLocaleDateString("el-GR",options);
163    jQuery("header span.time").text(clock);
164  }
165  setInterval(setDate, 1000);
166
167  setDate();
168  alignArticleShareRail();
169  jQuery(window).on("load resize", alignArticleShareRail);
170
171  jQuery("#newspapercategory").on("change", function () {
172    var value = jQuery(this).val();
173    let catid = jQuery("option:selected", this).attr("catid");
174    // alert(jQuery('option:selected', this).attr('catid'));
175
176    jQuery.ajax({
177      type: "POST",
178      url: "/wp-admin/admin-ajax.php",
179      dataType: "html",
180      data: {
181        action: "filter_newspapers",
182        category: catid,
183      },
184      success: function (res) {
185        // console.log(res);
186        jQuery(".all-newspaper-wrap").html("");
187        jQuery(".all-newspaper-wrap").html(res);
188      },
189    });
190  });
191
192  if (jQuery(".copylink").length > 0) {
193    jQuery(".copylink a").on("click", function () {
194      jQuery(".copylink").addClass("copied");
195      setTimeout(() => {
196        jQuery(".copylink").removeClass("copied");
197      }, 2500);
198    });
199  }
200
201  if (jQuery(".artical-details iframe").length > 0) {
202    // jQuery(".artical-details iframe").each(function () {
203    //   iframeWidth = jQuery(this).width();
204    //   iframeHeight = (314 * iframeWidth) / 560;
205    //   jQuery(this).css("height", iframeHeight + "px");
206    // });
207    jQuery(window).on("scroll", function () {
208      // jQuery(".artical-details iframe").each(function () {
209      //   iframeWidth = jQuery(this).width();
210      //   iframeHeight = (314 * iframeWidth) / 560;
211      //   jQuery(this).css("height", iframeHeight + "px");
212      // });
213    });
214  }
215  if (jQuery(".artical-details").length > 0) {
216    setTimeout(() => {
217      jQuery('div[id^="mwayss"]').insertAfter(jQuery('.artical-details>p:first-child'));
218      jQuery('div[id^="_mwayss"]').insertAfter(jQuery('.artical-details>p:first-child'));
219    }, 4000);
220  }
221  if (jQuery('body').hasClass('page-template-page-road-traffic')) {
222    jQuery('#map').css({ 'min-height': '100vh', 'height': '100%' });
223  }
224
225  function hydrateDeferredHomeSections() {
226    var deferredSections = document.querySelectorAll(".newpost-deferred-home");
227    if (!deferredSections.length) {
228      return;
229    }
230
231    var hydrate = function (section) {
232      if (section.dataset.loaded === "true") {
233        return;
234      }
235
236      var template = section.querySelector("template");
237      if (!template) {
238        return;
239      }
240
241      section.dataset.loaded = "true";
242      section.style.minHeight = "";
243      section.innerHTML = template.innerHTML;
244
245      initNewspaperSliders(section);
246
247      if (typeof Swiper !== "undefined") {
248        jQuery(window).trigger("resize");
249      }
250    };
251
252    if (!("IntersectionObserver" in window)) {
253      deferredSections.forEach(hydrate);
254      return;
255    }
256
257    var observer = new IntersectionObserver(function (entries) {
258      entries.forEach(function (entry) {
259        if (entry.isIntersecting) {
260          observer.unobserve(entry.target);
261          hydrate(entry.target);
262        }
263      });
264    }, { rootMargin: "900px 0px" });
265
266    deferredSections.forEach(function (section) {
267      observer.observe(section);
268    });
269  }
270
271  hydrateDeferredHomeSections();
272
273});
274
275
276window.addEventListener("load",function(){setTimeout(function(){!function(){"use strict";function e(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],c=document.createElement("script");c.src=e,t?c.type="module":(c.async=!0,c.type="text/javascript",c.setAttribute("nomodule",""));var n=document.getElementsByTagName("script")[0];n.parentNode.insertBefore(c,n)}!function(t,c){!function(t,c,n){var a,o,r;n.accountId=c,null!==(a=t.marfeel)&&void 0!==a||(t.marfeel={}),null!==(o=(r=t.marfeel).cmd)&&void 0!==o||(r.cmd=[]),t.marfeel.config=n;var i="https://sdk.mrf.io/statics";e("".concat(i,"/marfeel-sdk.js?id=").concat(c),!0),e("".concat(i,"/marfeel-sdk.es5.js?id=").concat(c),!1)}(t,c,arguments.length>2&&void 0!==arguments[2]?arguments[2]:{})}(window,7940,{})}();},3000);});

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.