PageSourceSearch

https://hoptop.hu/!common_design/base/002100/main.js?mod_time=1789019843

js hoptop.hu collected 2026-09-27 12:38:37 UTC 17,280 bytes, 465 lines download raw bytes

1isTouchDevice = false;
2
3var vh = window.innerHeight * 0.01;
4document.documentElement.style.setProperty('--vh', "".concat(vh, "px"));
5window.addEventListener('resize', function () {
6    var vh = window.innerHeight * 0.01;
7    document.documentElement.style.setProperty('--vh', "".concat(vh, "px"));
8});
9
10function getHeaderHeight() {
11    return 0;
12}
13
14function closeNanobar(e, name, type) {
15    var $target = $(e).closest('.js-nanobar');
16    $target.stop().animate({
17        height: "0px"
18    }, 500, function() {
19        $target.remove();
20        set_front_var(name,1,type);
21        $(window).trigger('resize');
22    });
23}
24
25function handleCloseDropdowns(maskNotClose) {
26    $('html').removeClass('scroll-hidden');
27    $('[data-btn-for], [data-content-for]').removeClass('is-active');
28    if (!maskNotClose) {
29        $.mask.close();
30    }
31}
32
33function handleCloseMenus() {
34    $('html').removeClass('cat-level-0-is-opened cat-level-1-is-opened cat-level-2-is-opened cat-level-3-is-opened cat-level-4-is-opened cat-level-5-is-opened menu-level-0-is-opened menu-level-1-is-opened menu-level-2-is-opened menu-level-3-is-opened');
35    $('.cat-menu.has-child.is-opened, .plus-menu.has-child.is-opened').removeClass('is-opened');
36}
37
38(function() {
39    if (window.navigator.userAgent.match(/(MSIE|Trident)/)) {
40        $('html').addClass('ie');
41    }
42})();
43
44/* CHECK SEARCH INPUT CONTENT  */
45function checkForInput(element) {
46    let thisEl = $(element);
47    let tmpval = thisEl.val();
48    thisEl.toggleClass('not-empty', tmpval.length >= 1);
49    thisEl.toggleClass('search-enable', tmpval.length >= 3);
50}
51
52function getScrollTop() {
53    return $(window).scrollTop();
54}
55function getWindowWidth() {
56    return $(window).width();
57}
58
59function toggleSearch(){
60    $('.search__container').slideToggle().toggleClass('is-opened');
61    if ($('.search__container').hasClass('is-opened')){
62        let $searchInput = $('#box_search_input');
63        if ($searchInput.prop('readonly')==true) {
64            $searchInput.blur();
65            $searchInput.prop('readonly', false);
66        }
67        $searchInput.focus();
68    }
69    $('.search-open-btn').toggleClass('is-opened');
70}
71
72$(document).ready(function() {
73    initTippy();
74
75    /* COMPARE POPUP OPENED */
76    $(document).on('popupOpen', function(event, array){
77        if (array['popupId'] === 'compare') {
78            setTimeout(
79                function() {
80                    $('table.compare_list_table tbody').width($('.shop_popup_compare').width());
81                }, 400
82            );
83        }
84    });
85
86    /* BACk TO TOP */
87    var offset = 220;
88    var duration = 500;
89    $(window).scroll({passive: true}, function(){
90        if (getWindowWidth() >= 1200){
91            handleCloseDropdowns(true);
92            handleCloseMenus();
93        }
94        if ($(this).scrollTop() > offset) {
95            $('.back_to_top').stop().fadeIn(duration);
96        } else {
97            $('.back_to_top').stop().fadeOut(duration);
98        }
99    });
100    $('.back_to_top').click(function(event) {
101        event.preventDefault();
102        $('html, body').animate({scrollTop: 0}, duration);
103        return false;
104    });
105
106    /*Check the user agent string*/
107    if( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ) {
108        $('html').addClass('prel-touch-device');
109        isTouchDevice = true;
110    }
111    /* IS TOUCH DEVICE */
112    $(document).on('touchstart', {passive: true}, function() {
113        $('html').removeClass('prel-touch-device').addClass('touch-device');
114        isTouchDevice = true;
115    });
116    /* DROPDOWN BUTTONS */
117    $(document).on('click', '[data-btn-for]', function(e) {
118        var $thisBtn = $(this);
119
120        var $thisBtnLeft = $thisBtn.offset().left;
121        var $thisBtnTop =  $thisBtn.offset().top - $(window).scrollTop();
122
123        var $thisDropdown = $($thisBtn.data("btn-for"));
124
125        if ($thisDropdown.length > 0 ) {
126            if ($thisDropdown.hasClass('is-active')) {
127                $($thisDropdown.data("content-for")).removeClass('is-active');
128                $thisDropdown.removeClass('is-active');
129                $('html').removeClass('scroll-hidden');
130                if (window.matchMedia('(max-width: 1199.8px)').matches) {
131                    $.mask.close();
132                }
133            } else {
134                handleCloseDropdowns();
135                handleCloseMenus();
136                if (window.matchMedia('(max-width: 1199.8px)').matches) {
137                    $thisDropdown.expose({
138                        loadSpeed: "normal",
139                        zIndex: 1035,
140                        onClose: function(event) {
141                            handleCloseDropdowns();
142                        }
143                    });
144                } else {
145                    $thisDropdown.css({top: $thisBtnTop + 'px', left: $thisBtnLeft + 'px' });
146                }
147                $thisBtn.addClass('is-active');
148                $thisDropdown.addClass('is-active');
149                $('html').addClass('scroll-hidden');
150            }
151        }
152        e.stopPropagation();
153    });
154
155    $('[data-close-btn-for]').on('click', function(e) {
156        handleCloseDropdowns();
157    });
158
159    /* CHECK SEARCH INPUT CONTENT  */
160    $('#box_search_input').on('blur change keyup', function() {
161        checkForInput(this);
162    });
163
164    /* REMOVE is-active CLASS FROM DROPDOWN WHEN CLICKED OUTSIDE */
165    $(document).click(function(e) {
166        if ($('[data-content-for]').hasClass('is-active')) {
167            if (!$(e.target).closest('[data-btn-for]').length && !$(e.target).closest('[data-content-for]').length && !$(e.target).hasClass('js-remove-slider-filter')) {
168                handleCloseDropdowns(true);
169            }
170        }
171
172        if ($('html').hasClass('cat-level-0-is-opened') || $('html').hasClass('menu-level-0-is-opened')) {
173            if (!$(e.target).closest('.js-main-menus-content').length) {
174                handleCloseMenus();
175            }
176        }
177    });
178
179    /* DATA SCROLL DOWN */
180    $('[data-scroll]').click(function() {
181        var $this = $(this);
182        var $offset = 10;
183
184        $('html,body').animate({
185            scrollTop: $($this.attr('data-scroll')).offset().top - $offset},
186    'slow');
187    });
188});
189
190/*** PRODUCT VARIANT CHANGE AND ERROR HANDLING ***/
191function changeVariant(el) {
192    var $thisSelect = $(el);
193    var $thisSelectWrap = $thisSelect.closest('.js-variant-wrap');
194
195    if (!$thisSelect.hasClass('is-selected')) {
196        $thisSelect.addClass('is-selected');
197        $thisSelectWrap.removeClass('has-fault');
198    }
199    checkVariants(el, true)
200}
201var $faultInVariants;
202function checkVariants(el, onlyCheck) {
203    $faultInVariants = false;
204    var $thisProduct = $(el).closest('.js-product');
205    var $variantSelectWraps = $('.js-variant-wrap', $thisProduct);
206
207    $variantSelectWraps.each( function() {
208        var selectWrap = $(this);
209        var selectItem = $(selectWrap).find('select');
210
211        if (!selectItem.hasClass('is-selected')) {
212            if (!onlyCheck) selectWrap.addClass('has-fault');
213            $faultInVariants = true;
214        } else {
215            if (!onlyCheck) selectWrap.removeClass('has-fault');
216        }
217    });
218    if (!$faultInVariants) {
219        $thisProduct.removeClass('has-unselected-variant');
220        $thisProduct.addClass('all-variant-selected');
221    } else {
222        $thisProduct.addClass('has-unselected-variant');
223        $thisProduct.removeClass('all-variant-selected');
224    }
225}
226
227function isInViewport(element) {
228    const EL = document.querySelector(element);
229    const RECT = EL.getBoundingClientRect();
230    return (
231        RECT.top >= 0 &&
232        RECT.left >= 0 &&
233        RECT.bottom <= (window.innerHeight || document.documentElement.clientHeight) &&
234        RECT.right <= (window.innerWidth || document.documentElement.clientWidth)
235    );
236}
237
238function inputsErrorHandling(isTooltip) {
239    /*check error in spec params inputs*/
240    var faultInInputs = check_cust_input();
241    /*check error in variant inputs*/
242    var faultInVariant = $faultInVariants;
243    /* IS not select onchange fn call (it runs only when clicked on btn), is a text input param, is artdet */
244
245    if (faultInInputs === 1 || faultInVariant === true) {
246        if (faultInInputs === 1) {
247            if ( isTooltip !== 1 ) {
248                let temp_callback = function() {
249                    overlay_load("warning",lang_text_required_fields_missing);
250                }
251                if ( isInViewport('.js-spec-params-input') ) {
252                    temp_callback();
253                } else {
254                    scrollToElement({ element: '.js-spec-params-input', callback: temp_callback });
255                }
256            } else {
257                scrollToElement({ element: '.product-tooltip__spec-params', offset: 0, scrollIn: '.product-tooltip__datas', container: '#page_PopupContainer_tooltip_inner' });
258            }
259        } else {
260            if ( isTooltip !== 1 ) {
261                let temp_callback = function() {
262                    overlay_load("warning",lang_text_required_fields_missing);
263                }
264                if ( isInViewport('.js-variants') ) {
265                    temp_callback();
266                } else {
267                    scrollToElement({ element: '.js-variants', callback: temp_callback });
268                }
269            } else {
270                scrollToElement({ element: '.product-tooltip__variants', offset: 0, scrollIn: '.product-tooltip__datas', container: '#page_PopupContainer_tooltip_inner' });
271            }
272        }
273    }else{
274        let mainBtn;
275        if ( isTooltip === 1 ) {
276            mainBtn = $('#page_tooltip').find('.js-main-product-cart-btn');
277        } else {
278            mainBtn = $('#page_artdet_content').find('.js-main-product-cart-btn');
279        }
280        let cartadd = mainBtn.data("cartadd");
281        mainBtn.addClass('loading');
282        eval(cartadd);
283    }
284}
285function closeVariantsOverlay(el) {
286    var $thisCloseBtn = $(el);
287    $thisCloseBtn.closest('.js-product').find('.js-variants').slide
287Up('slow', function() {
288        $thisCloseBtn.closest('.js-product').removeClass('is-variants-opened');
289    });
290}
291
292function openVariantsOverlay(el) {
293    var $thisOpenBtn = $(el);
294    if($thisOpenBtn.closest('.js-product').is('.all-variant-selected.is-variants-opened') || $thisOpenBtn.closest('.js-product').is('.all-variant-selected.js-variant-type-2') ){
295        var cartadd = $thisOpenBtn.data("cartadd");
296        eval(cartadd);
297        return;
298    }
299    if(!$thisOpenBtn.closest('.js-product').hasClass('is-variants-opened') && !$thisOpenBtn.closest('.js-product').hasClass('js-variant-type-2')){
300        $thisOpenBtn.closest('.js-product').find('.js-variants').slideDown('slow', function(){
301            $thisOpenBtn.closest('.js-product').addClass('is-variants-opened');
302        });
303    }else{
304        checkVariants(el);
305    }
306}
307$(window).bind("pageshow", function() {
308    $('.js-variant-wrap').each(function () {
309        $('select option', this).each(function () {
310            if (this.defaultSelected) {
311                this.selected = true;
312                return false;
313            }
314        });
315    });
316    $('.cust_input_select:not(.param_cust_input_save_select)').each(function () {
317        $('option', this).each(function () {
318            if (this.defaultSelected) {
319                this.selected = true;
320                return false;
321            }
322        });
323    });
324    $('.cust_input_file, .cust_input_text').each(function () {
325        var $this = $(this);
326        if (!$this.hasClass('param_cust_input_save')) {
327            $this.val("");
328        }
329        if ($this.hasClass('cust_input_file')) {
330            $this.siblings(".file-name").html($this.siblings(".file-name").attr('data-empty'));
331        }
332    });
333});
334
335/**** FILE INPUT CUSTOMIZATION ****/
336function file_input_filname_change(el){
337    var thisInput = $(el);
338    var fileName = thisInput.val().split("\\").pop();
339
340    if (fileName === "") {
341        var thisLabel = thisInput.next('.custom-file-label')
342        thisLabel.html(thisLabel.attr('data-title'));
343    } else {
344        thisInput.next('.custom-file-label').html(fileName);
345    }
346}
347
348/*** FLOATING LABELS FOR IE AND EDGE ***/
349$(document).ready(function(){
350    $('.form-label-group .form-control').each(function(){
351        if ($(this).val()!=="") {
352            $(this).addClass('placeholder-hide');
353        } else {
354            $(this).removeClass('placeholder-hide');
355        }
356    });
357    $(document).on('change keypress blur', '.form-label-group .form-control', function () {
358        if ($(this).val()!=="") {
359            $(this).addClass('placeholder-hide');
360        } else {
361            $(this).removeClass('placeholder-hide');
362        }
363    });
364});
365
366/*** CUSTOM CONTENT/SHORT DESCRIPTION OPENER ***/
367function readMoreOpener(){
368    let $container = $(this);
369    let $content = $('.read-more__content', $container);
370    let $button = $('.read-more__btn', $container);
371    let $contentHeight = $content.outerHeight(true);
372    let $defaultMaxHeight = 220;
373    let $dataMaxHeight =  $container.data('read-more-height');
374    if ($dataMaxHeight != undefined && $dataMaxHeight != "" ) {
375        $defaultMaxHeight = $dataMaxHeight;
376    }
377    if ($contentHeight > $defaultMaxHeight) {
378        $container.addClass('has-button').css({height: $defaultMaxHeight + 'px'});
379        $button.toggle(function () {
380            $container.css('max-height', 'unset').addClass('is-opened').animate({height: $content.outerHeight(true) + $button.outerHeight(true)}, 400);
381            $button.addClass('is-active');
382        }, function () {
383            $container.animate({height: $defaultMaxHeight}, 400).removeClass('is-opened');
384            $button.removeClass('is-active');
385        });
386    }
387    $(this).addClass('is-processed');
388}
389
390
391$(document).ready(function() {
392    if ( typeof responsive_menu !== 'undefined' ) {
393        eval(responsive_menu);
394    }
395});
396if (service_type == 'shop') {
397    $(document).ready(function() {
398        toastr.options = {
399            "positionClass": "toast-top-center",
400            "closeButton": true
401        }
402    });
403    $(document).on('addToCartSuccess', function (e, array) {
404        if (config_plus['cart_redirect'] == 1) {
405            if (array['qty'] > array['qty_add']) {
406                let text = UNAS.text.product_added_to_cart_with_qty_problem;
407
408                text = text.replace("[qty_added_to_cart]", "<span class='toast-qty'>" + array['qty_add']);
409                text = text.replace("[qty_unit]", array['unit'] + "</span>");
410                text = $.parseHTML(text);
411
412                toastr.warning(text);
413            } else {
414                toastr.success(UNAS.text.product_added_to_cart);
415            }
416        }
417    });
418    $(document).on('onLoad onClose', function () {
419        tippy.hideAll({duration: 500});
420    });
421}
422if (service_type == 'cms') {
423    $(document).on('click', function (e) {
424        if ($(e.target).closest('#exposeMask').length || $(e.target).attr("id") == "exposeMask" || $(e.target).closest('.hamburger__bt
424n-close').length) {
425            $('body').css("overflow", "visible");
426        }
427    });
428}
429
430function initTippy() {
431    if (typeof tippy == 'function') {
432        tippy('[data-tippy]:not(.tippy-inited)', {
433            allowHTML: true,
434            /*interactive: true,*/
435            hideOnClick: false,
436            zIndex: 10000,
437            maxWidth: "300px",
438            onShow: function onShow(instance) {
439                instance.popper.hidden = instance.reference.dataset.tippy ? false : true;
440                instance.setContent(instance.reference.dataset.tippy);
441
442                function changeTippyText(text, el) {
443                    instance.setContent(text);
444                    el.attr("data-tippy", text);
445                }
446
447                $(document).on('addToFavourites', function (e, product_array) {
448                    changeTippyText(UNAS.text.delete_from_favourites, $('.page_artdet_func_favourites_outer_' + product_array['sku_id'] + ':not(.page_artlist_func_favourites_' + product_array['sku_id'] + '), .page_artlist_func_favourites_' + product_array['sku_id'] + ' .product__func-icon'));
449                });
450                $(document).on('removeFromFavourites', function (e, product_array) {
451                    changeTippyText(UNAS.text.add_to_favourites, $('.page_artdet_func_favourites_outer_' + product_array['sku_id'] + ':not(.page_artlist_func_favourites_' + product_array['sku_id'] + '), .page_artlist_func_favourites_' + product_array['sku_id'] + ' .product__func-icon'));
452                });
453                $(document).on('addToCompare', function (e, product_array) {
454                    changeTippyText(UNAS.text.delete_from_compare, $('.page_art_func_compare_' + product_array['sku_id'] + ', .page_artdet_func_compare_' + product_array['sku_id']));
455                });
456                $(document).on('removeFromCompare', function (e, product_array) {
457                    changeTippyText(UNAS.text.comparison, $('.page_art_func_compare_' + product_array['sku_id'] + ', .page_artdet_func_compare_' + product_array['sku_id']));
458                });
459            },
460            onCreate: function onCreate(instance) {
461                instance.reference.classList.add('tippy-inited');
462            }
463        });
464    }
465}

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.