PageSourceSearch

https://www.planetguitar.it/wp-content/themes/Extra-child/js/view.js?ver=6.1.1

js planetguitar.it collected 2026-09-25 09:09:41 UTC 12,632 bytes, 342 lines download raw bytes

1jQuery(document).ready(function($){  
2    
3 function initStickyBlock() {
4    if (!$('body').hasClass('single-post')) return;
5
6    const block    = document.getElementById('block-27');
7    const header   = document.querySelector('#main-header'); // ggf. anpassen
8    const adminBar = document.getElementById('wpadminbar');
9
10    if (!block || !header) return;
11
12    block.style.position = 'sticky';
13
14    function updateTop() {
15      const headerH = header.getBoundingClientRect().height || 0;
16      const adminH  = adminBar ? adminBar.getBoundingClientRect().height : 0;
17      block.style.top = (headerH + adminH) + 'px';
18    }
19
20    // initial + bei Resize aktualisieren
21    updateTop();
22    window.addEventListener('resize', updateTop);
23
24    // falls der Header seine Höhe beim Scrollen ändert (z. B. Shrink-Header)
25    if ('ResizeObserver' in window) {
26      const ro = new ResizeObserver(updateTop);
27      ro.observe(header);
28      if (adminBar) ro.observe(adminBar);
29    }
30  }
31  // Aufruf
32  initStickyBlock();
33
34  function initMobileStartseite() {
35 if (!$('body').hasClass('blog')) return;
36
37  function isMobile() {
38    return window.matchMedia('(max-width: 767px)').matches;
39  }
40
41  if (isMobile()) {
42    const target = document.getElementById('tests');
43    if (!target) return;
44
45    // Wrapper-Container für Ad einfügen
46    const adWrapper = document.createElement('div');
47    adWrapper.innerHTML = `
48      <div class="banner-start">
49        <div class="code-block-label">ANNUNCIO</div>
50        <!-- /12513921/MN_MediumRectangle1 -->
51        <div id="div-gpt-ad-1681825555604-0" style="min-width:300px; min-height:250px;"></div>
52      </div>
53    `;
54    target.parentNode.insertBefore(adWrapper, target);
55
56    // GPT-Library laden
57    const gptScript = document.createElement('script');
58    gptScript.src = 'https://securepubads.g.doubleclick.net/tag/js/gpt.js';
59    gptScript.async = true;
60    document.head.appendChild(gptScript);
61
62    // Initialisierungsscript anhängen
63    gptScript.onload = function () {
64      window.googletag = window.googletag || { cmd: [] };
65      googletag.cmd.push(function () {
66        googletag.defineSlot(
67          '/12513921/MN_MediumRectangle1',
68          [300, 250],
69          'div-gpt-ad-1681825555604-0'
70        ).addService(googletag.pubads());
71        googletag.pubads().enableSingleRequest();
72        googletag.pubads().collapseEmptyDivs();
73        googletag.pubads().setTargeting('PlanetGuitar', ['PlanetGuitar_all']);
74        googletag.enableServices();
75        googletag.display('div-gpt-ad-1681825555604-0');
76      });
77    };
78  }
79      }
80  // Aufruf
81  initMobileStartseite();
82
83
84
85    if ($(".single-post .category-recensioni").length) {
86        var thisScroll = 0, lastScroll = 0;
87        var navHeight = $('.sticky-container').outerHeight(); // Höhe der Navigationsleiste
88        var navOffset = $('.sticky-container').offset().top; // Abstand von der Navigationsleiste zum oberen Rand der Seite
89
90        // Scroll-Event Listener
91        $(window).scroll(function() {
92            thisScroll = $(window).scrollTop();
93            if (thisScroll >= navOffset && !$('#stuckNav').length && thisScroll > lastScroll) {
94                // Navigation klonen und ID ändern
95                var newNav = $('.sticky-container').clone();
96                newNav.attr('id', 'stuckNav');
97                $('.single-post-module').prepend(newNav);
98                $('.single-post-module').css('padding-top', navHeight); // Padding hinzufügen
99            } else if (thisScroll < navOffset && $('#stuckNav').length && thisScroll < lastScroll) {
100                // Wenn der Benutzer nach oben scrollt und über die eigentliche Navigation hinaus
101                $('#stuckNav').remove();
102                $('.single-post-module').css('padding-top', 0); // Padding entfernen
103            }
104            lastScroll = thisScroll;
105        });
106
107        // DOMContentLoaded Event Listener
108        window.addEventListener('DOMContentLoaded', function(ev) {
109            if (window.location.hash) {
110                var origHash = window.location.hash;
111                window.location.hash = '';
112
113                $(function() {
114                    window.setTimeout(function() {
115                        window.location.hash = origHash;
116                    }, 600);
117                });
118            }
119        });
120
121        // Hashchange Event Listener
122        window.addEventListener('hashchange', scrollToAnchor);
123
124        function scrollToAnchor(ev) {
125            ev.preventDefault();
126
127            if (!window.location.hash) {
128                return false;
129            }
130
131            var anchorTarget = $(window.location.hash);
132
133            if (!anchorTarget.length) {
134                return false;
135            }
136
137            // Let the browser finish the current process, before scrolling up/down.
138            $(function() {
139                window.setTimeout(function() {
140                    var offset = parseInt($('html').css('margin-top')) +
141                        parseInt($('header').first().css('height')) + parseInt($('.sprunglinkcontainer-sticky').first().css('height')) + 20;
142                    var anchorTop = anchorTarget.offset().top;
143                    anchorTop -= offset;
144
145                    $('html, body').animate({ scrollTop: anchorTop });
146                }, 250);
147            });
148
149            return false;
150        }
151    }
152
153    // Ende erste IF Schleife
154
155
156
157  if ($(".single-post")[0]) {
158    $('#dettagli').prepend('<div class="detailbox">Dettagli<span>.</span></div>');
159    $('#prova').prepend('<div class="praxisbox">La prova<span>.</span></div>');
160    $('#conclusioni').prepend('<div class="fazitbox">Conclusioni<span>.</span></div>');
161    $('.rat_desc').text('La nostra valutazione:');
162    $('.wpas--cons-title').text('Contro');
163    $('.wpas--pros-title').text('Pro');
164}
165
166
167
168if ($(".blog")[0]) {
169  const tabs = document.querySelectorAll('.tabs-list li');
170  const dropdown = document.querySelector('.tabs-dropdown');
171
172  dropdown.addEventListener('change', function() {
173      const selectedTabId = this.value;
174      tabs.forEach(tab => {
175          if (tab.getAttribute('data-tab-id') === selectedTabId) {
176              tab.click(); // Simulate click on the corresponding tab
177          }
178      });
179  });
180  tabs.forEach(tab => {
181    tab.addEventListener('click', function() {
182        const tabId = this.getAttribute('data-tab-id');
183        dropdown.value = tabId; // Synchronize dropdown with the clicked tab
184    });
185});
186}
187
188
189  function mobileOnlyFunction() {
190      // Such-Icon HTML hinzufügen
191      var searchIconHTML = '<div id="search-icon-container"><a href="#" id="mobile-search-icon"><img src="https://www.planetguitar.it/wp-content/themes/Extra-child/img/icon_search.svg" alt="Search" width="24px" height="24px" /></a></div>';
192      // Füge das Such-Icon zum Menü hinzu
193      $('#et-mobile-navigation .show-menu').before(searchIconHTML);
194
195      // Extrahiere das Suchmenü
196      var searchMenu = $('.menu-item.et-top-search-primary-menu-item').detach();
197
198      // Erstelle ein neues Div und ul, um das Suchmenü einzuschließen
199      var newDiv = $('<div id="new-search-menu-container"></div>');
200      var newUl = $('<ul></ul>').append(searchMenu);
201
202      // Füge das Suchmenü in das neue Div und dann die ul ein
203      newDiv.append(newUl);
204
205      // Füge das neue Div am Anfang der Navigation ein
206      $('#main-header').append(newDiv);
207
208      // Klick-Event für das Such-Icon, um das Suchmenü zu toggeln
209      $('#mobile-search-icon').click(function(e) {
210          e.preventDefault(); // Verhindere die Standardaktion    
211          $('#new-search-menu-container').slideToggle('fast');
212      });
213
214      $('.show-menu-button').on('click', function() {
215          // Prüfe, ob das Suchmenü aktiv (sichtbar) ist
216          if ($('#new-search-menu-container').css('display') != 'none') {
217              // Blende das Suchmenü aus
218              $('#new-search-menu-container').hide();
219          }
220      });
221  }
222
223  // Überprüfe die Bildschirmbreite und führe die Funktion aus, wenn sie unter 768px liegt
224  if ($(window).width() < 768) {
225      mobileOnlyFunction();
226      if ($('.blog').length) {
227          // Simuliere ein Touchstart-Event auf einem spezifischen Element
228          var simulatedEvent = new Event('touchstart', {
229              bubbles: true,
230              cancelable: true
231          });
232
233          var elementToClick = document.querySelector('#klickmich'); // Setze hier die ID des Elements
234
235          if (elementToClick) {
236              elementToClick.dispatchEvent(simulatedEvent);
237          }
238      }
239  }
240
241  if ($(window).width() > 768) {
242      $("#startsection").prependTo("#main-content .container");
243  }
244
245  $("#category-tab-0 span").text($("#category-tab-0 span").text().replace("Recensioni", "Tutte le recensioni"));
246  $(".author-box-header h3").text($(".author-box-header h3").text().replace("Circa l'autore", "Sull'autore"));
247  $(".et-search-field").attr("placeholder", "Cerca");
248  
249  var tumblrLink = $('a[href*="tiktok.com/@planetguitarit"]');
250  if (tumblrLink.next('.widget_list_social').find('.title').text() === 'Tumblr') {
251      // Ersetzen Sie den Text durch 'TikTok'
252      tumblrLink.next('.widget_list_social').find('.title').text('TikTok');
253  }
254
255  var telegramlink = $('a[href*="t.me/PlanetGuitarit"]');
256  if (telegramlink.next('.widget_list_social').find('.title').text() === 'Pinterest') {      
257    telegramlink.next('.widget_list_social').find('.title').text('Telegram');
258  }
259
260
261  if ($('.single').length && !$('.cp-audioplayer-block').length) {
262      if ($('#wpb_widget-2').find('p').length == 0) {
263          $('#wpb_widget-2').hide();
264      }
265  }
266
267  if ($('.archive').length > 0 && $('.grid-posts').length > 0) {
268      $('.grid-col:nth-child(4)').after($('#banner-rectangle1'));
269  }
270  if ($('.archive').length > 0 && $('.grid-posts').length > 0) {
271      $('.grid-col:nth-child(9)').after($('#banner-rectangle2'));
272  }
273
274  if ($('.archive').length > 0 && $('.et_pb_salvattore_content').length > 0) {
275      $('.column:nth-child(1) .et_pb_post:nth-child(1)').after($('#banner-rectangle1'));
276  }
277
278  if ($('.archive').length > 0 && $('.et_pb_salvattore_content').length > 0) {
279      $('.column:nth-child(3) .et_pb_post:nth-child(1)').after($('#banner-rectangle2'));
280  }
281
282  if (!$(".single-post .category-recensioni")[0]) {
283      $("#wpb_widget-2").remove();
284  }
285
286
287
288  if ($(".blog")[0]) {
289      $('#startslider').prepend('<div class="badge">Top!</div>');
290      $('#news').prepend('<div class="bannerbox">News<span>.</span><div class="textboxbanner">Tutte le ultime notizie sul mondo della chitarra<span>.</span></div></div>');
291      $('#magazine').prepend('<div class="bannerbox">Magazine<span>.</span><div class="textboxbanner">Storie di chitarra, musica e altro ancora<span>.</span></div></div>');
292      $('#tests').prepend('<div class="bannerbox">Recensioni<span>.</span></div>');    
293      $('#top-rankings').prepend('<div class="bannerbox">Contenuti top<span>.</span></div>');
294      $('#deals').prepend('<div class="bannerbox2">Offerte<span>.</span><div class="textboxbanner">Le nostre migliori offerte<span>.</span></div></div>');
295      $('#features').prepend('<div class="bannerbox">Primo piano<span>.</span><div class="textboxbanner">Tutto su strumentazione, rig e altro ancora<span>.</span></div></div>');
296      $('#workshop').prepend('<div class="bannerbox">Imparare<span>.</span><div class="textboxbanner">Tutta la teoria e la pratica di cui hai bisogno<span>.</span></div></div>'); 
297      $('#interviste-start').prepend('<div class="bannerbox">Interviste<span>.</span><div class="textboxbanner">Incontri con artisti, aziende e artigiani di tutto il mondo<span>.</span></div></div>'); 
298  }
299});
300
301(function () {
302	document.addEventListener('DOMContentLoaded', () => {
303
304		if (typeof plausible === 'undefined') {
305			return;
306		}
307
308		const sponsorBanner = document.querySelectorAll('img.sponsor_banner, .sponsor_banner img');
309
310		if (sponsorBanner.length <= 0) {
311			return;
312		}
313
314		sponsorBanner.forEach(image => {
315			const imageSource = image.getAttribute('src');
316
317			const ImageURL = new URL(imageSource);
318			const imageURLSegments = ImageURL.pathname.split('/');
319			const fileName = imageURLSegments.pop();
320
321			if (image.style.display !== 'none') {                      
322				plausible('Sponsor_Banner_View', {
323					props: {
324						image: fileName,
325						post: window.location.pathname,
326					},
327					interactive: false,
328				});
329			}
330
331			image.addEventListener('click', () => {        
332				plausible('Sponsor_Banner_Click', {          
333					props: {
334						image: fileName,
335						post: window.location.pathname,
336					},
337				});
338			});
339
340		});
341	});
342})();

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.