PageSourceSearch

https://start.brockhaus.de/wp-content/themes/salient-child/js/brockhaus.js?ver=7.1.2

js brockhaus.de collected 2026-10-02 04:46:40 UTC 4,690 bytes, 115 lines download raw bytes

1    // Check if user is signed in
2    jQuery(function() {
3        if (jQuery('#menu-item-100').length) {
4            var currentURL = window.location;
5            var url = currentURL.protocol + '//' + currentURL.host + '/entrypoint';
6            jQuery.get(url).done(function(data) {
7                if (data.userContext.userType != null) {
8                    var loggedinLink = "";
9                    var germanText = "Service starten";
10                    var pageLanguage = jQuery('html').attr('lang');
11                    var signIn = jQuery('#menu-item-100 a');
12                    window.CWR = data;
13                    switch (pageLanguage) {
14                        case 'sv-SE':
15                            loggedinLink = 'Till tjänsten';
16                            break;
17                        case 'de-DE':
18                            loggedinLink = germanText;
19                            break;
20                        case 'de-AT':
21                            loggedinLink = germanText;
22                            break;
23                        case 'de-CH':
24                            loggedinLink = germanText;
25                            break;
26                    }
27                    signIn.attr('href', currentURL.origin).attr('title', '');
28                    signIn.find('.menu-label').text(loggedinLink);
29                }
30            });
31        }
32    });
33
34
35
36
37 
38// Parameter extrahieren
39const urlParams = new URLSearchParams(window.location.search);
40const utmParams = {};
41const productidsParam = urlParams.get('productids');
42const trialidsParam = urlParams.get('trialids');
43const schoolProductOffersParam = urlParams.get('school_product_offers');
44const currentUrlParam = urlParams.get('url'); // Extrahiere den aktuellen "url"-Parameter
45const priceidsParam = urlParams.get('priceids'); // Extrahiere den aktuellen "priceids"-Parameter
46
47urlParams.forEach((value, key) => {
48  if (key.startsWith('utm_')) {
49    utmParams[key] = value;
50  }
51});
52
53// Funktion zum speziellen Kodieren des "url"-Parameters (Slashes bleiben unkodiert)
54function encodeUrlWithoutSlashes(url) {
55  return url
56    .split('/')
57    .map(part => encodeURIComponent(part))
58    .join('/');
59}
60
61// Links auswählen
62const allLinks = document.querySelectorAll('a');
63
64// URL-Parameterwerte zu den Links hinzufügen
65allLinks.forEach(link => {
66  let url = link.href;
67
68  // Prüfen, ob Hashtags in der URL vorhanden sind
69  const hashIndex = url.indexOf('#');
70  const hash = hashIndex !== -1 ? url.slice(hashIndex) : '';
71
72  // Entfernen der Hashtags aus der URL
73  url = hashIndex !== -1 ? url.slice(0, hashIndex) : url;
74
75  // UTM-Parameter hinzufügen
76  Object.entries(utmParams).forEach(([key, value]) => {
77    url += (url.includes('?') ? '&' : '?') + `${key}=${value}`;
78  });
79
80  // Trial-IDs-Parameter hinzufügen, nur wenn kein neuer tiralids-Parameter durch einen Link hinzugefügt oder ersetzt wird
81  if (!link.href.includes('trialids=') && trialidsParam) {
82    url += (url.includes('?') ? '&' : '?') + `trialids=${trialidsParam}`;
83  }
84
85  // Produkt-IDs-Parameter hinzufügen, nur wenn kein neuer productids-Parameter durch einen Link hinzugefügt oder ersetzt wird
86  if (!link.href.includes('productids=') && productidsParam) {
87    url += (url.includes('?') ? '&' : '?') + `productids=${productidsParam}`;
88  }
89
90  // Price-IDs-Parameter hinzufügen, nur wenn kein neuer priceids-Parameter durch einen Link hinzugefügt oder ersetzt wird
91  if (!link.href.includes('priceids=') && priceidsParam) {
92    url += (url.includes('?') ? '&' : '?') + `priceids=${priceidsParam}`;
93  }
94
95  // "url"-Parameter hinzufügen, nur wenn er vorhanden ist und der Link kein Anker-Link mit der Klasse "menu-item-has-children" ist
96  if (currentUrlParam && !link.classList.contains('menu-item-has-children')) {
97    // Prüfen, ob der Link bereits einen "url"-Parameter enthält, um Duplikate zu vermeiden
98    const existingUrlParams = new URLSearchParams(url.split('?')[1] || '');
99    if (!existingUrlParams.has('url')) {
100      const encodedCurrentUrlParam = encodeUrlWithoutSlashes(currentUrlParam);
101      url += (url.includes('?') ? '&' : '?') + `url=${encodedCurrentUrlParam}`;
102    }
103  }
104
105  // "school_product_offers"-Parameter hinzufügen, nur wenn der Parameter noch nicht im Link enthalten ist
106  if (!link.href.includes('school_product_offers=') && schoolProductOffersParam) {
107    url += (url.includes('?') ? '&' : '?') + `school_product_offers=${schoolProductOffersParam}`;
108  }
109
110  // Hashtags am Ende der URL hinzufügen
111  url += hash;
112
113  // Den aktualisierten Link zuweisen
114  link.href = url;
115});

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.