PageSourceSearch

https://extrastory.cz/scripts/extrastory/main.js

js extrastory.cz collected 2026-10-01 12:19:17 UTC 7,990 bytes, 237 lines download raw bytes

1// Stick menu
2var stickymenu = jQuery('header');
3var stickymenuoffset = stickymenu.offset();
4stickymenuoffset = stickymenuoffset.top;
5var stickySidebarAd = 620;
6var sticky = '';
7const currentWindowWidth =
8    window.innerWidth ||
9    document.documentElement.clientWidth ||
10    document.body.clientWidth;
11
12jQuery(function ($) {
13    // Sticky sidebar
14    if ($('.reveal-comments').length) {
15        $(document).on('click', '.reveal-comments', function (event) {
16            event.preventDefault();
17            var commentsContainer = $('#comments');
18            if (commentsContainer.length) {
19                commentsContainer.show();
20                $('html, body').animate(
21                    {scrollTop: commentsContainer.offset().top},
22                    1000
23                );
24            }
25
26            return false;
27        });
28    }
29    
30    //Search
31    jQuery(function () {
32
33        jQuery('#searchText').keyup(delay(function (e) {
34            search(jQuery('#searchText').val());
35        }, 500));
36
37        function delay(callback, ms) {
38            var timer = 0;
39            return function () {
40                var context = this, args = arguments;
41                clearTimeout(timer);
42                timer = setTimeout(function () {
43                    callback.apply(context, args);
44                }, ms || 0);
45            };
46        }
47
48        function search(term) {
49            jQuery.get('/search?term=' + term, function (response) {
50                dataLayer.push({
51                    'event': 'search',
52                    'search': {
53                        'term': term
54                    }
55                });
56                jQuery("#searchResultDiv").html(response);
57            });
58        }
59    });
60
61    // Get modal element
62    const modal = document.getElementById('js--search-modal');
63
64// Get open modal button
65    const openModalBtn = document.getElementById('search-button');
66
67// Get close button
68    const closeBtn = document.querySelector('.close');
69
70// Open modal
71    if (openModalBtn) {
72        openModalBtn.addEventListener('click', () => {
73            modal.style.display = 'block';
74            jQuery('#searchText').focus();
75        });
76    }
77
78// Close modal when clicking on the close button
79    if (closeBtn) {
80        closeBtn.addEventListener('click', () => {
81            modal.style.display = 'none';
82        });
83    }
84
85// Close modal when clicking outside the modal content
86    window.addEventListener('click', (event) => {
87        if (event.target == modal) {
88            modal.style.display = 'none';
89        }
90    });
91
92    if ($('.gallery-image-zoom').length) {
93        $('.gallery-image-zoom').magnificPopup({
94            type: 'image',
95            closeOnContentClick: true,
96            mainClass: 'mfp-img-mobile',
97            image: {
98                verticalFit: true,
99            },
100        });
101    }
102
103    if ($('.gallery-image-info').length) {
104        $('.gallery-image-info .close-info').click(function (e) {
105            e.preventDefault();
106            $('.gallery-image-info').fadeOut();
107        });
108
109        $('.gallery-image-info-button').click(function (e) {
110            e.preventDefault();
111            $('.gallery-image-info').fadeIn();
112        });
113    }
114
115    if (jQuery('.opt-privacy-footer a').length) {
116        document
117            .querySelector('.opt-privacy-footer a')
118            .addEventListener('click', function (event) {
119                event.preventDefault();
120                try {
121                    Didomi.preferences.show();
122                } catch (e) {
123                }
124            });
125    }
126});
127
128jQuery(document).on('click', 'nav .mobile-only a', function (event) {
129    event.preventDefault();
130
131    var mobileMenuContainer = jQuery('.mobile-menu');
132    if (mobileMenuContainer.length) {
133        var scrollPosition = [
134            self.pageXOffset ||
135            document.documentElement.scrollLeft ||
136            document.body.scrollLeft,
137            self.pageYOffset ||
138            document.documentElement.scrollTop ||
139            document.body.scrollTop,
140        ];
141        var html = jQuery('html'); // it would make more sense to apply this to body, but IE7 won't have that
142        html.data('scroll-position', scrollPosition);
143        html.data('previous-overflow', html.css('overflow'));
144        html.css('overflow', 'hidden');
145        window.scrollTo(scrollPosition[0], scrollPosition[1]);
146
147        mobileMenuContainer.show();
148        //$('html, body').animate({ scrollTop: commentsContainer.offset().top}, 1000);
149    }
150
151    return false;
152});
153
154jQuery(document).on('click', '.mobile-menu .close a', function (event) {
155    event.preventDefault();
156
157    var mobileMenuContainer = jQuery('.mobile-menu');
158    if (mobileMenuContainer.length) {
159        var html = jQuery('html');
160        var scrollPosition = html.data('scroll-position');
161        html.css('overflow', html.data('previous-overflow'));
162        window.scrollTo(scrollPosition[0], scrollPosition[1]);
163        mobileMenuContainer.hide();
164        //$('html, body').animate({ scrollTop: commentsContainer.offset().top}, 1000);
165    }
166
167    return false;
168});
169/* ADSREMOVE
170document.addEventListener('DOMContentLoaded', function () {
171    const prevImageAds = document.querySelectorAll('body.gallery a.prev-image.ad');
172    const nextImageAds = document.querySelectorAll('body.gallery a.next-image.ad');
173    burdaAds.queue.push(() => {
174        if (BurdaAdsIsMobile() && BurdaAdsIsSeznam()) {
175            prevImageAds.forEach(function (prevImageAd) {
176                prevImageAd.addEventListener('click', handleGalleryImageClick);
177            });
178
179            nextImageAds.forEach(function (nextImageAd) {
180                nextImageAd.addEventListener('click', handleGalleryImageClick);
181            });
182        }
183    });
184});
185*/
186function handleGalleryImageClick(event) {
187        // do not follow clicked link
188        event.preventDefault();
189        event.stopPropagation();
190
191        // remove current gallery content
192        const image = document.querySelector("body.gallery .image-container .image img");
193        if (image) {
194            image.parentNode.removeChild(image);
195        }
196        const imageDescription = document.querySelector("body.gallery .image-container span.image-description");
197        if (imageDescription) {
198            imageDescription.parentNode.removeChild(imageDescription);
199        }
200        const imageSource = document.querySelector("body.gallery .image-container span.image-source");
201        if (imageSource) {
202            imageSource.parentNode.removeChild(imageSource);
203        }
204
205        // emplace ad
206        const adContainer = document.querySelector("body.gallery .image-container .ad-container")
207        if (adContainer) {
208            adContainer.innerHTML = '';
209            BurdaAdsAddAdvert(adContainer, 10533, 'mobile-rectangle', ['mobile'], 'seznam', null, null, true);
210        }
211
212        // clean up
213        const prevAds = document.querySelectorAll("body.gallery a.prev-image.ad");
214        const nextAds = document.querySelectorAll("body.gallery a.next-image.ad");
215        prevAds.forEach(function (prevAd) {
216            prevAd.classList.remove("ad");
217            prevAd.removeEventListener('click', handleGalleryImageClick, false);
218        });
219        nextAds.forEach(function (nextAd) {
220            nextAd.classList.remove("ad");
221            nextAd.removeEventListener('click', handleGalleryImageClick, false);
222        });
223}
224
225// keyboard navigation in galleries
226document.addEventListener("keydown", function (event) {
227    console.log('[DEBUG] keydown', event);
228    if (event.keyCode === 37) {
229        window.location.href = document.querySelector('.gallery-header a.prev-image').getAttribute('href');
230    }
231    if (event.keyCode === 39) {
232        window.location.href = document.querySelector('.gallery-header a.next-image').getAttribute('href');
233    }
234    if (event.keyCode === 27) {
235        window.location.href = document.querySelector('.gallery-header .close a').getAttribute('href');
236    }
237});

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.