PageSourceSearch

https://blog-na.beyerdynamic.com/wp-content/themes/marcell-child/script.js?ver=7.1

js beyerdynamic.com collected 2026-09-24 09:24:23 UTC 4,788 bytes, 137 lines download raw bytes

1document.addEventListener("DOMContentLoaded", function(event) {
2
3	/* Translation Test */
4
5    // Mapping der Wörter für die Übersetzung
6    const translations = {
7      'Lesezeit': 'Reading Time',
8      'Search …': 'Browse …',
9      'Blog durchsuchen...': 'Search blog...',
10      'Ergebnisse für Ihre Suche nach': 'Search results for'
11
12      // 'Wie bewertest du diesen Artikel?': 'How would you rate this article?',
13      // 'Danke für die Bewertung!': 'Thank you!',
14      // 'Anzahl Bewertungen': 'Number of ratings:'
15      
16      // Weitere Übersetzungen hier hinzufügen
17    };
18
19    // Funktion zur Übersetzung von Wörtern im gesamten Dokument
20    function translateAllText() {
21      const allElements = document.getElementsByTagName('*');
22
23      for (let i = 0; i < allElements.length; i++) {
24        const element = allElements[i];
25        const tagName = element.tagName.toLowerCase();
26
27        if (tagName !== 'script' && tagName !== 'style') {
28          for (let j = 0; j < element.childNodes.length; j++) {
29            const node = element.childNodes[j];
30
31            if (node.nodeType === Node.TEXT_NODE) {
32              let content = node.textContent.trim();
33
34              if (translations[content]) {
35                node.textContent = translations[content];
36              }
37            } else if (node.nodeType === Node.ELEMENT_NODE && node.hasAttribute('placeholder')) {
38              let placeholder = node.getAttribute('placeholder').trim();
39
40              if (translations[placeholder]) {
41                node.setAttribute('placeholder', translations[placeholder]);
42              }
43            }
44          }
45        }
46      }
47    }
48
49    // Überprüfen der HTML-Sprache und Aufruf der Übersetzungsfunktion, falls sie en-GB oder en-US ist
50    if (document.documentElement.lang === 'en-GB' || document.documentElement.lang === 'en-US') {
51      translateAllText();
52    }
53
54	// Blogbild als Headerbild setzen
55	var imageheader = document.querySelectorAll("meta[property='blog:imageheader']")[0];
56	if(imageheader != undefined){
57		var blogbild = imageheader.getAttribute("content");
58		// Falls Wordpress es skaliert (verschlimmbessert) hat
59		if(blogbild.indexOf("-scaled") !== -1){
60			// console.log("Blogbild als Headerbild setzen: Falls Wordpress es skaliert (verschlimmbessert) hat");
61			blogbild = blogbild.slice(0,-11);
62			blogbild = blogbild + ".jpg";
63		}
64		// Falls Mobil
65		if(window.screen.width < 420){
66			if(blogbild.indexOf("-scaled") !== -1){
67				// console.log("Blogbild als Headerbild setzen: Mobil: Falls Wordpress es skaliert (verschlimmbessert) hat");
68				blogbild = blogbild.slice(0,-11);
69				blogbild = blogbild + "-570x419.jpg";
70			} else{
71				blogbild = blogbild.slice(0,-4);
72				blogbild = blogbild + "-570x419.jpg";
73			}
74		}
75		document.querySelector("body .sc_layouts_title").style.backgroundImage='url('+blogbild+')';
76		document.querySelector("body .sc_layouts_title").style.opacity=1;
77	}
78    else {
79        var titleElement = document.querySelector("body .sc_layouts_title");
80        if (titleElement) {
81            titleElement.style.opacity = 1;
82        } else {
83            console.error("Element .sc_layouts_title nicht gefunden!");
84        }
85    }
86
87
88// Navigationslogik
89
90
91     var domain = window.location.hostname;
92
93        if (domain === 'blog-en.beyerdynamic.com') {
94            console.log("WE Blog");
95            document.body.classList.add("we-blog");
96            setTimeout(() => {
97                var weOnlyCarousel = document.querySelector('.we-only .main-carousel');
98                if (weOnlyCarousel) {
99                    new Flickity(weOnlyCarousel, {
100                        cellAlign: 'center',
101                        contain: true
102                    });
103                }
104            }, 600);
105
106        } else if (domain === 'blog-na.beyerdynamic.com') {
107            console.log("USA Blog");
108            document.body.classList.add("usa-blog");
109            var usaOnlyCarousel = document.querySelector('.usa-only .main-carousel');
110            setTimeout(() => {
111                if (usaOnlyCarousel) {
112                    new Flickity(usaOnlyCarousel, {
113                        cellAlign: 'center',
114                        contain: true
115                    });
116                }
117            }, 600);
118
119        } else if (domain === 'blog.beyerdynamic.de') {
120            console.log("DE Blog");
121            document.body.classList.add("de-blog");
122            setTimeout(() => {
123                var deOnlyCarousel = document.querySelector('.de-only .main-carousel');
124                if (deOnlyCarousel) {
125                    new Flickity(deOnlyCarousel, {
126                        cellAlign: 'center',
127                        contain: true
128                    });
129                }
130            }, 600);
131        }
132
133
134
135
136
137});

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.