PageSourceSearch

https://www.smartzone.de/wp-content/themes/chinatheme/assets/chinatheme/js/chinatheme.js?ver=2.31697

js smartzone.de collected 2026-10-09 17:34:00 UTC 17,341 bytes, 533 lines download raw bytes

1(function ($) {
2
3    'use strict';
4
5    var page_initial_load = true;
6    var page_initial_refresh = true;
7
8    $(document).ready(function () {
9        initializeStickyFacetSidebar();
10        copy_modal();
11        cleanFaqParagraphs();
12    });
13
14    // wpautop wraps the whitespace between the rendered [faq] items in empty
15    // <p></p> tags, which add stray gaps to the accordion. Remove them.
16    function cleanFaqParagraphs() {
17        $('.accordion-flush').find('p').each(function () {
18            if ($.trim($(this).html().replace(/&nbsp;/g, '')) === '') {
19                $(this).remove();
20            }
21        });
22    }
23
24
25    $(window).on('load', function () {
26        window.moli = window.moli || { que: [] };
27        window.moli.que.push(function (moliAdTag) {
28
29            if ($(window).width() < 768) {
30                if ($('body').hasClass('single') && $('body').hasClass('category-testberichte')) {
31                    //moliAdTag.addLabel('justpremium-content-01');
32                    moliAdTag.addLabel('dspx-content-01');
33                } else {
34                    //moliAdTag.addLabel('justpremium-content-02');
35                    moliAdTag.addLabel('dspx-content-02');
36                }
37            }
38
39            // trigger ads
40            moliAdTag.requestAds();
41        });
42    });
43
44
45    $(document).on('facetwp-loaded', function () {
46
47        $('[data-bs-toggle="tooltip"]').tooltip();
48        $('[data-bs-toggle="popover"]').popover();
49        initializeStickyFacetSidebar();
50        if (page_initial_load) {
51            page_initial_load = false;
52        }
53
54        if (FWP.loaded && $('.facet-sticky-container').length > 0) {
55            $('html, body').animate({
56                scrollTop: $('.facet-sticky-container').offset().top
57            }, 500, 'easeOutQuad');
58        }
59
60        setTimeout(function () {
61            $('.facetwp-template .facet-listing').removeClass('transition');
62        }, 250);
63    });
64
65    $(document).on('facetwp-refresh', function () {
66        if (!page_initial_load) {
67            $('.facetwp-template .facet-listing').addClass('transition');
68            initializeStickyFacetSidebar();
69        } else {
70            page_initial_refresh = false;
71        }
72    });
73
74    $(document).on('facetwp-refresh', function() {
75        if ( FWP.soft_refresh == true ) {
76            FWP.enable_scroll = true;
77        } else {
78            FWP.enable_scroll = false;
79        }
80    });
81    
82    $(document).on('facetwp-loaded', function() {
83        if ( FWP.enable_scroll == true ) {
84            $('html, body').animate({ scrollTop: 0 }, 500);
85        }
86    });
87
88    var initializeStickyFacetSidebar = function () {
89        detachSidebarFilter();
90        $(window).resize(function () {
91            detachSidebarFilter();
92        });
93    }
94
95    function make_sticky() {
96        $(".facet-sidebar-wrapper").stick_in_parent({ parent: '.facet-sticky-container', offset_top: 24 });
97    }
98
99    function detachSidebarFilter() {
100        var window_width = $(window).width();
101        if (window_width < 992) {
102            $(".facet-sidebar-filter").trigger("sticky_kit:detach");
103        } else {
104            make_sticky();
105        }
106    }
107
108
109    /**
110     * Enable all tooltips
111     */
112    $(window).on('load', function () {
113        $('[data-bs-toggle="tooltip"]').tooltip({
114            container: 'html'
115        });
116        $('[data-bs-toggle="popover"]').popover();
117    });
118
119    $('body').on('click', function (e) {
120        //only buttons
121        if ($(e.target).data('toggle') !== 'popover'
122            && $(e.target).parents('.popover.in').length === 0) {
123            $('[data-bs-toggle="popover"]').popover('hide');
124        }
125    });
126
127
128    $(document).on('mouseenter mouseleave', '#main-navigation .dropdown', function () {
129        if ($(window).width() > 992) {
130            var dropdown = $(this);
131            var menu = $('.dropdown-menu', dropdown);
132            dropdown.addClass('show');
133            menu.addClass('show');
134            setTimeout(function () {
135                dropdown[dropdown.is(':hover') ? 'addClass' : 'removeClass']('show');
136                menu[dropdown.is(':hover') ? 'addClass' : 'removeClass']('show');
137            }, 100);
138        }
139    });
140
141
142    /**
143     * Facet modal copy
144     */
145    $(window).resize(function () {
146        copy_modal();
147    });
148
149    function copy_modal() {
150        if ($(".facet-sidebar-wrapper").not(':visible') && $('.facet-sidebar-filter').children().length > 0) {
151            $(".facet-sidebar-wrapper .facet-sidebar-filter").clone().prependTo("#facet-modal .modal-body");
152            $(".facet-sidebar-wrapper .facet-sidebar-filter").remove();
153        }
154
155        if ($(".facet-sidebar-wrapper").is(':visible') && $('#facet-modal .facet-sidebar-filter').children().length > 0) {
156            $("#facet-modal .modal-body .facet-sidebar-filter").clone().prependTo(".facet-sidebar-wrapper .card-body");
157            $("#facet-modal .modal-body .facet-sidebar-filter").remove();
158        }
159    }
160
161    $(document).ready(function () {
162        if ($(window).width() > 992) {
163            if ($('#price-table-sidebar').length > 0) {
164                var offset = 50;
165                if ($('body').hasClass('admin-bar')) {
166                    offset = 80;
167                }
168                $('#price-table-sidebar').stick_in_parent({ parent: 'main', offset_top: offset });
169            }
170        }
171    });
172
173
174    /**
175     * Show facet modal on mobile devices
176     */
177    $(document).ready(function () {
178        let url = window.location.href;
179
180        if ($(window).width() < 992 && url.indexOf('fwp_') == -1) {
181            $('.page.page-id-39917 #facet-modal').modal('show');
182        }
183    });
184
185
186
187    /**
188     * Discount code copy to clipboard
189     */
190    $(document).on('click', 'button[data-discount-code-copy], .discount-code-text', function () {
191        var code = $(this).closest('.discount-code-container').find('button[data-discount-code-copy]').attr('data-discount-code-copy');
192        navigator.clipboard.writeText(code);
193        let $codeText = $(this).closest('.discount-code-container').find('.discount-code-text');
194        $codeText.popover('show');
195
196        let range = document.createRange();
197        range.selectNode($codeText[0]);
198        window.getSelection().removeAllRanges();
199        window.getSelection().addRange(range);
200    });
201
202
203
204
205    $(document).on('click', '#menu-modal .dropdown', function (e) {
206        e.stopPropagation();
207        $(this).find('.modal-dropdown-menu').toggleClass('show');
208    });
209
210
211
212    /**
213     * wpdiscuz bell
214     */
215    $(document).on('focusin', 'textarea.wc_comment', function () {
216        $('.fa-bell-slash.wpdicon.wpdicon-off').first().closest('label.wpd_label').attr('title', '').tooltip({
217            title: translations.bell_popover_content,
218            placement: 'bottom',
219            container: 'body'
220        }).tooltip('show');
221    });
222
223
224
225    /**
226     * Advertisement
227     */
228    $(document).ready(function () {
229        if ($(window).width() > 992) {
230            if ($('#ch-ad-outer-left-sticky').length > 0) {
231                $('#ch-ad-outer-left-sticky').stick_in_parent({ offset_top: 24 });
232            }
233            if ($('#ch-ad-outer-right-sticky').length > 0) {
234                $('#ch-ad-outer-right-sticky').stick_in_parent({ offset_top: 24 });
235            }
236        }
237    });
238
239
240    $(document).on('click', '#ch-ad-mobile-footer-close', function () {
241        console.log('close ad');
242        $(this).parent().hide();
243    });
244
245
246    /**
247     * DataTables
248     */
249    $(document).ready(function () {
250        if ($('.data-table').length > 0 && $().DataTable !== undefined) {
251            let chDataTable = $('.data-table').DataTable({
252                "order": [],
253                "language": {
254                    "sEmptyTable": "Keine Daten in der Tabelle vorhanden",
255                    "sInfo": "_START_ bis _END_ von _TOTAL_ Einträgen",
256                    "sInfoEmpty": "Keine Daten vorhanden",
257                    "sInfoFiltered": "(gefiltert von _MAX_ Einträgen)",
258                    "sInfoPostFix": "",
259                    "sInfoThousands": ".",
260                    "sLengthMenu": "_MENU_ Einträge anzeigen",
261                    "sLoadingRecords": "Wird geladen ..",
262                    "sProcessing": "Bitte warten ..",
263                    "sSearch": "Suchen",
264                    "sZeroRecords": "Keine Einträge vorhanden",
265                    "oPaginate": {
266                        "sFirst": "Erste",
267                        "sPrevious": "Zurück",
268                        "sNext": "Nächste",
269                        "sLast": "Letzte"
270                    },
271                    "oAria": {
272                        "sSortAscending": ": aktivieren, um Spalte aufsteigend zu sortieren",
273                        "sSortDescending": ": aktivieren, um Spalte absteigend zu sortieren"
274                    },
275                    "select": {
276                        "rows": {
277                            "_": "%d Zeilen ausgewählt",
278                            "0": "",
279                            "1": "1 Zeile ausgewählt"
280                        }
281                    },
282                    "buttons": {
283                        "print": "Drucken",
284                        "colvis": "Spalten",
285                        "copy": "Kopieren",
286                        "copyTitle": "In Zwischenablage kopieren",
287                        "copyKeys": "Taste <i>ctrl</i> oder <i>\u2318</i> + <i>C</i> um Tabelle<br>in Zwischenspeicher zu kopieren.<br><br>Um abzubrechen die Nachricht anklicken oder Escape drücken.",
288                        "copySuccess": {
289                            "_": "%d Zeilen kopiert",
290                            "1": "1 Zeile kopiert"
291                        },
292                        "pageLength": {
293                            "-1": "Zeige alle Zeilen",
294                            "_": "Zeige %d Zeilen"
295                        }
296                    }
297                }
298            });
299        }
300    });
301
302
303    /**
304     * App install modal
305     */
306    function iOS() {
307        return [
308            'iPad Simulator',
309            'iPhone Simulator',
310            'iPod Simulator',
311            'iPad',
312            'iPhone',
313            'iPod'
314        ].includes(navigator.platform)
315        // iPad on iOS 13 detection
316        || (navigator.userAgent.includes("Mac") && "ontouchend" in document)
317    }
318
319
320    $(window).on('load', function () {
321
322        if (!getCookie('ch_app_modal') && window.chinatheme.isApp() === false && iOS() === false) {
323            let appTimeout = setTimeout(function () {
324                showAppModal();
325            }, 20000);
326
327            let appScrollInterval = setInterval(function () {
328                if ($(document).scrollTop() > 500) {
329                    showAppModal();
330                }
331            }, 1000);
332
333            let showAppModal = function () {
334                clearInterval(appScrollInterval);
335                clearTimeout(appTimeout);
336                $('.app-modal').addClass('app-modal-show');
337                console.log('showAppModal');
338            }
339
340            $(document).on('click', '.app-modal-close', function () {
341                $('.app-modal').removeClass('app-modal-show');
342                setCookie('ch_app_modal', true, 90);
343            });
344        }
345
346        $('.toast').toast({
347            animation: true,
348            autohide: false
349        });
350    });
351
352    let setCookie = function (cname, cvalue, exdays) {
353        const d = new Date();
354        d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000));
355        let expires = "expires=" + d.toUTCString();
356        document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/";
357    }
358
359    let getCookie = function (cname) {
360        let name = cname + "=";
361        let decodedCookie = decodeURIComponent(document.cookie);
362        let ca = decodedCookie.split(';');
363        for (let i = 0; i < ca.length; i++) {
364            let c = ca[i];
365            while (c.charAt(0) == ' ') {
366                c = c.substring(1);
367            }
368            if (c.indexOf(name) == 0) {
369                return c.substring(name.length, c.length);
370            }
371        }
372        return "";
373    }
374
375
376
377    /**
378     * Deal view
379     */
380    $(document).on('click', '[data-deal-view]', function() {
381        let view = $(this).attr('data-deal-view');
382        const urlParams = new URLSearchParams(window.location.search);
383        urlParams.set('deal-view', view);
384        window.location.search = urlParams;
385    });
386
387
388    $(window).on('load', function() {
389        if ($(location).attr('hash') == '#compare-devices-fotos') {
390            $('#table-of-contents .nav-link:contains("Kamera")').trigger('click');
391        }
392    });
393
394
395    /**
396     * Scroll behaviour fix for page reload
397     */
398
399    // to top right away
400    if (window.location.hash) {
401        scroll(0,0);
402    }
403    setTimeout( function() { scroll(0,0); }, 1);
404
405    $(window).on('load', function() {
406        if(window.location.hash) {
407            setTimeout( function() { 
408                $('html, body').scrollTop($(window.location.hash).offset().top);
409            }, 100);
410        }
411    }); 
412
413
414    $(window).on('load', function() {
415        if ($('.um-field-privacy_policy .um-field-checkbox-option').length > 0) {
416            let text = $('.um-field-privacy_policy .um-field-checkbox-option').text();
417            text = text.replace('[signup_privacy_text]', '<a href="/datenschutz/">Datenschutzerklärung</a>');
418            text = text.replace('[signup_terms_text]', '<a href="/nutzungsbedingungen/">Nutzungsbedingungen</a>');
419            $('.um-field-privacy_policy .um-field-checkbox-option').html(text);
420        }
421    });
422
423 
424
425
426    /**
427     * Menu collapse
428     */
429    $(window).on('load', function() {
430        menuDropdownCollapseManager();
431    });
432
433    $(document).on('click', '#menu-modal .menu-hauptnavigation-container .dropdown', function() {
434        menuDropdownCollapseManager();
435    });
436
437    let menuDropdownCollapseManager = function() {
438        $('#menu-modal .menu-hauptnavigation-container .dropdown').each(function(index, item) {
439            let $dropdown = $(this);
440            let $dropdownMenu = $dropdown.find('> .modal-dropdown-menu');
441            if ($dropdownMenu.hasClass('show')) {
442                $dropdown.addClass('dropdown-is-open');
443            } else {
444                $dropdown.removeClass('dropdown-is-open');
445            }
446        });
447    }
448
449
450
451
452
453
454
455
456
457
458    $(window).on('load', function () {
459        function timeAgo(timestamp) {
460            const now = Math.floor(Date.now() / 1000); // Current timestamp in seconds
461            const diff = now - timestamp;
462    
463            if (diff < 60) {
464                return "Vor wenigen Sekunden";
465            } else if (diff < 3600) {
466                return `Vor ${Math.floor(diff / 60)} min`;
467            } else if (diff < 86400) {
468                return `Vor ${Math.floor(diff / 3600)} Std.`;
469            } else {
470                return `Vor ${Math.floor(diff / 86400)} Tagen`;
471            }
472        }
473    
474        $("[data-comment-timestamp]").each(function () {
475            const timestamp = parseInt($(this).attr("data-comment-timestamp"), 10);
476            if (!isNaN(timestamp)) {
477                $(this).text(timeAgo(timestamp));
478            }
479        });
480    });
481
482
483
484    $(document).on('input', 'select[name=comment-statistics-view]', function() {
485        console.log('changed');
486        let value = $(this).val();
487
488        $('.comment-statistic').hide();
489        $('.comment-statistic-' + value).show();
490    });
491
492
493    $(window).on('load', function() {
494        let isDragging = false;
495        const margin = 3; // Margin in percentage (prevents slider from reaching edges)
496    
497        function moveSlider(clientX) {
498            let container = $('.image-compare-container')[0].getBoundingClientRect();
499            let x = clientX - container.left;
500    
501            let minX = container.width * (margin / 100);
502            let maxX = container.width * (1 - margin / 100);
503    
504            if (x < minX) x = minX;
505            if (x > maxX) x = maxX;
506    
507            let percentage = (x / container.width) * 100;
508    
509            $('.compare-overlay').css('width', percentage + '%');
510            $('.compare-slider').css('left', percentage + '%');
511        }
512    
513        $('.compare-slider').on('mousedown touchstart', function(e) {
514            e.preventDefault();
515            isDragging = true;
516        });
517    
518        $(document).on('mouseup touchend', function() {
519            isDragging = false;
520        });
521    
522        $(document).on('mousemove touchmove', function(e) {
523            if (!isDragging) return;
524            
525            let clientX = e.clientX || (e.touches && e.touches[0].clientX);
526            if (clientX) moveSlider(clientX);
527        });
528    });
529    
530    
531    
532
533}(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.