PageSourceSearch

https://www.cash-online.de/wp-content/themes/cash-theme/assets/scripts/custom.js?ver=1780330427

js cash-online.de collected 2026-09-24 21:15:23 UTC 41,343 bytes, 1,238 lines download raw bytes

1function selectAndScroll(selektor) {
2  var element = document.querySelector(selektor);
3
4  if (element) {
5    // Zastosowanie czerwonego obramowania
6    element.style.border = "2px solid red";
7
8    // Przewinięcie do elementu
9    element.scrollIntoView({ behavior: "smooth", block: "center" });
10  } else {
11    console.log("Element nie został znaleziony.");
12  }
13}
14
15// Zwraca kontener treści artykułu uwzględniając wrapper TTS
16function getEntryContentContainer() {
17  return document.querySelector(".entry-content .tts_content_wrapper_1") || document.querySelector(".entry-content");
18}
19
20function generateSelectorFromElement(elem) {
21  // W tym przypadku tworzymy selektor na podstawie tagu i klas elementu.
22  // To może nie być idealne dla wszystkich przypadków, ale powinno działać w wielu sytuacjach.
23  return `${elem.tagName.toLowerCase()}${elem.className ? "." + Array.from(elem.classList).join(".") : ""
24    }`;
25}
26
27function reorganizeRelatedTeasers() {
28  // Create empty array for articles
29  var allArticles = [];
30  var promos = [];
31
32  // Find all .post-teaser-group
33  var postTeaserGroups = document.querySelectorAll(
34    ".entry-related-teasers .post-teaser-group"
35  );
36
37  // Loop through all .post-teaser-group
38  for (var i = 0; i < postTeaserGroups.length; i++) {
39    // Find all article
40    var articles = postTeaserGroups[i].querySelectorAll("article");
41
42    // Loop through all articles
43    for (var j = 0; j < articles.length; j++) {
44      if (articles[j].classList.contains("is-promo")) {
45        promos.push(articles[j]);
46      } else {
47        allArticles.push(articles[j]);
48      }
49    }
50  }
51
52  // console.log("allArticles", allArticles);
53  // console.log("promos", promos);
54
55  // Znajdź kontener, do którego chcesz przenieść pierwszy element z klasą .is-promo
56  var targetContainer = document.querySelector(
57    ".entry-most-viewed .post-teaser-group .row"
58  );
59
60  // Jeżeli kontener i promos istnieją, przenieś pierwszy element z klasą .is-promo
61  if (targetContainer && promos.length > 0) {
62    var firstPromo = promos.shift(); // Usuń pierwszy element z tablicy promos
63
64    // Otocz firstPromo elementem div z klasą "col-xs-12 col-sm-6 col-md-4"
65    var column = document.createElement("div");
66    column.className = "col-xs-12 col-sm-6 col-md-4";
67    column.appendChild(firstPromo);
68
69    // Jeśli w targetContainer jest 3 lub więcej dzieci, usuń ostatnie
70    while (targetContainer.children.length >= 3) {
71      targetContainer.removeChild(targetContainer.lastElementChild);
72    }
73
74    // Dodaj firstPromo na początek targetContainer
75    targetContainer.insertBefore(column, targetContainer.firstChild);
76  }
77
78  if (isMobile()) {
79    // Wstaw promos za co drugi paragraph w entry-content
80    var contentContainer = getEntryContentContainer();
81    var entryContentParagraphs = contentContainer.querySelectorAll(":scope > p");
82
83    if (entryContentParagraphs.length && promos.length) {
84      var promoIndex = 0;
85      for (
86        var i = 1;
87        i < entryContentParagraphs.length && promoIndex < promos.length;
88        i += 2
89      ) {
90        var promo = promos[promoIndex];
91        var destinationSelector = generateSelectorFromElement(
92          entryContentParagraphs[i]
93        );
94        moveElement(
95          generateSelectorFromElement(promo),
96          destinationSelector,
97          "after"
98        );
99        promoIndex++;
100      }
101    }
102  } else {
103    const insertPositions = [1, 3, 4, 6, 8];
104    // Wstaw pozostałe elementy z tablicy promos na pozycje zdefiniowane w insertPositions
105    for (var i = 0; i < insertPositions.length; i++) {
106      if (promos[i]) {
107        allArticles.splice(insertPositions[i], 0, promos[i]);
108      }
109    }
110
111    var container = document.querySelector(".entry-related-teasers");
112
113    // Empty container
114    container.innerHTML = "";
115
116    var groupSize = 4; // Number of articles in each group
117    for (var i = 0; i < allArticles.length; i += groupSize) {
118      var group = document.createElement("div");
119      group.className = "post-teaser-group";
120      var row = document.createElement("div");
121      row.className = "row";
122
123      for (var j = i; j < i + groupSize && j < allArticles.length; j++) {
124        if (!allArticles[j]) {
125          j++;
126          if (!allArticles[j]) {
127            continue;
128          }
129        }
130        var column = document.createElement("div");
131        column.className = "col-xs-12 col-sm-6 col-md-6 col-lg-3";
132        column.appendChild(allArticles[j]);
133        row.appendChild(column);
134      }
135
136      group.appendChild(row);
137      container.appendChild(group);
138    }
139  }
140}
141
142function filterArticlesInSection(section, indicesToKeep) {
143  if (section) {
144    let articles = section.querySelectorAll("article.post-teaser");
145
146    articles.forEach((article, index) => {
147      if (!indicesToKeep.includes(index)) {
148        article.remove();
149      }
150    });
151  }
152}
153
154function onResize() {
155  /** Mobile devices */
156  if (isMobile()) {
157    let previousMenuPositionLeft = 0;
158    let currentClickPosition = 0;
159
160    $(".subcategories-menu").on("touchmove", function (event) {
161      let maximum = 0;
162
163      let menuItemsWidth = 0;
164
165      $(".subcategories-menu > *").each(function () {
166        menuItemsWidth += $(this).width();
167      });
168
169      let subcategoriesAmount = $(".subcategories-menu .subcategory").length;
170      let minimum =
171        (menuItemsWidth -
172          $(".subcategories-menu").width() +
173          subcategoriesAmount * 10 +
174          20) *
175        -1;
176
177      let positionLeft = Math.max(
178        Math.min(
179          event.touches[0].clientX -
180          currentClickPosition +
181          previousMenuPositionLeft,
182          maximum
183        ),
184        minimum
185      );
186
187      $(".subcategories-menu").css("left", positionLeft);
188    });
189
190    $(".subcategories-menu").on("touchstart", function (event) {
191      previousMenuPositionLeft = parseInt($(".subcategories-menu").css("left"));
192      currentClickPosition = event.touches[0].clientX;
193    });
194
195    /** Mobile Home Page */
196    if (isHomePage()) {
197      // Multi content box container (direct ancestor of col-aside)
198      const multiContentBox = document.querySelector(".multi-content-box");
199
200      // Section "Latest Articles"
201      const latestArticles = document.querySelector("#latest-articles");
202
203      // Billboard content
204      const billboardContent = document.querySelector(
205        ".promo-area.billboard_content"
206      );
207
208      // Section "Parallax"
209      const parallaxSection = document.querySelector("#parallax-section");
210
211      // Medium rectangle sidebar top
212      const mediumRectangleSidebarTop =
213        document.querySelector(".mrst_homepage");
214
215      // Hero section
216      const heroSection = document.querySelector(".site-section--hero");
217
218      // Category sections
219      const categorySections = document.querySelectorAll(
220        "#main > .site-section--category"
221      );
222
223      // Declare array with indices of articles to keep in each section
224      const indicesForSections = [
225        [0, 1, 4],
226        [0, 1],
227        [0, 1],
228        [0, 1, 2],
229        [0, 1, 2],
230        [0, 1, 2],
231        [0, 1, 2],
232        [0, 1, 2],
233        [0, 1, 2],
234      ];
235
236      categorySections.forEach((section, index) => {
237        if (index < indicesForSections.length) {
238          filterArticlesInSection(section, indicesForSections[index]);
239        }
240      });
241
242      // Latest articles it's always after 4th category
243      if (latestArticles) {
244        moveElement(latestArticles, categorySections[3], "after");
245      }
246
247      let secondArticleInFirstCategory = null;
248
249      // Check if categorySections[0] exists and has at least 2 articles
250      if (
251        categorySections.length > 0 &&
252        categorySections[0].querySelectorAll("article").length >= 2
253      ) {
254        secondArticleInFirstCategory =
255          categorySections[0].querySelectorAll("article")[1];
256      }
257
258      if (secondArticleInFirstCategory && billboardContent) {
259        moveElement(billboardContent, secondArticleInFirstCategory, "before");
260      }
261
262      // Move #parallax-section before 2nd category
263      if (parallaxSection && categorySections[1]) {
264        moveElement(parallaxSection, categorySections[1], "before");
265      }
266
267      // Move .mrst_homepage ater hero section
268      if (mediumRectangleSidebarTop && heroSection) {
269        moveElement(mediumRectangleSidebarTop, heroSection, "after");
270      }
271
272      // Remove margin-bottom from .medium_rectangle_sidebar_top inside mediumRectangleSidebarTop
273      const mediumRectangleSidebarTopInside = mediumRectangleSidebarTop
274        ? mediumRectangleSidebarTop.querySelector(
275          ".medium_rectangle_sidebar_top"
276        )
277        : null;
278      if (mediumRectangleSidebarTopInside) {
279        mediumRectangleSidebarTopInside.style.marginBottom = "8px";
280      }
281    }
282
283    if (isArchivePage()) {
284      let articles = document.querySelectorAll(
285        "#main article.post-teaser:not(.is-promo)"
286      );
287      let promoArticles = document.querySelectorAll(
288        "#main article.post-teaser.is-promo"
289      );
290
291      // Filtrowanie artykułów, aby wykluczyć te, które mają przodka z klasą 'candy_ajax-postlist'
292      articles = Array.from(articles).filter(
293        (article) => !article.closest(".candy_ajax-postlist")
294      );
295      promoArticles = Array.from(promoArticles).filter(
296        (article) => !article.closest(".candy_ajax-postlist")
297      );
298
299      // Sortowanie artykułów na podstawie ich pozycji na stronie
300      articles.sort(
301        (a, b) => a.getBoundingClientRect().top - b.getBoundingClientRect().top
302      );
303      promoArticles.sort(
304        (a, b) => a.getBoundingClientRect().top - b.getBoundingClientRect().top
305      );
306
307      // Dodajemy numerowane kółka do artykułów
308      // articles.forEach((article, index) => {
309      //   console.log("article", article);
310      //   const circle = document.createElement('div');
311      //   circle.className = 'circle';
312      //   circle.innerHTML = index + 1;
313      //   article.insertBefore(circle, article.firstChild);
314      // });
315
316      const multiContentBox = document.querySelector(".multi-content-box");
317      const billboardContent = document.querySelector(".billboard_content");
318
319      // medium_rectangle_content_top from #second-section
320      const mediumRectangleContentTopFromSecondSection = document.querySelector(
321        "#second-section .medium_rectangle_content_top"
322      );
323
324      if (multiContentBox) {
325        moveElement(".multi-content-box", articles[1], "after");
326      } else {
327        moveElement(promoArticles[0], articles[1], "after");
328      }
329
330      if (billboardContent) {
331        moveElement(billboardContent, articles[2], "before");
332      }
333
334      const parallaxMobile = document.querySelector(".parallax_mobile");
335
336      if (parallaxMobile) {
337        moveElement(".parallax_mobile", articles[3], "after");
338      }
339
340      // Between 3rd and 4th article should be medium_rectangle_content_top
341      const mediumRectangleContentTop = document.querySelector(
342        "#third-section .medium_rectangle_content_top"
343      );
344
345      // Move medium_rectangle_content_top after 3rd article
346      if (mediumRectangleContentTop) {
347        // Change to inline-block
348        mediumRectangleContentTop.style.display = "inline-block";
349        // Szerokość 100%
350        mediumRectangleContentTop.style.width = "100%";
351        // Dodaj 16px margin-top
352        mediumRectangleContentTop.style.marginTop = "16px";
353        moveElement(mediumRectangleContentTop, articles[2], "after");
354      }
355
356      // 5th article powinien być po drugim promoArticles
357      if (promoArticles[1] && articles[4]) {
358        moveElement(articles[4], promoArticles[1], "before");
359      }
360
361      const mrsb = document.querySelector(".medium_rectangle_sidebar_bottom");
362      const candyTabsPostlist = document.querySelector(".candy_tabs-postlist");
363
364      // 6th article
365      if (articles[5]) {
366        // Find MRSB and if exist move it after 6th article
367        if (mrsb) {
368          moveElement(".medium_rectangle_sidebar_bottom", articles[5], "after");
369        }
370
371        // Find .candy_tabs-postlist and place it after MRSB if exist or after 6th article
372        if (candyTabsPostlist && mrsb) {
373          moveElement(".candy_tabs-postlist", mrsb, "after");
374        } else if (candyTabsPostlist) {
375          moveElement(".candy_tabs-postlist", articles[5], "after");
376        }
377      }
378
379      // Move 3rd promoArticles before 7th article
380      if (promoArticles[2] && articles[6]) {
381        moveElement(promoArticles[2], articles[6], "before");
382      }
383
384      // After 9 article shold be 4th promoArticles
385      if (promoArticles[3] && articles[8]) {
386        moveElement(promoArticles[3], articles[8], "after");
387      }
388
389      // Move .candy_newsletter_teaser after 10th article
390      const candyNewsletterTeaser = document.querySelector(
391        ".candy_newsletter_teaser"
392      ).parentNode;
393      if (candyNewsletterTeaser && articles[9]) {
394        moveElement(candyNewsletterTeaser, articles[8], "after");
395      }
396
397      // Move articlePromo nr 4 after 8th article
398      if (promoArticles[4] && articles[7]) {
399        moveElement(promoArticles[4], articles[7], "after");
400      }
401
402      // article 10 before promo 5
403      if (articles[9] && candyNewsletterTeaser) {
404        moveElement(articles[9], candyNewsletterTeaser, "after");
405      }
406
407      // If multi-content-box and medium_rectangle_sidebar_bottom exist (we have 9 articles)
408      if (multiContentBox && mrsb) {
409        if (articles[6]) {
410          // Change background color
411          moveElement(
412            promoArticles[promoArticles.length - 1],
413            articles[6],
414            "after"
415          );
416
417          moveElement(
418            promoArticles[promoArticles.length - 2],
419            articles[7],
420            "after"
421          );
422        }
423      }
424
425      // medium rectangle content
426      if (mediumRectangleContentTopFromSecondSection && !mrsb) {
427        moveElement(
428          mediumRectangleContentTopFromSecondSection,
429          articles[2],
430          "after"
431        );
432      }
433
434      // Move .us-advert before .us-sidebar
435      moveElement(".us-advert", ".us-sidebar", "before");
436
437      // Move .candy_tabs-postlist
438      moveElement(".candy_tabs-postlist", "", "before");
439      removePaddingIfNoChildren(
440        ".col-xs-12.col-md-4.col--aside",
441        "2rem 10px 2rem 10px"
442      );
443    }
444
445    if (isArticlePage()) {
446      // Find all paragraphs and filter empty ones
447      let contentContainer = getEntryContentContainer();
448      let paragraphs = contentContainer.querySelectorAll(":scope > p");
449
450      paragraphs.forEach((paragraph) => {
451        if (paragraph.textContent.trim() === "") {
452          paragraph.remove();
453        }
454      });
455
456      paragraphs = Array.from(paragraphs).filter(
457        (p) => p.textContent.trim() !== ""
458      );
459
460      // Count how many paragraphs are in article
461      const paragraphsCount = paragraphs.length;
462      const parallaxMobile = document.querySelector(".parallax_mobile");
463      const mediumRectangleSidebarTop = document.querySelector(
464        ".medium_rectangle_sidebar_top"
465      );
466      const entryTitle = document.querySelector(".entry-title");
467      const entryExcerpt = document.querySelector(".entry-excerpt");
468      const entryContent = document.querySelector(".entry-content");
469      const siteFooter = document.querySelector(".site-footer");
470      const candyTabsPostlist = document.querySelector(".candy_tabs-postlist");
471      const multiContentBox = document.querySelector(".multi-content-box");
472      const authorShareBox = document.querySelector(".author-share-box");
473      const mehrDazuLesen = document.querySelector(".entry-most-viewed");
474      const mehrDazuLesenContent = document.querySelector(
475        ".entry-most-viewed .post-teaser-group .row div"
476      );
477      const mehrDazuLesenRow = document.querySelector(
478        ".entry-most-viewed .post-teaser-group .row"
479      );
480      const entryFooter = document.querySelector(".entry-footer");
481      const mediumRectangleContentTop = document.querySelector(
482        ".medium_rectangle_content_top"
483      );
484      const mediumRectangleSidebarBottom = document.querySelector(
485        ".medium_rectangle_sidebar_bottom"
486      );
487
488      // Find first ancestor with class 'col--aside' for '.newest_issue'
489      const asideNewestIssue = document.querySelector(".newest_issue");
490      const asideIssueAndAward = asideNewestIssue
491        ? asideNewestIssue.closest(".col--aside")
492        : null;
493
494      const weitereArtikelGroups = document.querySelectorAll(
495        ".entry-related-teasers .post-teaser-group"
496      );
497
498      // Find first ancestor with class 'container' for '.billboard_content'
499      const billboardElement = document.querySelector(".billboard_content");
500      const billboardContent = billboardElement
501        ? billboardElement.closest(".container")
502        : null;
503
504      // commentSection is first ancestor with class 'container' for '#comments'
505      const commentElement = document.querySelector("#comments");
506      const commentSection = commentElement.closest(".container");
507
508      const teaserUif = document.querySelector(".teaser-uif");
509
510      // Remove margins from commentElement
511      commentElement.style.margin = "0";
512
513      // Set margin-bottom of #wpdcom to 0
514      const wpdcom = document.querySelector("#wpdcom");
515      if (wpdcom) {
516        wpdcom.style.marginBottom = "0";
517      }
518
519      // Set padding-bottom of .wpd-thread-list to 0
520      const wpdThreadList = document.querySelector(".wpd-thread-list");
521      if (wpdThreadList) {
522        wpdThreadList.style.paddingBottom = "0";
523      }
524
525      let arePromosAfterCommentButton = false;
526      let billboardContentMovedToContentTop = false;
527
528      // Find all promo articles
529      let promoArticles = document.querySelectorAll(
530        "#main article.post-teaser.is-promo"
531      );
532
533      // Find all paragraphs
534      // let paragraphs = document.querySelectorAll(".entry-content > p");
535      // Already defined and filtered above
536
537      // Remove from promoArticles articles with ancestor with class 'candy_ajax-postlist'
538      promoArticles = Array.from(promoArticles).filter(
539        (article) => !article.closest(".candy_ajax-postlist")
540      );
541
542      // Sort promoArticles by their position on the page
543      promoArticles.sort(
544        (a, b) => a.getBoundingClientRect().top - b.getBoundingClientRect().top
545      );
546
547      let lastPromoArticle = null;
548
549      // W elemencie mehrDazuLesenContent powinien znajdować się tylko jeden artykuł, usuń wszystkie pozostale
550      if (mehrDazuLesenRow) {
551        while (mehrDazuLesenRow.children.length > 1) {
552          mehrDazuLesenRow.removeChild(mehrDazuLesenRow.lastElementChild);
553        }
554      }
555
556      // Put promoArticles after every second paragraph
557      for (let i = 0; i < paragraphs.length - 1; i += 2) {
558        if (promoArticles.length > 0) {
559          const promo = promoArticles.shift();
560
561          // Insert hr at beginning and end of promo
562          const hrBefore = document.createElement("hr");
563          const hrAfter = document.createElement("hr");
564
565          // Position absolute for hr
566          hrBefore.style.position = "absolute";
567          hrAfter.style.position = "absolute";
568
569          // top -20px
570          hrBefore.style.top = "-30px";
571          hrAfter.style.bottom = "-26px";
572
573          // width 100%
574          hrBefore.style.width = "100%";
575          hrAfter.style.width = "100%";
576
577          // add 'entry-most-viewed__hr' class
578          hrBefore.classList.add("entry-most-viewed__hr");
579          hrAfter.classList.add("entry-most-viewed__hr");
580
581          promo.insertBefore(hrBefore, promo.firstChild);
582          promo.appendChild(hrAfter);
583
584          paragraphs[i + 1].parentNode.insertBefore(
585            promo,
586            paragraphs[i + 1].nextSibling
587          );
588
589          // If body element has class 'paged-2'
590          // Sprawdź, czy body ma klasę pasującą do wzorca "single-paged-" z dowolną liczbą na końcu
591          const hasSinglePagedClass = Array.from(document.body.classList).some(
592            (className) => /^single-paged-\d+$/.test(className)
593          );
594
595          if (hasSinglePagedClass) {
596            // entry-page-links
597            const entryPageLinks = document.querySelector(".entry-page-links");
598
599            // Move entryPageLinks after last p element
600            if (entryPageLinks) {
601              const lastParagraph = paragraphs[paragraphs.length - 1];
602              console.log("lastParagraph", lastParagraph);
603              moveElement(entryPageLinks, lastParagraph, "after");
604            }
605          }
606        }
607      }
608
609      // Put rest of promoArticles after entryFooter
610      while (promoArticles.length > 0) {
611        const promo = promoArticles.shift();
612        entryFooter.parentNode.insertBefore(promo, entryFooter.nextSibling);
613
614        // if it's first iteration then save promo as lastPromoArticle
615        if (!lastPromoArticle) {
616          lastPromoArticle = promo;
617        }
618
619        arePromosAfterCommentButton = true;
620      }
621
622      // // Move .entry-excerpt after .entry-title
623      // moveElement(entryExcerpt, entryTitle, "after");
624
625      // Move .candy_tabs-postlist before #colophon
626      moveElement(candyTabsPostlist, siteFooter, "before");
627
628      if (!authorShareBox) {
629        moveElement(multiContentBox, entryContent, "before");
630      } else {
631        // Move .multi-content-box before .author-share-box
632        moveElement(multiContentBox, authorShareBox, "before");
633      }
634
635      // Set padding to 0 for .entry-content
636      if (candyTabsPostlist) {
637        candyTabsPostlist.style.padding = "0 16px";
638      }
639
640      // Set margin-bottom to 32px for .entry-footer
641      if (entryFooter) {
642        entryFooter.style.marginBottom = "32px";
643      }
644
645      // Keep FLB below the teaser text on mobile article pages and move CAD1 into the text.
646      if (mediumRectangleSidebarTop) {
647        mediumRectangleSidebarTop.style.marginTop = "24px";
648        mediumRectangleSidebarTop.style.marginBottom = "24px";
649
650        if (paragraphs[2]) {
651          moveElement(mediumRectangleSidebarTop, paragraphs[2], "before");
652        } else if (paragraphs[1]) {
653          if (paragraphs[1].nextElementSibling) {
654            moveElement(mediumRectangleSidebarTop, paragraphs[1].nextElementSibling, "before");
655          } else {
656            moveElement(mediumRectangleSidebarTop, entryFooter, "before");
657          }
658        } else {
659          moveElement(mediumRectangleSidebarTop, entryFooter, "before");
660        }
661      }
662
663      // On mobile article pages, use FLB2 in the medium_rectangle_content_top slot position
664      // and reserve the maximum configured slot height for the current breakpoint.
665      if (billboardContent && mediumRectangleContentTop) {
666        const billboardContentReservedHeight = getBusinessAdReservedHeight(
667          "FLB2",
668          300
669        );
670
671        billboardContentMovedToContentTop = true;
672        billboardContent.style.setProperty("display", "block", "important");
673        billboardContent.style.marginTop = "24px";
674        billboardContent.style.marginBottom = "24px";
675
676        if (billboardElement) {
677          billboardElement.style.setProperty("display", "block", "important");
678        }
679
680        const billboardContentContainer = billboardContent.querySelector(
681          ".promo-area__container"
682        );
683        if (billboardContentContainer) {
684          billboardContentContainer.style.minHeight = `${billboardContentReservedHeight}px`;
685        }
686
687        const billboardContentSlot = billboardContent.querySelector("#Ads_BA_FLB2");
688        if (billboardContentSlot) {
689          billboardContentSlot.style.minHeight = `${billboardContentReservedHeight}px`;
690        }
691
692        mediumRectangleContentTop.parentNode.insertBefore(
693          billboardContent,
694          mediumRectangleContentTop
695        );
696        mediumRectangleContentTop.remove();
697      }
698
699
700      // Check if .parallax_mobile is booked - REMOVED
701      // if (hasChildren(parallaxMobile)) {
702      //   // Move .medium_rectangle_content_top 2 paragraphs after .parallax_mobile
703
704      //   // If there is less 4 paragraphs in article
705      //   if (paragraphsCount < 4) {
706      //     moveElement(mediumRectangleContentTop, entryFooter, "before");
707      //   } else {
708      //     moveElement(
709      //       mediumRectangleContentTop,
710      //       parallaxMobile,
711      //       "after",
712      //       "p",
713      //       2
714      //     );
715      //   }
716      // } else {
717      //   // Move .medium_rectangle_content_top before 3rd paragraph
718      //   if (paragraphs[2]) {
719      //     moveElement(mediumRectangleContentTop, paragraphs[2], "before");
720      //   } else {
721      //     moveElement(mediumRectangleContentTop, entryFooter, "before");
722      //   }
723      // }
724
725      if (mehrDazuLesen && parallaxMobile) {
726        moveElement(mehrDazuLesen, parallaxMobile, "after");
727      } else if (mehrDazuLesen && !parallaxMobile) {
728        // Move mehrDazuLesen before 3rd paragraph
729        moveElement(mehrDazuLesen, paragraphs[2], "before");
730      }
731
732      if (arePromosAfterCommentButton) {
733        // Put commentSection after last promoArticle
734        moveElement(commentSection, lastPromoArticle, "after");
735      } else {
736        // Put commentSection after entryFooter
737        moveElement(commentSection, entryFooter, "after");
738      }
739
740      // Move billboardContent after commentSection
741      if (billboardContent && !billboardContentMovedToContentTop) {
742        moveElement(billboardContent, commentSection, "after");
743      }
744
745      if (mediumRectangleSidebarBottom) {
746        if (billboardContent && !billboardContentMovedToContentTop) {
747          moveElement(mediumRectangleSidebarBottom, billboardContent, "after");
748        } else {
749          moveElement(mediumRectangleSidebarBottom, commentSection, "after");
750        }
751      }
752
753      // Check if weitereArtikelGroups exist and if contain 3 or more elements
754      if (weitereArtikelGroups && weitereArtikelGroups.length === 3) {
755        // Move teaserUif after 1st weitereArtikelGroup
756        if (teaserUif) {
757          moveElement(teaserUif, weitereArtikelGroups[0], "after");
758        }
759
760        // Move asideIssueAndAward after 2nd weitereArtikelGroup
761        if (asideIssueAndAward) {
762          moveElement(asideIssueAndAward, weitereArtikelGroups[1], "after");
763        }
764      }
765
766      // If body element has class 'paged-2'
767      const hasSinglePagedClass = Array.from(document.body.classList).some(
768        (className) => /^single-paged-\d+$/.test(className)
769      );
770      if (hasSinglePagedClass) {
771        const entryPageLinks = document.querySelector(".entry-page-links");
772        const entryFooter = document.querySelector(".entry-footer");
773        const mediumRectangleContentTop = document.querySelector(
774          ".medium_rectangle_content_top"
775        );
776        // multi-content-box
777        const multiContentBox = document.querySelector(".multi-content-box");
778        const parallaxDesktop = document.querySelector(".parallax_desktop");
779
780        if (mediumRectangleContentTop) {
781          // move medium_rectangle_content_top before entryFooter
782          moveElement(mediumRectangleContentTop, entryFooter, "before");
783        }
784
785        if (multiContentBox) {
786          // Move multi-content-box before entryFooter
787          moveElement(multiContentBox, entryFooter, "before");
788        }
789
790        if (mediumRectangleSidebarTop) {
791          // Move medium_rectangle_sidebar_top before entryFooter
792          moveElement(mediumRectangleSidebarTop, entryFooter, "before");
793        }
794
795        // Move entryPageLinks after last p element
796        if (entryPageLinks) {
797          let lastParagraph;
798          if (paragraphs.length > 1) {
799            lastParagraph = paragraphs[paragraphs.length - 1];
800          } else if (paragraphs.length === 1) {
801            lastParagraph = paragraphs[0];
802          }
803
804          // change padding top to 0 of '.entry-page-links__title'
805          const entryPageLinksTitle = document.querySelector(
806            ".entry-page-links__title"
807          );
808          if (entryPageLinksTitle) {
809            entryPageLinksTitle.style.paddingTop = "0";
810          }
811
812          // entryPageLinks.style.padding = "12px 0";
813
814          // console.log("lastParagraph", lastParagraph);
815          console.log("lastParagraph", lastParagraph);
816          moveElement(entryPageLinks, lastParagraph, "after");
817        }
818      }
819
820      const promoArticle = document.querySelectorAll(
821        "article.post-teaser.is-promo"
822      );
823
824      if (promoArticle.length > 0) {
825        for (let i = 0; i < promoArticle.length; i++) {
826          const promoNextSibling = promoArticle[i].nextElementSibling;
827          if (
828            promoNextSibling &&
829            promoNextSibling.classList.contains("entry-most-viewed")
830          ) {
831            console.log("promoArticle[i]", promoArticle[i]);
832            // Remove last hr element inside promo
833            promoArticle[i].querySelector("hr:last-of-type").remove();
834            promoArticle[i].style.paddingBottom = "0px";
835          }
836        }
837      }
838    } else {
839      /** Desktop devices */
840
841      if (isArticlePage()) {
842        let contentContainer = getEntryContentContainer();
843        let paragraphs = contentContainer.querySelectorAll(":scope > p");
844
845        // Remove empty paragraphs
846        paragraphs.forEach((paragraph) => {
847          if (paragraph.textContent.trim() === "") {
848            paragraph.remove();
849          }
850        });
851
852        // Remove empty paragraphs from paragraphs array
853        paragraphs = Array.from(paragraphs).filter(
854          (p) => p.textContent.trim() !== ""
855        );
856
857        changeNewsletterBanerToUnternehmen();
858        reorganizeRelatedTeasers();
859        // If body element has class 'paged-2'
860        const hasSinglePagedClass = Array.from(document.body.classList).some(
861          (className) => /^single-paged-\d+$/.test(className)
862        );
863        if (hasSinglePagedClass) {
864          const entryPageLinks = document.querySelector(".entry-page-links");
865          const entryFooter = document.querySelector(".entry-footer");
866          const mediumRectangleContentTop = document.querySelector(
867            ".medium_rectangle_content_top"
868          );
869          const parallaxDesktop = document.querySelector(".parallax_desktop");
870
871          if (mediumRectangleContentTop) {
872            // move medium_rectangle_content_top before entryFooter
873            moveElement(mediumRectangleContentTop, entryFooter, "before");
874          }
875
876          // Move entryPageLinks after last p element
877          if (entryPageLinks) {
878            let lastParagraph;
879            if (paragraphs.length > 1) {
880              lastParagraph = paragraphs[paragraphs.length - 1];
881            } else if (paragraphs.length === 1) {
882              lastParagraph = paragraphs[0];
883            }
884
885            // console.log("lastParagraph", lastParagraph);
886            console.log("lastParagraph", lastParagraph);
887            moveElement(entryPageLinks, lastParagraph, "after");
888          }
889        }
890      }
891
892      if (isArchivePage()) {
893        removePaddingIfNoChildren(
894          ".col-xs-12.col-md-4.col--aside",
895          "0 10px 2rem 10px"
896        );
897        // Get .multi-content-box and change margin-top to 0
898        const multiContentBox = document.querySelector(".multi-content-box");
899        if (multiContentBox) {
900          multiContentBox.style.marginTop = "12px";
901        }
902      }
903
904      const billboardHeader = document.querySelector(".billboard_header");
905      if (billboardHeader && billboardHeader.clientHeight > 0) {
906        billboardHeader.style.marginTop = "0";
907      }
908    }
909    removePaddingIfNoChildren(".col-xs-12.col-md-4.col--aside");
910  }
911}
912
913function changeNewsletterBanerToUnternehmen() {
914  // Znajdź rodzica a elementu '.candy_newsletter_teaser'
915  const newsletterBaner = document.querySelector(
916    ".candy_newsletter_teaser"
917  ).parentNode;
918  const unternehmenBaner = document.querySelector(".teaser-uif");
919
920  if (newsletterBaner && unternehmenBaner) {
921    // W miejsce newsletterBaner wstaw unternehmenBaner
922    newsletterBaner.parentNode.replaceChild(unternehmenBaner, newsletterBaner);
923  }
924}
925
926function isArticlePage() {
927  return document.body.classList.contains("single-post");
928}
929
930function removePaddingIfNoChildren(elementSelector, padding = "0") {
931  // Find element col-xs-12  col-md-4 col--aside
932  const colAside = document.querySelector(elementSelector);
933
934  // Check if colAside exists and has children
935  if (colAside && colAside.children.length == 0) {
936    colAside.style.padding = "0";
937  } else if (colAside && colAside.children.length > 0) {
938    colAside.style.padding = padding;
939  }
940}
941
942function isHomePage() {
943  return document.body.classList.contains("home");
944}
945
946function isArchivePage() {
947  return document.body.classList.contains("archive");
948}
949
950function isPageWithId(id) {
951  return document.body.classList.contains("page-id-" + id);
952}
953
954function isCategoryPage() {
955  return document.body.classList.contains("category");
956}
957
958// Funkcja pomocnicza do sprawdzania dzieci elementu
959function hasChildren(target) {
960  // Sprawdzenie i przypisanie dla target
961  if (typeof target === "string") {
962    if (target.trim() === "") {
963      console.log("Pusty selektor dla 'target'. Operacja nieudana.");
964      return;
965    }
966    targetElement = document.querySelector(target);
967  } else {
968    targetElement = target;
969  }
970
971  return targetElement && targetElement.children.length > 0;
972}
973
974function isMobile() {
975  return screen.width < 800;
976}
977
978function getBusinessAdReservedHeight(slotName, fallbackHeight) {
979  const slotConfigs = window.__ba?.config?.slots?.[slotName];
980  if (!Array.isArray(slotConfigs) || slotConfigs.length === 0) {
981    return fallbackHeight;
982  }
983
984  const viewportWidth =
985    window.innerWidth || document.documentElement.clientWidth || 0;
986  const activeConfig = slotConfigs
987    .filter((slotConfig) => viewportWidth >= Number(slotConfig?.minWidth || 0))
988    .sort(
989      (leftConfig, rightConfig) =>
990        Number(rightConfig?.minWidth || 0) - Number(leftConfig?.minWidth || 0)
991    )[0];
992
993  if (!activeConfig || !Array.isArray(activeConfig.sizes)) {
994    return fallbackHeight;
995  }
996
997  const heights = activeConfig.sizes
998    .map((size) => {
999      if (typeof size !== "string") {
1000        return 0;
1001      }
1002
1003      const [, height] = size.split("x");
1004      return Number(height || 0);
1005    })
1006    .filter((height) => Number.isFinite(height) && height > 0);
1007
1008  return heights.length > 0 ? Math.max(...heights) : fallbackHeight;
1009}
1010
1011function initMediumRectangleContentTopAdSlots() {
1012  if (!document.body.classList.contains("single-post")) {
1013    return;
1014  }
1015
1016  const slotConfigByElementId = {
1017    Ads_BA_CAD5: { slotName: "CAD5", fallbackHeight: 250 },
1018    Ads_BA_FLB: { slotName: "FLB", fallbackHeight: 300 },
1019  };
1020
1021  document
1022    .querySelectorAll(".entry-content .medium_rectangle_content_top")
1023    .forEach((promoArea) => {
1024      const slot = promoArea.querySelector("#Ads_BA_CAD5, #Ads_BA_FLB");
1025      if (!slot) {
1026        return;
1027      }
1028
1029      const slotConfig = slotConfigByElementId[slot.id];
1030      if (!slotConfig) {
1031        return;
1032      }
1033
1034      const container = promoArea.querySelector(".promo-area__container");
1035
1036      const getReservedHeight = () =>
1037        getBusinessAdReservedHeight(
1038          slotConfig.slotName,
1039          slotConfig.fallbackHeight
1040        );
1041
1042      const reserveHeight = () => {
1043        const reservedHeight = 250;
1044        promoArea.style.minHeight = `${reservedHeight}px`;
1045        if (container) {
1046          container.style.minHeight = `${reservedHeight}px`;
1047        }
1048        slot.style.minHeight = `${reservedHeight}px`;
1049      };
1050
1051      const markFilled = () => {
1052        promoArea.classList.add("has-ad");
1053        promoArea.classList.remove("is-ad-empty");
1054        reserveHeight();
1055      };
1056
1057      const markEmpty = () => {
1058        promoArea.classList.remove("has-ad");
1059        promoArea.classList.add("is-ad-empty");
1060        reserveHeight();
1061      };
1062
1063      reserveHeight();
1064
1065      slot.addEventListener("__baSlotIsRendered", reserveHeight);
1066      slot.addEventListener("__baSlotIsFilled", markFilled);
1067      slot.addEventListener("__baSlotIsEmpty", markEmpty);
1068
1069      const observer = new MutationObserver(() => {
1070        if (promoArea.classList.contains("is-ad-empty")) {
1071          return;
1072        }
1073
1074        if (
1075          slot.querySelector("iframe, img") ||
1076          slot.textContent.trim().length > 0
1077        ) {
1078          markFilled();
1079        }
1080      });
1081
1082      observer.observe(slot, {
1083        childList: true,
1084        subtree: true,
1085        characterData: true,
1086      });
1087    });
1088}
1089
1090function initMediumRectangleSidebarTopAdSlots() {
1091  if (!document.body.classList.contains("single-post") || isMobile()) {
1092    return;
1093  }
1094
1095  const reservedHeight = getBusinessAdReservedHeight("CAD", 600);
1096
1097  document
1098    .querySelectorAll(".col--aside .medium_rectangle_sidebar_top")
1099    .forEach((promoArea) => {
1100      const slot = promoArea.querySelector("#Ads_BA_CAD");
1101      if (!slot) {
1102        return;
1103      }
1104
1105      const container = promoArea.querySelector(".promo-area__container");
1106
1107      const reserveHeight = () => {
1108        promoArea.style.minHeight = `${reservedHeight}px`;
1109        if (container) {
1110          container.style.minHeight = `${reservedHeight}px`;
1111        }
1112        slot.style.minHeight = `${reservedHeight}px`;
1113      };
1114
1115      reserveHeight();
1116
1117      slot.addEventListener("__baSlotIsRendered", reserveHeight);
1118      slot.addEventListener("__baSlotIsFilled", reserveHeight);
1119      slot.addEventListener("__baSlotIsEmpty", reserveHeight);
1120    });
1121}
1122
1123if (document.readyState === "loading") {
1124  document.addEventListener("DOMContentLoaded", initMediumRectangleContentTopAdSlots);
1125  document.addEventListener("DOMContentLoaded", initMediumRectangleSidebarTopAdSlots);
1126} else {
1127  initMediumRectangleContentTopAdSlots();
1128  initMediumRectangleSidebarTopAdSlots();
1129}
1130
1131(function ($) {
1132  $(function () {
1133    // If there is no author then remove author-share-box
1134    if (!$(".author-share-box").children().length) {
1135      $(".author-share-box").remove();
1136    }
1137
1138    onResize();
1139
1140    $(document).ready(function () {
1141      $(".subcategories-menu .select .select-options")
1142        .last()
1143        .addClass("last-options");
1144    });
1145
1146    //searching in top menu
1147    $(".show-search").on("click", function () {
1148      $(this)
1149        .closest(".container")
1150        .find(".site-search .right-menu .right-menu-icons")
1151        .fadeOut(100);
1152      $(this)
1153        .closest(".container")
1154        .find(".right-menu-search")
1155        .delay(100)
1156        .fadeIn(100, function () {
1157          $(this)
1158            .closest(".container")
1159            .find(".search-input input[name=s]")
1160            .focus();
1161        });
1162    });
1163
1164    $(".close-search").on("click", function () {
1165      $(".right-menu-search").fadeOut(100);
1166      $(".right-menu-icons").delay(100).fadeIn(100);
1167    });
1168
1169    /* DROPDOWN */
1170
1171    $("select").each(function () {
1172      var $this = $(this),
1173        numberOfOptions = $(this).children("option").length;
1174
1175      $this.addClass("select-hidden");
1176      $this.wrap('<div class="select"></div>');
1177      $this.after('<div class="select-styled"></div>');
1178
1179      var $styledSelect = $this.next("div.select-styled");
1180      $styledSelect.text($this.children("option").eq(0).text());
1181
1182      var $list = $("<ul />", {
1183        class: "select-options",
1184      }).insertAfter($styledSelect);
1185
1186      for (var i = 0; i < numberOfOptions; i++) {
1187        $("<a />", {
1188          text: $this.children("option").eq(i).text(),
1189          href: $this.children("option").eq(i).val(),
1190        }).appendTo($list);
1191        //if ($this.children('option').eq(i).is(':selected')){
1192        //  $('li[rel="' + $this.children('option').eq(i).val() + '"]').addClass('is-selected')
1193        //}
1194      }
1195
1196      var $listItems = $list.children("li");
1197
1198      $styledSelect.click(function (e) {
1199        e.stopPropagation();
1200        $("div.select-styled.active")
1201          .not(this)
1202          .each(function () {
1203            $(this).removeClass("active").next("ul.select-options").hide();
1204            $(this).next("ul.select-options").addClass("show-formatted");
1205          });
1206        if ($(this).next("ul.select-options").height() > 400) {
1207          $(this).next("ul.select-options").addClass("add-overflow");
1208        }
1209        $(this).next("ul.select-options").addClass("show-formatted");
1210        if ($(this).hasClass("active")) {
1211          $(this).removeClass("active").next("ul.select-options").hide();
1212        } else {
1213          $(this).addClass("active").next("ul.select-options").show();
1214        }
1215        // Add flash effect only for touch devices
1216        if ("ontouchstart" in window) {
1217          $(this).css("background", "#10214c");
1218          setTimeout(function () {
1219            $styledSelect.css("background", "");
1220          }, 100); // Change color back after 100ms
1221        }
1222      });
1223
1224      $listItems.click(function (e) {
1225        e.stopPropagation();
1226        $styledSelect.text($(this).text()).removeClass("active");
1227        $this.val($(this).attr("rel"));
1228        $list.hide();
1229        //console.log($this.val());
1230      });
1231
1232      $(document).click(function () {
1233        $styledSelect.removeClass("active");
1234        $list.hide();
1235      });
1236    });
1237  });
1238})(jQuery);

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.