PageSourceSearch

https://www.supertennis.tv/Scripts/adv-masthead-mover.js

js supertennis.tv collected 2026-09-24 09:39:44 UTC 2,075 bytes, 64 lines download raw bytes

1(function () {
2  const BANNER_ID = "adv-gpt-masthead-container1";
3  const mq = window.matchMedia("(min-width: 992px)");
4  let lastIsDesktop = null;
5
6  function getTargets() {
7    return {
8      mobile: document.querySelector(".adv-masthead-mobile .adv-masthead"),
9      desktop: document.querySelector(".adv-masthead-desktop .adv-masthead"),
10    };
11  }
12
13  function getSlotByElementId(elementId) {
14    try {
15      if (!window.googletag || !googletag.pubads) return null;
16      const slots = googletag.pubads().getSlots();
17      for (const s of slots) {
18        if (s.getSlotElementId && s.getSlotElementId() === elementId) return s;
19      }
20    } catch (e) {}
21    return null;
22  }
23
24  function clearIframe(bannerEl) {
25    while (bannerEl.firstChild) bannerEl.removeChild(bannerEl.firstChild);
26    bannerEl.removeAttribute("style");
27    bannerEl.removeAttribute("data-google-query-id");
28  }
29
30  function placeAndRefresh(force) {
31    const banner = document.getElementById(BANNER_ID);
32    if (!banner) return;
33
34    const { mobile, desktop } = getTargets();
35    if (!mobile || !desktop) return;
36
37    const isDesktop = mq.matches;
38    const target = isDesktop ? desktop : mobile;
39
40    if (!force && lastIsDesktop === isDesktop) return;
41    lastIsDesktop = isDesktop;
42
43    const hadIframe = banner.querySelector("iframe");
44    if (hadIframe) clearIframe(banner);
45
46    if (banner.parentNode !== target) target.appendChild(banner);
47
48    if (window.googletag && googletag.cmd) {
49      googletag.cmd.push(function () {
50        const slot = getSlotByElementId(BANNER_ID);
51        if (slot) googletag.pubads().refresh([slot]);
52      });
53    }
54  }
55
56  // init
57  document.addEventListener("DOMContentLoaded", () => placeAndRefresh(true));
58  window.addEventListener("load", () => placeAndRefresh(true));
59  mq.addEventListener("change", () => placeAndRefresh(false));
60
61  // opzionale: se hai DOM che cambia spesso (SPA o template dinamici)
62  // const obs = new MutationObserver(() => placeAndRefresh(false));
63  // obs.observe(document.documentElement, { childList: true, subtree: true });
64})();

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.