PageSourceSearch

https://www.mlvshoes.com/plugins/system/js/global.js?40

js mlvshoes.com collected 2026-09-26 19:48:32 UTC 78,812 bytes, 1,932 lines download raw bytes

1var RDC_ICON_SVG_CLOSE = '<div class="rdc-icon-svg rdc-icon-close rdc-icon-circle" style="width: 100%; height: 100%;"></div>';
2var htmlClosePopup = '<div class="mfp-close rdc-mfp-icon-svg a" role="button" tabindex="0">'+RDC_ICON_SVG_CLOSE+'</div>';
3$(document).ready(function(){
4    /* ----------- POPUPS ----------- */
5    if ($('.rdc-platform-b2b').length == 0 || $('.rdc-platform-b2b-style-version-1').length == 0) {
6        var SVG_CLOSE_CSS = '.rdc-mfp-icon-svg,.rdc-mfp-icon-svg:hover{padding:0!important;min-width:30px;min-height:30px;}.rdc-mfp-icon-svg::before{display:none;}';
7        
8        if(RDC_ICON_SVG_CLOSE.split("<svg ").length == 1)
9            SVG_CLOSE_CSS += '.rdc-icon-close{background-image: url("data:image/svg+xml,%3Csvg xmlns=\'http://www.w3.org/2000/svg\' width=\'22\' height=\'22\' viewBox=\'0 0 22 22\'%3E%3Cpolygon points=\'11.961 11 18 17.039 17.039 18 11 11.961 4.961 18 4 17.039 10.039 11 4 4.961 4.961 4 11 10.039 17.039 4 18 4.961\'/%3E%3C/svg%3E"); background-size: 22px;}.mfp-close.rdc-mfp-icon-svg{background-image:none;}@media screen and (max-width: 767px){.mfp-close{width: 32px;height: 32px;min-width: 32px;min-height: 32px;background-size: 32px;}.rdc-icon-close{background-size: 20px;}}'
10        
11        $("body").append('<style type="text/css">'+SVG_CLOSE_CSS+'</style>');
12
13        if(typeof JSVars == 'object' && JSVars.expressions)
14            htmlClosePopup = '<div class="mfp-close rdc-mfp-icon-svg a" title="'+JSVars.expressions[128]+'" role="button" tabindex="0">'+RDC_ICON_SVG_CLOSE+'</div>';
15
16        if($(".mfp-close").length > 0)
17            $(".mfp-close").html(RDC_ICON_SVG_CLOSE).attr('role', 'button').attr('tabindex', '0');
18    } else {
19        RDC_ICON_SVG_CLOSE = '<div class="rdc-icon-circle" style="width: 100%;height: 100%;pointer-events: none;"><div class="rdc-icon-svg-mask rdc-icon-close" style="width: 24px;height: 24px;background-color: var(--color-black);"></div></div>';
20        htmlClosePopup = '<div class="mfp-close a" role="button" tabindex="0">'+RDC_ICON_SVG_CLOSE+'</div>';
21    }
22
23    $('.popup').magnificPopup({
24        removalDelay: 300,
25        closeMarkup: htmlClosePopup,
26        callbacks: {
27            elementParse: function () {
28                const $el = this.currItem && this.currItem.el ? $(this.currItem.el) : null;
29                
30                if($el == null) return;
31
32                const elementParse = $el.data('elementparse');
33                if (elementParse != undefined && elementParse != '') {
34                    eval(elementParse);
35                }
36            },
37            change: function() {
38                const $content = this.content;
39                const titleAttr = `title="${typeof JSVars !== 'undefined' && JSVars.expressions?.[128]?.trim?.() || ''}"`;
40                const $el = this.currItem && this.currItem.el ? $(this.currItem.el) : null;
41                
42                if($el == null) return;
43                
44                $content.find('.mfp-close').remove();
45
46                $content.append(htmlClosePopup.replace('%title%', titleAttr));
47                
48                const change = $el.data('change');
49                if (change != undefined && change != '') {
50                    eval(change);
51                }
52
53                const beforeOpen = $el.data('beforeopen');
54                if (beforeOpen != undefined && beforeOpen != '') {
55                    setTimeout(() => { eval(beforeOpen); });
56                }
57            },
58            beforeOpen: function() {
59                var dataEffect = 'mfp-zoom-in';
60                
61                if(isMobileDevice() && this.st.el.attr("data-effect-mobile") != undefined) {
62                    dataEffect = this.st.el.attr("data-effect-mobile");
63
64                } else if(!isMobileDevice() && this.st.el.attr("data-effect-desktop") != undefined) {
65                    dataEffect = this.st.el.attr("data-effect-desktop");
66                    
67                    if(dataEffect == 'mfp-move-from-right' && !$($(this.st.el).attr('href')).hasClass('rdc-popup-right-bar'))
68                        dataEffect = 'mfp-zoom-in';
69                }
70
71                this.st.mainClass = dataEffect;
72                if(this.st.el.attr("data-modal-class") != undefined && this.st.el.attr("data-modal-class") != "")
73                    this.st.mainClass = this.st.mainClass + ' ' + this.st.el.attr("data-modal-class");
74
75                if(this.st.el.length > 0) {
76                    if(this.st.el.attr("href") != "") {
77                        var popupElement = $(this.st.el.attr("href") + " > .wrapper-popup");
78                        if(popupElement.length > 0)
79                            checkContentHeightPopup(popupElement, 1);
80                    }
81                }
82
83                if(this.st.el.data("beforeopen") != undefined && this.st.el.data("beforeopen") != "")
84                    eval(this.st.el.data("beforeopen"));
85            },
86            open: function() {
87                document.documentElement.style.setProperty('--popup-instance-header-height', $('.rdc-wrapper-popup-header', $.magnificPopup.instance.content).outerHeight() + 'px');
88                if ($('.rdc-wrapper-popup-header', $.magnificPopup.instance.content).css('position') == 'sticky') {
89                    $('.wrapper-popup', $.magnificPopup.instance.content).on('scroll', function(event){
90                        if ($('.wrapper-popup', $.magnificPopup.instance.content).scrollTop() > 10)
91                            $('.rdc-wrapper-popup-header', $.magnificPopup.instance.content).addClass('rdc-popup-sticky-shadow');
92                        else
93                            $('.rdc-wrapper-popup-header', $.magnificPopup.instance.content).removeClass('rdc-popup-sticky-shadow');
94                    });
95                }
96
97                if(this.st.el.data("open") != undefined && this.st.el.data("open") != "")
98                    eval(this.st.el.data("open"));
99            },
100            beforeClose: function(){
101                var elem = $('[href="#'+$('.mfp-wrap .popUp').attr('id')+'"]');
102                if(elem.length > 0 && elem.data("beforeclose") != undefined && elem.data("beforeclose") != "")
103                    eval(elem.data("beforeclose"));
104            },
105            close: function () {
106                const close = this.st.el.data('close');
107                if (close != undefined && close != '') {
108                    eval(close);
109                }
110            },
111            afterClose: function(){
112                if(this.st.el.data("afterclose") != undefined && this.st.el.data("afterclose") != "")
113                    eval(this.st.el.data("afterclose"));
114            }
115        }
116    });
117
118    /* Zoom */
119    $('.popzoom').magnificPopup({
120        type: 'image',
121        closeOnContentClick: true,
122        image: {
123            verticalFit: false
124        }
125    });
126    
127    /* More colors */
128    $("body").on("click", ".rdc-product-more-colors", function(e){
129        e.preventDefault();
130        e.stopPropagation();
131        $(this).closest(".rdc-product-colors").addClass("showAll");
132        $(this).closest(".colors").addClass("showAll");
133    });
134
135    /* Inputs quantidades */
136    $('body').on('click', '.rdc-input_nav', function(){
137        var _parent = $(this).parent();
138        if($("input.qtd", _parent).prop("disabled"))
139            return false;
140
141        var valorClique = $(this).attr("val");
142        var valorMin = $("input.qtd", _parent).attr("valormin") || 1;
143        var valorMax = $("input.qtd", _parent).attr("valormax") || 99;
144            valorMin = parseInt(valorMin);
145            valorMax = parseInt(valorMax);
146        var quantidadeActual = parseInt($("input.qtd",_parent).val());
147        var newValor =(valorClique == "+") ? quantidadeActual + 1 : quantidadeActual - 1;
148        if(newValor <= 1){newValor = 1;}
149        else if(newValor < valorMin) {newValor = valorMin;}
150        else if(newValor > valorMax) {newValor = valorMax;}
151        $("input.qtd",_parent).val(newValor);
152        $("input.qtd",_parent).blur();
153
154        // Sync with AngularJS model
155        var input = $("input.qtd", _parent);
156        var scope = angular.element(input).scope();
157        if (scope && scope.model) {
158            scope.$apply(function () {
159                scope.model.qtd = parseInt(input.val());
160            });
161        }
162    });
163
164    $('body').on('blur', '.rdc-selectQtd .qtd', function(){
165        $(this).val()
166        if($(this).val() <= 0)
167            $(this).val(1);
168
169        $(this).closest('.displayError').removeClass('displayError');
170        const onchangeEvent = $(this).attr('onchange');
171        if(onchangeEvent) eval(onchangeEvent);
172
173    }).on('keypress', '.rdc-selectQtd .qtd', function(evt){
174        var theEvent = evt || window.event;
175        if(theEvent.type === 'paste'){
176            key = event.clipboardData.getData('text/plain');
177        } else {
178            var key = theEvent.keyCode || theEvent.which;
179            key = String.fromCharCode(key);
180        }
181
182        var regex = /^-?\d*$/;
183        if(!regex.test(key)){
184            theEvent.returnValue = false;
185            if(theEvent.preventDefault) theEvent.preventDefault();
186        }
187
188        $(this).closest('.displayError').removeClass('displayError');
189        const onchangeEvent = $(this).attr('onchange');
190        if(onchangeEvent) eval(onchangeEvent);
191        
192    }).on('focusout', '.rdc-selectQtd .qtd', function(){
193        var valorMin = $(this).attr("valormin") || 1;
194        var valorMax = $(this).attr("valormax") || 99;
195            valorMin = parseInt(valorMin);
196            valorMax = parseInt(valorMax);
197
198        if($(this).val() > valorMax) $(this).val(valorMax);
199        else if($(this).val() < valorMin) $(this).val(valorMin);
200
201        var _parent = $(this).parent();
202        if($(this).val() == valorMax) {$(".rdc-input-nav-plus", _parent).addClass("disabled");} else {$(".rdc-input-nav-plus", _parent).removeClass("disabled");}
203        if($(this).val() == valorMin) {$(".rdc-input-nav-minus", _parent).addClass("disabled");} else {$(".rdc-input-nav-minus", _parent).removeClass("disabled");}
204
205        $(this).closest('.displayError').removeClass('displayError');
206    });
207
208    /* Native Share */
209    $('body').on('click', '.rdc-share-button', function() {
210        navigator.share({url: $(this).data('shareurl') || location.href})
211    });
212
213    /* Sincroniza as variáveis CSS para dentro da iframe */
214    if(window.parent && window.parent != window) {
215        const newStyles = [];
216        const parentStyles = getComputedStyle(window.parent.document.documentElement);
217
218        for(const style of parentStyles)
219            if(style.startsWith('--')) newStyles.push({ key: style, value: parentStyles.getPropertyValue(style).trim() });
220
221        const specificVars = [
222            '--window-inner-height',
223            '--product-figure-padding',
224            '--product-figure2-padding',
225            '--product-figure3-padding',
226            '--product-figure4-padding',
227            '--product-figure5-padding',
228            '--header-height',
229            '--window-scroll-width'
230        ];
231        const parentBodyStyles = getComputedStyle(window.parent.document.body);
232        
233        for(const v of specificVars){
234            var value = parentBodyStyles.getPropertyValue(v).trim();
235            
236            if( v == '--window-inner-height'){value = (window.parent.innerHeight - parentBodyStyles.getPropertyValue('--header-height').trim().replace('px',''))  + 'px';}
237
238            if (value) newStyles.push({ key: v, value });
239        }
240
241        for(const {key, value} of newStyles)
242            document.documentElement.style.setProperty(key, value);
243    }
244
245    /* Bloqueia o scroll horizoltal nos sliders CSS */
246    $('body').on('mouseenter', '.slider .slides', function () {
247        var el = this;
248        if (el._rdc_blocked) return;
249        el._rdc_blocked = true;
250        var touchDevice = "ontouchstart" in document. documentElement;
251
252        // Bloquear wheel horizontal
253        el.addEventListener('wheel', function(e) {
254            if (Math.abs(e.deltaX) > Math.abs(e.deltaY) && !touchDevice) { 
255                // movimento mais horizontal que vertical ? bloquear
256                e.preventDefault();
257            }
258            // se vertical, deixa passar
259        }, { passive: false });
260
261        // Bloquear touchmove horizontal
262        let startX = 0, startY = 0;
263        el.addEventListener('touchstart', function(e) {
264            if (e.touches.length === 1) {
265                startX = e.touches[0].clientX;
266                startY = e.touches[0].clientY;
267            }
268        }, { passive: true });
269
270        el.addEventListener('touchmove', function(e) {
271            if (e.touches.length === 1) {
272                let dx = e.touches[0].clientX - startX;
273                let dy = e.touches[0].clientY - startY;
274                if (Math.abs(dx) > Math.abs(dy) && !touchDevice) {
275                    e.preventDefault(); // horizontal ? bloqueia
276                }
277                // vertical ? deixa passar
278            }
279        }, { passive: false });
280    });
281
282    $('.rdc-tabs-menu-selectbox-select').on('change', function(){
283        var tabContainer = $(this).parents('.tabs-container');
284        $('.tab', tabContainer).css('display', 'none');
285        $('.tab'+ $(this).val(), tabContainer).css('display', 'block');
286        $(".rdc-tabs-menu-selectbox-itemselected p", tabContainer).html($("option:selected", this).text() + "&nbsp;");
287    });
288
289    /* Anula a navegação em links com cursor-default */
290    $(document).on('click', 'a.cursor-default[href]', function (e) {
291        e.preventDefault();
292    });
293    
294    tooltipPos();
295    dataImageSizes();
296    bodyClasses();
297});
298
299/* TRUNCATE TEXT */ 
300$.fn.truncateText = function(options) {
301    if(!this[0])
302        return
303    
304    const el = this[0];
305
306    const destroy = (el) => {
307        $(el).parent().removeClass('truncated').css('position', '');
308        $(el).next('.rdc-see-more').remove();
309        $(el).parent().find('.css_truncate').remove();
310        $(el).removeClass('expand');
311
312        $(window).off('resize');
313        $('body').off('click', '.rdc-see-more');
314    };
315
316    if($(el).parent().hasClass('truncated'))
317        destroy(el);
318
319    const getLineDetails = (element) => {
320        const styles = window.getComputedStyle(element);
321        const tempSpan = document.createElement('span');
322        tempSpan.style.visibility = 'hidden';
323        tempSpan.style.whiteSpace = 'nowrap';
324        tempSpan.style.font = styles.font;
325        document.body.appendChild(tempSpan);
326
327        const lines = [];
328        const rawLines = element.innerHTML.split(/<br\s*\/?>/i);
329
330        rawLines.forEach(rawLine => {
331            rawLineNoHtml = rawLine.replace(/<[^>]*>/g, '').replace(/&nbsp;/g, ' ');
332            const words = rawLineNoHtml.split(' ');
333            let currentLine = '';
334
335            words.forEach((word, index) => {
336                tempSpan.innerText = currentLine + word + ' ';
337              
338                if (tempSpan.offsetWidth > element.clientWidth) {
339                    lines.push(currentLine.trim());
340                    currentLine = word + ' ';
341                } else {
342                    currentLine += word + ' ';
343                }
344
345                if (index === words.length - 1) {
346                    lines.push(currentLine.trim());
347                }
348            });
349        });
350
351        const _lineWidths = lines.map(line => {
352            line = line.replace(/<[^>]*>/g, '');
353            tempSpan.innerText = line;
354            return tempSpan.offsetWidth;
355        });
356
357        document.body.removeChild(tempSpan);
358
359        return {
360            lineCount: lines.length,
361            lineWidths: _lineWidths
362        };
363    };
364
365    const truncate = (el, options) => {
366        const { lineCount, lineWidths } = getLineDetails(el);
367        const _elPath = options.elPath || '';
368        const _seeMoreExp = options.seeMoreExp;
369        const _lines = options.lines;
370        if(lineWidths[options.lines - 1] == 0) {
371            var clampLines = _lines - 1;
372        } else {
373            var clampLines = _lines;
374        }
375
376        var style = `
377            <style type="text/css" class="css_truncate css_truncate_base">
378                ${_elPath}{-webkit-line-clamp: ${clampLines};}
379            </style>    
380        `
381
382        if (lineCount > _lines) {
383            const lastLines = lineWidths.slice(options.lines);
384            const sumLastLines = lastLines.reduce((acc, val) => acc + val, 0);
385
386            if(sumLastLines == 0) return
387
388            var button = `
389                <span class="paragraph rdc-see-more"><a style="white-space: nowrap">${_seeMoreExp}</a></span>
390                <style type="text/css" class="css_truncate css_truncate_seemore">
391                    ${_elPath} + .rdc-see-more {position: absolute;bottom: 0;padding-left: 3px;background: linear-gradient(90deg, rgba(255,255,255,0.5914740896358543) 5%, rgba(255,255,255,1) 9%, rgba(255,255,255,1) 100%);}
392                    ${_elPath} + .rdc-see-more::before {content: '...';display: inline;margin: 0 6px; background: linear-gradient(to right, rgba(255, 255, 255, 0), rgba(255, 255, 255, 1) 20px);}
393                </style>
394            `
395
396            $(el).parent().prepend(style).addClass('truncated').css('position', 'relative');
397            $(el).parent().append(button)
398
399            positionButton(el, options)
400            
401        }  
402    };
403
404    const positionButton = (el, options) => {
405        const { lineWidths } = getLineDetails(el);
406        var seeMore = $(el).next('.rdc-see-more');
407
408        if($(el).css('text-align') == 'center') {
409            if(lineWidths[options.lines - 1] == 0 ){
410                var position = ((($(el).width() - lineWidths[options.lines - 2]) / 2) - 20);
411                seeMore.css('right', position);
412            } else if (lineWidths[options.lines - 1] >= ($(el).width() - 45)) {
413                seeMore.css({right: 0, left: 'unset'});
414            } else {
415                var position = ((($(el).width() - lineWidths[options.lines - 1]) / 2) - 20);
416                seeMore.css('right', position);
417            }
418        } else if($(el).css('text-align') == 'left' || $(el).css('text-align') == 'start'){
419            if(lineWidths[options.lines - 1] == 0 ){
420                var position = lineWidths[options.lines - 2] - 30;
421                seeMore.css({left: position, right: 'unset'});
422            } else if (lineWidths[options.lines - 1] >= ($(el).width() - 45)) {
423                seeMore.css({right: 0, left: 'unset'});
424            } else {
425                var position = lineWidths[options.lines - 1] - 30;
426                seeMore.css('left', position);
427            }
428        }
429    }
430
431    truncate(el, options);
432
433    $(window).on('resize', function () {
434        positionButton(el, options)
435    })
436
437    $('body').on('click', '.truncated .rdc-see-more', function () {
438        $(this).hide();
439        $(this).closest('.truncated').find(el).addClass('expand');
440    })
441};
442
443function dataImageSizes(){
444    //Função a ser descontinuada
445    $('figure img[data-size]').each(function(){
446        var size = $(this).attr('data-size').split('/');
447        if( size[0] != undefined && size[1] != undefined )
448            $(this).parent().addClass('loader').css('padding-bottom', size[1] * 100 / size[0]+'%'); //ALTURA * 100 / LARGURA
449    });
450}
451
452function tooltipPos(){
453    $('.form-field').each(function(){
454        var labelHeight = $(this).height();
455        $(this).children('.errorToolTip').css( "bottom", labelHeight + 6);
456    });
457}
458
459var callAccordionCount = 0;
460function accordion(){
461    callAccordionCount += 1;
462    if(callAccordionCount > 1) return;
463
464    $('body').on('click', '.accordion > li:not(.rdc-accordion-static) > .accordion-head', function() {
465        handleShowAccordion(this);
466    }).on('keydown', '.accordion > li:not(.rdc-accordion-static) > .accordion-head', function(e) {
467        if(e.key == 'Enter' || e.key == ' ')
468            handleShowAccordion(this);
469    })
470
471    function handleShowAccordion(el) {
472        var accordionContainer = $(el).closest('.accordion');
473        var beforeAnimation = $(el).data('beforeanimation');
474        var afterAnimation = $(el).data('afteranimation');
475
476        if($(el).parent().hasClass('active')) {
477            accordionContainer.children('li').removeClass('active');
478            $('.accordion-content:visible', accordionContainer).stop(true, true).slide
478Up('normal', function(){
479                if(afterAnimation != undefined) { eval(afterAnimation); }
480                $(this).find('.accordion li.active').removeClass('active');
481            });
482        } else {
483            if(beforeAnimation != undefined) { eval(beforeAnimation); }
484            accordionContainer.children('li').removeClass('active');
485            $('.accordion-content', accordionContainer).slideUp('normal');
486            $(el).parent().addClass('active');
487            var accordionContent = $(el).next().length == 0 ? $(el).find('.accordion-content').first() : $(el).next();
488            accordionContent.stop(true, true).slideDown('normal', function(){
489                if(afterAnimation != undefined) { eval(afterAnimation); }
490            });
491        }
492    }
493}
494function tabs(){
495    $('.tabs-container').each(function(){
496        if(!$('.tabs li:first-child', this).hasClass("sel") || !$('.tab:first-child', this).hasClass("sel")) {
497            $('.tabs li.sel', this).removeClass('sel').find("p").removeClass("active");
498            $('.tab.active', this).removeClass('active');
499            $('.tabs li:first-child').addClass('sel').find("p").addClass("active");
500            $('.tabs-container .tab:first-child').addClass('active');
501        }
502
503        if(!isMobileDevice() && $(this).hasClass('vertical')) {
504            $('.tabs', this).css('min-height', $('.tabs-content', this).outerHeight());
505        }
506    });
507
508    // Product Detail Ellipsis Pack
509    if(typeof ellipsisPack == "function") {
510        setTimeout(function(){ ellipsisPack(); }, 500);
511    }
512
513    $('body').on('click', '.tabs li', function(){
514        if($(this).hasClass('sel')) return;
515
516        var tabContainer = $(this).closest('.tabs-container');
517        var tabIndex = $(this).attr('rel');
518        $('.tab', tabContainer).removeClass('active');
519        $('.tabs li', tabContainer).removeClass('sel').find("p").removeClass("active");
520
521        $('.tab'+ tabIndex, tabContainer).addClass('active');
522        $('.tabs li[rel='+ $(this).attr('rel') +']', tabContainer).addClass('sel').find("p").addClass("active");
523
524        if(!isMobileDevice() && tabContainer.hasClass('vertical')){
525            $('.tabs', tabContainer).css('min-height', $('.tab'+ $(this).attr('rel')).outerHeight(), tabContainer);
526        }
527
528        // Product Detail Related Products in tabs
529        if(typeof relatedProductsSlider == "function") {
530            relatedProductsSlider();
531        }
532
533        // Product Detail Ellipsis Pack
534        if(typeof ellipsisPack == "function") {
535            ellipsisPack();
536        }
537    });
538
539    if($('.rdc-tabs-slider').length > 0) {
540        $('.rdc-tabs-slider').each(function(){
541            const slider = $('.tabs', this);
542            if(slider[0].scrollWidth > Math.ceil($(this).width())) {
543                $('.rdc-slider-next', this).removeClass('hidden');
544            }
545        });
546
547        $('.rdc-slider-arrow').on('click', function() {
548            var tabSliderContainer = $(this).closest('.rdc-tabs-slider');
549            var slider = tabSliderContainer.find('.tabs');
550            var innerWidth = parseInt(tabSliderContainer.width());
551            var scrollAmount = 250;
552            var direction = $(this).hasClass('rdc-slider-prev') ? '-' : '+';
553
554            slider.animate({ scrollLeft: direction + '=' + scrollAmount }, function() {
555                var scrollLeftValue = slider.scrollLeft();
556                
557                if(scrollLeftValue > 5 && scrollLeftValue <= ((slider[0].scrollWidth - innerWidth) - 5)) {
558                    tabSliderContainer.removeClass('rdc-tabs-slider-start');
559                    tabSliderContainer.addClass('rdc-tabs-slider-middle');
560                    tabSliderContainer.removeClass('rdc-tabs-slider-end');
561                } else if (scrollLeftValue >= (slider[0].scrollWidth - innerWidth) - 5){
562                    tabSliderContainer.removeClass('rdc-tabs-slider-middle');
563                    tabSliderContainer.addClass('rdc-tabs-slider-end');  
564                } else {
565                    tabSliderContainer.addClass('rdc-tabs-slider-start');
566                    tabSliderContainer.removeClass('rdc-tabs-slider-middle');
567                }
568            });
569        });
570    }
571    
572}
573
574$(window).on('load', function(){
575    $("body").on("click blur change", ".form-field input, .form-field select, .form-field textarea", function(){
576      $('.form-field.displayError').removeClass('displayError');
577      $(".form-message").children().hide();
578    });
579});
580
581var scrollToError = true;
582function validarFormulario(form){
583    var retorno = true;
584    var prevElement = "";
585
586    $(".form-message", form).children().hide();
587    $(".displayError", form).removeClass("displayError");
588
589    $("[name]", form).not("[type=hidden]").each(function(){
590
591        if(!retorno)
592            return false;
593
594        if(prevElement == $(this).attr("name"))
595            return true;
596
597        prevElement = $(this).attr("name");
598
599        if($(this).attr("require") == 1 && ($.trim($(this).val()) == "" || $.trim($(this).val()) == "0" || $.trim($(this).val()) == null) && $(this).attr("type") != "checkbox" && $(this).attr("type") != "radio") {
600            retorno = false;
601            $(this).parents("form, .form").find(".form-message .error0").slideDown(300);
602            return false;
603        }
604
605        if($(this).attr("minl") > 0 && ($(this).attr("require") == 1 || $.trim($(this).val()) != "")) {
606            if($.trim($(this).val()).length < $(this).attr("minl")) {
607              retorno = false;
608              var element = $(this).parents("form, .form").find(".form-message .error4");
609              if(typeof element.attr("string") != "undefined") {
610                element.html(element.attr("string") + ": " + $(this).attr("minl"));
611              }
612              element.slideDown(300);
613              return false;
614            }
615        }
616
617        if($(this).attr("maxl") > 0 && ($(this).attr("require") == 1 || $.trim($(this).val()) != "")) {
618            if($.trim($(this).val()).length > $(this).attr("maxl")) {
619              retorno = false;
620              var element = $(this).parents("form, .form").find(".form-message .error2");
621              if(typeof element.attr("string") != "undefined") {
622                element.html(element.attr("string") + ": " + $(this).attr("maxl"));
623              }
624              element.slideDown(300);
625              return false;
626            }
627        }
628
629        if(($(this).attr("email") == 1 || $(this).attr("type") == "email")) {
630            if($(this).attr("require") == 1 && verify_email($.trim($(this).val())) == false) {
631                retorno = false;
632                $(this).parents("form, .form").find(".form-message .error1").slideDown(300);
633                return false;
634            }
635
636            else if($(this).attr("require") != 1 && $.trim($(this).val()) != '' && verify_email($.trim($(this).val())) == false) {
637                retorno = false;
638                $(this).parents("form, .form").find(".form-message .error1").slideDown(300);
639                return false;
640            }
641        }
642
643        if(($(this).attr("email_with_confirmation") == 1)) {
644            var input_email_original = $(this).attr("name");
645            input_email_original = input_email_original.replace("_confirmation", "");
646
647            if($(this).val() != $(`[name=${input_email_original}]`, form).val()) {
648                retorno = false;
649                $(this).parents("form, .form").find(".form-message .error3").slideDown(300);
650                return false;
651            }
652        }
653
654        if($(this).attr("match") == 1 && $("[wrefo='"+$(this).attr("wref")+"']", form).val() != $(this).val()) {
655            retorno = false;
656            $(this).parents("form, .form").find(".form-message .error3").slideDown(300);
657            return false;
658        }
659
660        var file_regex = new RegExp("(.*?)\.(jpeg|jpg|png|pdf|ai|eps|bmp|mov|3gp|jfif|mp4|heic|3gpp|doc|rar|zip|avi|mpg|docx)$");
661
662        if($(this).attr("type") == "file" && $(this).val() != "" && !file_regex.test($(this).val().toLowerCase())) {
663            retorno = false;
664            $(this).parents("form, .form").find(".form-message .error0").slideDown(300);
665            return false;
666        }
667
668        if(($(this).attr("type") == "checkbox" || $(this).attr("type") == "radio") && $(this).attr("require") == 1 && $(this).prop("checked") != true && $(this).parents(".content-check.multiple").length == 0 && $(this).parents(".content-radio").length == 0 && $(this).parents(".wrapper-checkbox.radio").length == 0) {
669            retorno = false;
670            $(this).parents("form, .form").find(".form-message .error0").slideDown(300);
671            return false;
672        }
673
674        if($(this).parents(".content-check.multiple").length > 0 && $(this).parents(".content-check.multiple").attr("require") == 1 && $("input[type=checkbox]:checked", $(this).parents(".content-check.multiple")).length == 0) {
675            retorno = false;
676            $(this).parents("form, .form").find(".form-message .error0").slideDown(300);
677            return false;
678        }
679
680        if($(this).parents(".content-radio").length > 0 && $(this).attr("require") == 1 && $("[name='"+$(this).attr("name")+"']:checked").prop("checked") != true) {
681            retorno = false;
682            $(this).parents("form, .form").find(".form-message .error0").slideDown(300);
683            return false;
684        }
685
686        if($(this).attr("nif") == 1 && ($(this).val() != "" || $(this).attr("require") == "1") && $(this).prop("disabled") == false && $(this).prop("readonly") == false) {
687            if($('body').hasClass('rdc-platform-b2b') && $('#shipping_country').length > 0 && $('#shipping_country option:selected').attr('hide_nif') == 2) { //B2B
688                if($(this).val().replace(/\s*/gi,"") == "") {
689                    retorno = false;
690                }
691            } else if(typeof checkVATNumber == "function") {
692                var vatCountry = "PT";
693                if($(form).find("[name=pais]").length > 0) vatCountry = $(form).find("[name=pais]").find("option:selected").attr("code");
694
695                var dataCheckVAT = checkVATNumber(vatCountry + $(this).val(), vatCountry);
696
697                if(dataCheckVAT["valid_country"] == true && dataCheckVAT["valid_vat"] == false) {
698                    retorno = false;
699                }
700
701            } else if($(this).val().replace(/\s*/gi,"") == "") {
702                retorno = false;
703            }
704
705            if(retorno == false) {
706                $(this).parents("form, .form").find(".form-message .error5").slideDown(300);
707                return false;
708            }
709        }
710
711        if($(this).attr("postal_code") == 1 && $(this).attr("require") == 1 && (typeof mask_cp != "undefined" && mask_cp != "") && $(this).val().length != mask_cp.length) {
712            retorno = false;
713            $(this).parents("form, .form").find(".form-message .error6").slideDown(300);
714            return false;
715        }
716
717        if($(this).attr("type") == "tel" && $(this).is("[data-country]") && $(this).attr("data-country") == "PT" && verify_phone($.trim($(this).val())) == false && ($(this).attr("require") == 1 || $(this).val().length > 0)){
718            retorno = false;
719            $(this).parents("form, .form").find(".form-message .error0").slideDown(300);
720            return false;
721        }
722    });
723
724    if(!retorno) {
725        $("[name='"+prevElement+"']", form).parents(".form-field").addClass("displayError");
726        var headerHeightX2 = $("#header").outerHeight() * 2 || 0;
727
728        if($('html').css('overflow-y') != "hidden" && $('body').css('overflow-y') != "hidden") {
729            $('html, body').scrollTop($(form).offset().top - headerHeightX2); 
730        }
731    }
732
733    return retorno;
734}
735
736
737function verify_email(_mail){
738    var emailRegEx = /^([a-z0-9\+_\-]+)(\.[a-z0-9\+_\-]+)*@([a-z0-9\-]+\.)+[a-z]{2,9}$/i;
739
740    if (_mail.search(emailRegEx) == -1)
741        return false;
742    else
743        return true;
744}
745
746function verify_phone(_number){
747  var status = false;
748  var phoneRegEx = /^9[1236]{1}[0-9]{7}$/;
749
750  if(_number.search(phoneRegEx) == -1){
751    status = false;
752  }else{
753    status = true;
754  }
755  return status;
756}
757
758if(typeof MobileDetect == "function")
759  var md = new MobileDetect(window.navigator.userAgent);
760
761function isMobileDevice(){
762  try {
763    if(typeof MobileDetect == "function" && typeof md == "object") {
764      if(md.phone() != null)
765        return true;
766      else
767        return false;
768    }
769
770    if (/.*\(BB[0-9]+;.*Mobile.*/.test(navigator.userAgent)) {
771        return true;
772    }
773
774    if (/.*BlackBerry.*/.test(navigator.userAgent)) {
775        return true;
776    }
777
778    if (/.*Android.*Mobile.*/.test(navigator.userAgent)) {
779        return true;
780    }
781
782    if (/.*MSIEMobile.*/.test(navigator.userAgent)) {
783        return true;
784    }
785
786    if (/.*SymbianOS.*/.test(navigator.userAgent)) {
787        return true;
788    }
789
790    if (/.*Windows Phone.*/.test(navigator.userAgent)) {
791        return true;
792    }
793
794    if (/.*iPhone.*/.test(navigator.userAgent)) {
795        return true;
796    }
797
798    if(window.innerWidth < 768)
799      return true;
800
801    return false;
802  } catch (err) {
803      return false;
804  }
805}
806
807function viewportModify() {
808    if ($('.rdc-platform-b2b').length > 0)
809        return false;
810
811    var viewportContent = 'width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no';
812    var viewportDefined = true;
813
814    if(typeof window["viewport_tablet"] == "undefined") {
815      viewportDefined = false;
816      window["viewport_tablet"] = 1366;
817    }
818
819    /* Tablet */
820    if( (typeof md == "object" && md.tablet() != null) || (isMobileDevice() == false && 'ontouchstart' in window == true) ) {
821
822        var ratio = window.devicePixelRatio || 1;
823        var screen = {width : window.screen.width * ratio, height : window.screen.height * ratio};
824        if(window["viewport_tablet"] != "device-width" && screen.width === 2048) { //iPad Pro
825            if(parseInt(window["viewport_tablet"]) < 1366)
826                window["viewport_tablet"] = 1366;
827
828        } else if(!viewportDefined && screen.width === 1620 && $("body").hasClass("rdc-platform-b2b") == false) { //iPad Pro
829            window["viewport_tablet"] = 'device-width';
830        }
831
832        viewportContent = 'width='+window["viewport_tablet"]+', maximum-scale=1, user-scalable=no';
833        $("body:not(.tablet)").addClass("tablet");
834    }
835
836    /* Mobile */
837    /*if(isMobileDevice()) {*/
838        /* Landscape */
839        /*if(((window.innerWidth > window.innerHeight) && window.innerWidth >= 768) || (window.orientation == 90 || window.orientation == -90) && window.innerWidth <= 767) {
840            viewportContent = 'width='+window["viewport_tablet"]+', initial-scale=1, maximum-scale=1, user-scalable=no';
841            $(".first-line").removeClass("first-line");
842            console.log("remove first-line")
843        }
844
845        $("body.tablet").removeClass("tablet");*/
846    /*}*/
847
848    if( typeof window.orientation != "undefined" ){
849        // LOAD
850        if( window.innerWidth > window.innerHeight ){
851            if( !$("body").hasClass("landscape") )
852                $("body").removeClass("portrait").addClass("landscape");
853        } else {
854            if( !$("body").hasClass("portrait") )
855                $("body").removeClass("landscape").addClass("portrait");
856        }
857
858        // ORIENTATION CHANGE
859        window.matchMedia('(orientation: landscape)').addListener(function(m){
860            if( m.matches ){
861                if( !$("body").hasClass("landscape") )
862                    $("body").removeClass("portrait").addClass("landscape");
863            }else{
864                if( !$("body").hasClass("portrait") )
865                    $("body").removeClass("landscape").addClass("portrait");
866            }
867        });
868    }
869
870    document.querySelector('meta[name="viewport"]').content = viewportContent;
871}
872
873window.addEventListener("orientationchange", function(){
874    viewportModify();
875});
876
877$.fn.isOnScreen = function(test){
878
879  var height = this.outerHeight();
880  var width = this.outerWidth();
881
882  if(!width && !height){
883    return false;
884  }
885
886  var win = $(window);
887
888  var viewport = {
889    top : win.scrollTop(),
890    left : win.scrollLeft()
891  };
892
893  if($(this).closest('#containerSite').length > 0) {
894    var header = $('#header-container');
895
896    if (header.length && header.is(':visible'))
897        viewport.top += header.outerHeight();
898  }
899
900  viewport.right = viewport.left + win.width();
901  viewport.bottom = viewport.top + win.height();
902
903  var bounds = this.offset();
904  bounds.right = bounds.left + width;
905  bounds.bottom = bounds.top + height;
906
907  var deltas = {
908    top : viewport.bottom - bounds.top,
909    left: viewport.right - bounds.left,
910    bottom: bounds.bottom - viewport.top,
911    right: bounds.right - viewport.left
912  };
913
914  if(typeof test == 'function') {
915    return test.call(this, deltas);
916  }
917
918  return deltas.top > 0 && deltas.left > 0 && deltas.right > 0 && deltas.bottom > 0;
919};
920
921$.fn.pixels = function(property) {
922  return parseInt(this.css(property).slice(0,-2));
923};
924
925function triggerOpenChat() {
926  if(!$(".online_chat").hasClass("chatActive")) {
927    $(".online_chat .header_chat").trigger("click");
928  } else {
929    $(".iframe_onlinechat")[0].contentWindow.minimize_chat();
930  }
931}
932
933/*document.addEventListener('gesturestart', function(e) {
934  e.preventDefault();
935  document.body.style.zoom = 1.00;
936});*/
937
938/*
939 * Detetar se o popup tem scroll vertical
940 * @params
941 * wrapperPopupElement => jQuery elemento do popup que tem o scroll vertical
942 * searchChildren => "number" == 1 (Pesquisa a altura dos filhos) | "object" == jQuery object (Pesquisa a altura deste elemento)
943 *
944*/
945function checkContentHeightPopup(wrapperPopupElement, searchChildren) {
946  setTimeout(function(){
947    var contentPopupHeight = 0;
948    var wrapperPopupElementHeight = parseInt(wrapperPopupElement.height());
949    if(typeof searchChildren == "number" && searchChildren == 1) {
950      wrapperPopupElement.children().each(function(){
951        contentPopupHeight = contentPopupHeight + parseInt($(this).outerHeight(true));
952      });
953    } else if(typeof searchChildren == "object") {
954      contentPopupHeight = parseInt(searchChildren.outerHeight(true));
955    }
956
957    if((contentPopupHeight - 10) > wrapperPopupElementHeight)
958      wrapperPopupElement.addClass("scrollVisibleOnPopup");
959  }, 100);
960}
961
962function bodyClasses() {
963    if(navigator.appVersion.indexOf("Mac")!=-1)
964        $("body").addClass("MacOS");
965
966    else if(/win/.test(navigator.platform.toLowerCase()))
967        $("body").addClass("windows");
968
969    if(/firefox/.test(navigator.userAgent.toLowerCase()))
970        $("body").addClass("firefox");
971
972    else
973        if(/apple/.test(navigator.vendor == undefined ? false : navigator.vendor.toLowerCase()))
974            $("body").addClass("safari");
975
976    else if(document.documentMode) {
977        $("body").addClass("ie");
978
979        var IEVersion = document.documentMode;
980        for(var iev = IEVersion; iev <= 11; iev++) {
981            $("body").addClass("lt-ie" + (iev + 1));
982        }
983    }
984
985    if(typeof MobileDetect == "function") {
986        if(md.os() != null)
987            $("body").addClass(md.os());
988    }
989
990    viewportModify();
991}
992
993function RDC_LOAD_FILE(files) {
994  if(typeof files != "object") return false;
995
996  if(files.length == 0) return false;
997
998  if(window["files_script"] == undefined || window["files_style"] == undefined) {
999    window["files_script"] = [];
1000    $.each(document.getElementsByTagName('script'), function(key, arr){
1001      if(arr.src == "" || arr.src == undefined) return;
1002      var filename = arr.src.replace(/^.*[\\\/]/, '').split("?")[0];
1003          filename = filename.substring(0, filename.length - 3);
1004      if(window["files_script"].indexOf(filename) < 0) window["files_script"].push(filename);
1005    });
1006
1007    window["files_style"] = [];
1008    $.each(document.getElementsByTagName('link'), function(key, arr){
1009      if(arr.href == "" || arr.href == undefined || arr.rel != "stylesheet") return;
1010      var filename = arr.href.replace(/^.*[\\\/]/, '').split("?")[0];
1011          filename = filename.substring(0, filename.length - 4);
1012      if(window["files_style"].indexOf(filename) < 0) window["files_style"].push(filename);
1013    });
1014  }
1015
1016  $.each(files, function(key, file){
1017    var filename = file.replace(/^.*[\\\/]/, '').split("?")[0];
1018    var fileextension = file.replace(/^.*[\\\/]/, '').split("?")[0].substring(filename.length - 2, filename.length);
1019    if(fileextension == "ss") fileextension = "css";
1020    var filename = filename.substring(0, filename.length - (fileextension.length + 1));
1021
1022    if(fileextension == "css") {
1023      if(window["files_style"].indexOf(filename) >= 0) {
1024        if(window["files_script"].indexOf(filename) < 0) {
1025          window["files_script"].push(filename);
1026        }
1027        return false;
1028      }
1029
1030      window["files_style"].push(filename);
1031
1032      var fileStyle       = document.createElement('link');
1033          fileStyle.rel   = "stylesheet";
1034          fileStyle.type  = "text/css";
1035          fileStyle.href  = file;
1036      $("#main").prepend(fileStyle);
1037
1038    } else if(fileextension == "js") {
1039      if(window["files_script"].indexOf(filename) >= 0) return;
1040
1041      window["files_script"].push(filename);
1042
1043      var fileScript     = document.createElement('script');
1044          fileScript.src = file;
1045          fileScript.type = 'text/javascript';
1046      document.head.appendChild(fileScript);
1047
1048    }
1049
1050  });
1051}
1052
1053function allowedUserAgent() {
1054    if(navigator.userAgent.indexOf("Chrome-Lighthouse") > -1)
1055        return false;
1056
1057    return true;
1058}
1059
1060(window.lockWindowScroll = function(){
1061    var _th = { elements: [], searchScrollTop: 0, documentEnabled: true, alreadyLocked: false };
1062
1063    _th.lock = function() {
1064        _th.alreadyLocked = false;
1065       
1066        if(lockWindowScroll.islock() == true) {
1067            _th.alreadyLocked = true;
1068            return   
1069        }
1070
1071        const fixedContentPos = $.magnificPopup && $.magnificPopup.instance.st ? $.magnificPopup.instance.st.fixedContentPos : true;
1072        if(!fixedContentPos) return false;
1073
1074        $("html").css("overflow", "hidden");
1075
1076        if($('#header').length > 0 && ($('#header').css('position') == 'fixed' || $('#header').css('position') == 'absolute'))
1077            _th.elements.push({element: '#header', 'paddingRight': $('#header').css('padding-right')});
1078        if($('#footer').length > 0 && ($('#footer').css('position') == 'fixed' || $('#footer').css('position') == 'absolute'))
1079        _th.elements.push({element: '#footer', 'paddingRight': $('#footer').css('padding-right')});
1080        if($('#product-bar').length > 0 && ($('#product-bar').css('position') == 'fixed' || $('#product-bar').css('position') == 'absolute'))
1081            _th.elements.push({element: '#product-bar', 'paddingRight': $('#product-bar').css('padding-right')});
1082        if($('#inline-notification-bar').length >
1082 0 && $('#inline-notification-bar').css('position') == 'absolute')
1083            _th.elements.push({element: '#inline-notification-bar', 'paddingRight': $('#inline-notification-bar').css('padding-right')});
1084
1085        $('body').addClass("rdc-scroll-padding-right");
1086
1087        $.each(_th.elements, function(key, value){
1088            $(value.element).addClass('rdc-scroll-padding-right');
1089        });
1090
1091        _th.lockSearchContainer();
1092
1093        if(typeof headroom != "undefined" && typeof headroom.freeze == "function")
1094            headroom.freeze();
1095
1096        if(typeof bodyScrollLock == 'function') bodyScrollLock.disableBodyScroll();
1097    }
1098
1099    _th.unlock = function(force) {
1100        if(force == null || force == false) {
1101            if(_th.alreadyLocked) {
1102                _th.alreadyLocked = false;
1103                return  
1104            }
1105
1106            var rootScope = angular.element(document.body).scope().$root;
1107            if (rootScope && rootScope.header && rootScope.header.search && rootScope.header.search.active) {
1108                return;
1109            }
1110        }
1111
1112        $("html").css("overflow", "auto");
1113
1114        $('.rdc-scroll-padding-right').removeClass('rdc-scroll-padding-right');
1115
1116        _th.unlockSearchContainer();
1117
1118        if(typeof headroom != "undefined" && typeof headroom.unfreeze == "function")
1119            headroom.unfreeze();
1120
1121        if(typeof bodyScrollLock == 'function') bodyScrollLock.enableBodyScroll();
1122    }
1123
1124    _th.lockSearchContainer = function() {
1125        const diferentWindow = window.self !== window.parent;
1126        const contentWindow = diferentWindow ? window.parent : window.self;
1127        
1128        try {
1129            if (contentWindow && contentWindow.document) {
1130                _th.documentEnabled = true;
1131            }
1132        } catch (error) {
1133            _th.documentEnabled = false;
1134        }
1135
1136        if(!_th.documentEnabled) return false;
1137
1138        const scrollable = $('#header-container-search', contentWindow.document);
1139
1140        if(!(diferentWindow && $('body').hasClass('params-oc') && scrollable.length > 0))
1141            return;
1142
1143        _th.searchScrollTop = scrollable.scrollTop();
1144
1145        document.documentElement.style.setProperty("--search-container-height", _th.searchScrollTop + 'px');
1146
1147        scrollable.css({
1148          'overflow-y': 'hidden',
1149          'position': 'relative',
1150        }).scrollTop(0);
1151
1152        scrollable.find('> div').css({
1153          'position': 'relative',
1154          'top': -_th.searchScrollTop + 'px',
1155        });
1156    }
1157
1158    _th.unlockSearchContainer = function() {
1159        if(!_th.documentEnabled) return false;
1160
1161        document.documentElement.style.setProperty("--search-container-height", '');
1162
1163        var scrollable = $('#header-container-search', window.self.document);
1164        
1165        if(scrollable.length == 0)
1166            scrollable = $('#header-container-search', window.parent.document);
1167        
1168        if(scrollable.length == 0)
1169            return;
1170
1171        scrollable.css('overflow-y', 'auto');
1172        scrollable.find('> div').css('top', '0');
1173        scrollable.scrollTop(_th.searchScrollTop);
1174    }
1175
1176    lockWindowScroll.lock = _th.lock;
1177    lockWindowScroll.unlock = _th.unlock;
1178    lockWindowScroll.islock = function(){
1179        return $('body').hasClass('rdc-scroll-padding-right');
1180    }
1181})();
1182
1183(customSelect = function(){
1184    var old__padLeft = 0;
1185
1186    var csSelect = {
1187        create: function(selectCustom) {
1188            if($('#rdc-custom-select__styles').length == 0) {
1189                $('<div id="rdc-custom-select__styles">').appendTo('#main');
1190            }
1191
1192            let $targets = null;
1193
1194            if (selectCustom && $(selectCustom).hasClass('rdc-custom-select')) {
1195                $targets = $(selectCustom);
1196            } else {
1197                $targets = $('.rdc-custom-select');
1198            }
1199
1200            $targets.each(function() {
1201                _select = $(this);
1202                if(_select.length == 0 || !_select.hasClass("select")) return;
1203
1204                _select.find('.rdc-select-list').remove();
1205                _select.parent().addClass('rdc-custom-select__wrapper')
1206
1207                _html = '<div class="rdc-select-list custom-scrollbar slim-scrollbar">';
1208
1209                var hiddenSelect = _select.find("select")
1210
1211                _select.find("option").each(function(){
1212                    _option = $(this);
1213                    _value = _option.val();
1214                    _disabled = _option.prop("disabled");
1215                    _size_code = _option.attr('size_code');
1216                    _pid = _option.data('pid');
1217
1218                    if(_value == 0 || _value == '? object:null ?') return; /* Esconder a opção selecione */
1219
1220                    _text = _option.text();
1221
1222                    _style = '';
1223
1224                    if(_option.data('image') != undefined && _option.data('image') != '') {
1225                        _image = _option.data('image');
1226                        _style = 'style="background-image: url('+_image+');padding-left: 50px;"';
1227                    } 
1228                    
1229                    _sel = ''; 
1230
1231                    if(_value == hiddenSelect.val()) {
1232                        _sel = 'sel';
1233                    }
1234
1235                    /* Ex:
1236
1237                    const selectListOption = {
1238                        html: `<span class="item-name">%text%</span>%lastUnits%%stockAlert%`,
1239                        lastUnits: `<span class="rdc-icon-svg rdc-icon-info-stock"></span>`,
1240                        stockAlert: `<span class="rdc-icon-svg rdc-icon-notification-em"></span>`
1241                    }
1242                        
1243                    */
1244
1245                    let finalHtml = '';
1246                   
1247                    if (Boolean(_option.attr('rdc-before-opt'))) {
1248                        let pev_opt_el = $('<div/>').html(_option.attr('rdc-before-opt')).html() || '';
1249                        finalHtml += pev_opt_el;
1250                    }
1251                   
1252                   finalHtml += `<span>${_text}</span>`;
1253
1254                    if(typeof selectListOption != 'undefined') {
1255                        finalHtml = csSelect.replaceOptions(selectListOption.html, selectListOption);
1256                    }
1257                    
1258                    _html += `<div class="rdc-select-list-option ${_sel}" disabled="${_disabled}" data-value="${_value}" ${_pid ? `data-pid="${_pid}"` : ``} data-size_code="${_size_code}" data-text="${_text}" ${_style} role="button" tabindex="0">${finalHtml}</div>`;
1259                });
1260
1261                _html += '<div>';
1262
1263                _select.addClass("select__customlist").append(_html);
1264
1265                // onCreate callback
1266                const onCreateCallback = _select.data('oncreate');
1267                if(onCreateCallback) eval(onCreateCallback);
1268            });
1269
1270            
1271        },
1272        replaceOptions: (html, options) => {
1273            var html = html.replace('%text%', _text)
1274
1275            if (csSelect.replaceLastUnits()) {
1276                html = html.replace('%lastUnits%', options.lastUnits);
1277            } else {
1278                html = html.replace('%lastUnits%', '');
1279            }
1280        
1281            if (csSelect.replaceStockAlert()) {
1282                html = html.replace('%stockAlert%', options.stockAlert);
1283            } else {
1284                html = html.replace('%stockAlert%', '');
1285            }
1286        
1287            return html;
1288        },
1289        replaceLastUnits: () => {
1290            if(_option.attr('stock') <= 1 && _option.attr('last_units') > 0 ) return true;
1291        },
1292        replaceStockAlert: () => {
1293            if(_option.attr('alert_stock') == 1) return true;
1294        }
1295
1296    }
1297
1298    customSelect.create = csSelect.create;
1299
1300    $(document).ready(function(){
1301        if($('.rdc-custom-select').length > 0) {
1302            setTimeout(function(){
1303                csSelect.create();
1304            });
1305        }
1306
1307        $("body").on("click", ".rdc-custom-select__wrapper .select__customlist", function(ev){
1308            if($(this).hasClass('loading') || $(this).find("select").prop("disabled")) return;
1309
1310            if($("#rdc-custom-select__styles #customSelectStylesList").length == 0) {
1311                _brdColor = $(this).css("border-color");
1312                _fontSize = $('select', this).css("font-size");
1313                $("#rdc-custom-select__styles").append('<style type="text/css" id="customSelectStylesList">.select__customlist.active, .select__customlist.active .rdc-select-list {border-color: '+_brdColor+';}.rdc-select-list .rdc-select-list-option {font-size: '+_fontSize+';}</style>');
1314            }
1315
1316            _padLeft = $("select", this).css("padding-left");
1317            if(_padLeft != old__padLeft) {
1318                $("#customSelectStylesListOption").remove();
1319                old__padLeft = _padLeft;
1320
1321                $("#rdc-custom-select__styles").append('<style type="text/css" id="customSelectStylesListOption">.rdc-select-list .rdc-select-list-option {padding-left: '+_padLeft+';font-size: '+_fontSize+';}@-moz-document url-prefix() {.rdc-select-list .rdc-select-list-option {padding-left: '+(parseInt(_padLeft) + 4)+'px;}}</style>');
1322            }
1323
1324            $(".select__customlist.active").not(this).closest('article').removeClass('cs_select_visible');
1325            $(".select__customlist.active").not(this).removeClass("active");
1326            $(this).closest('article').toggleClass('cs_select_visible');
1327            $(this).toggleClass("active");
1328
1329        }).on("click keydown", ".rdc-select-list-option", function(ev){
1330            const isClick = ev.type === 'click';
1331            const isKey = ev.type === 'keydown' && (ev.key === 'Enter' || ev.key === ' ') && $(this).is(":focus-visible");
1332
1333            if(isClick || isKey) {
1334                ev.stopPropagation();
1335
1336                _elem = $(this);
1337                _elem.closest('.rdc-custom-select').find('.sel').removeClass('sel');
1338                _elem.addClass('sel');
1339
1340                _value = _elem.data("value");
1341                _pid = _elem.data("pid");
1342                _text = _elem.text();
1343
1344                _select = $(_elem.closest('.rdc-custom-select').find('select'));
1345                
1346                if(_pid)
1347                    var _option = _select.find('option[data-pid="' + _pid + '"]');
1348                else
1349                    var _option = _select.find('option[value="' + _value + '"]');
1350                
1351                _option.prop("selected", true).text(_text);
1352                _select.trigger("change");
1353
1354                $(".select__customlist.active").toggleClass("active");
1355                $('article.cs_select_visible').toggleClass('cs_select_visible');
1356            }
1357        });
1358
1359        $("body").click(function(ev){
1360            $target = $(ev.target);
1361            if($(".select__customlist.active").length > 0) {
1362                if(!$target.hasClass("select__customlist") && $target.closest("select__customlist").length == 0) {
1363                    $(".select__customlist.active").removeClass("active");
1364                    $('article.cs_select_visible').removeClass('cs_select_visible');
1365                }
1366            }
1367        });
1368    });
1369})();
1370
1371function productCountdown() {
1372    var _c = {
1373        resources: {},
1374        countdowns: [],
1375        init: function(){
1376            let countdownModal = $('.rdc-product-countdown').parent().is('#rdc-productdetail-countdown') && $('.rdc-product-countdown').parents('#rdc-popup-variants').length > 0 ? true : false;
1377
1378            if(countdownModal){
1379                _c.countdowns = $('.rdc-product-countdown:not(.initialized)');
1380            }else{
1381                _c.countdowns = $('.rdc-product-countdown:not(.initialized):visible');
1382            }
1383
1384            if(_c.countdowns.length == 0)
1385                return;
1386
1387            $.each(_c.countdowns, function(){
1388                var id = Math.random().toString(36).replace(/[^a-z]+/g, '').substr(2, 10);
1389                _c.resources[id] = {
1390                    id: Math.random().toString(36).replace(/[^a-z]+/g, '').substr(2, 10),
1391                    date: $(this).data('date'),
1392                    colorTitleText: $(this).data('color-title-text') || 'white',
1393                    colorTitleBackground: $(this).data('color-title-background') || 'black',
1394                    colorTextText: $(this).data('color-text-text') || 'black',
1395                    colorTextBackground: $(this).data('color-text-background') || 'white',
1396                    expTitle: $(this).data('exp-title') || 'Coming Soon',
1397                    exp485: $(this).data('exp485') || 'Days',
1398                    exp653: $(this).data('exp653') || 'Hrs',
1399                    exp654: $(this).data('exp654') || 'Mins',
1400                    exp655: $(this).data('exp655') || 'Segs'
1401                }
1402
1403                if(_c.resources[id].date.length != 19) {
1404                    return;
1405                }
1406
1407                window['dateCountdown_' + _c.resources[id].id] = new Date(_c.resources[id].date.replace(' ', 'T')).getTime();
1408
1409                $(this).find('.rdc-product-container-countdown').remove();
1410                $(this).addClass('initialized').append(_c.getHTML(_c.resources[id]));
1411
1412                window['x_' + _c.resources[id].id] = setInterval(function(resource){
1413                    window['dateCountdown_func_' + _c.resources[id].id](resource);
1414                }, 1000, _c.resources[id]);
1415
1416                if(window['dateCountdown_func_' + _c.resources[id].id](_c.resources[id]) < 0) {
1417                    $("#" + _c.resources[id].id).closest('.rdc-product-countdown').remove();
1418                }
1419            });
1420        },
1421        getHTML: function(resource){
1422            var timeHTML = _c.getTime(resource);
1423            var isTitleColored = resource.colorTitleBackground && resource.colorTitleBackground.toUpperCase() != "#FFFFFF";
1424            var HTML = '<div class="rdc-product-container-countdown" id="'+resource.id+'" style="text-align: center;">'+
1425                '<div class="rdc-product-countdown-title" style="background-color: '+resource.colorTitleBackground+';color: '+resource.colorTitleText+';line-height: 100%;padding: 4px;'
1426                    +(isTitleColored 
1427                        ? 'border-top-left-radius: var(--input-border-radius, 6px);border-top-right-radius: var(--input-border-radius, 6px);' 
1428                        : '')+'">'+resource.expTitle+'</div>'+
1429                '<div class="rdc-product-wrapper-countdown" style="padding: 6px 0;background-color: '+resource.colorTextBackground+';border-bottom-left-radius: var(--input-border-radius, 6px);border-bottom-right-radius: var(--input-border-radius, 6px);'
1430                    +(!isTitleColored 
1431                        ? 'border-top-left-radius: var(--input-border-radius, 6px);border-top-right-radius: var(--input-border-radius, 6px);' 
1432                        : '')+'">'+
1433                    '<div class="rdc-product-countdown-id" style="display: flex;justify-content: center;">'+
1434                        timeHTML+
1435                    '</div>'+
1436                '</div>'+
1437            '</div>';
1438            
1439            return HTML;
1440        },
1441        getTime: function(resource){
1442            window['dateCountdown_func_' + resource.id] = function(resource){
1443                var distance = window['dateCountdown_' + resource.id] - new Date().getTime();
1444                var days = Math.floor(distance / (1000 * 60 * 60 * 24));
1445                var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
1446                var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
1447                var seconds = Math.floor((distance % (1000 * 60)) / 1000);
1448                var HTML_ELEMENT = '';
1449
1450                days = String(days).padStart(2, '0');
1451                hours = String(hours).padStart(2, '0');
1452                minutes = String(minutes).padStart(2, '0');
1453                seconds = String(seconds).padStart(2, '0');
1454
1455                if(days > 0) {
1456                    HTML_ELEMENT += '<div class="rdc-product-countdown-days">'+
1457                                        '<span class="rdc-product-countdown-nr rdc-product-countdown-days list-nav-subtitle" style="display: block;position: relative;padding: 0;font-family: \'RobotoMono\', \'Courier\', Monospace;color: '+resource.colorTextText+';line-height: 100%;">'+days+'</span>'+
1458                                        '<span class="rdc-product-countdown-desc" style="display: block;padding: 0 !important;text-transform: uppercase;color: '+resource.colorTextText+';">'+resource.exp485+'</span>'+
1459                                    '</div>';
1460                }
1461
1462                HTML_ELEMENT += '<div class="rdc-product-countdown-days">'+
1463                                    '<span class="rdc-product-countdown-nr rdc-product-countdown-hours list-nav-subtitle" style="display: block;position: relative;padding: 0;font-family: \'RobotoMono\', \'Courier\', Monospace;color: '+resource.colorTextText+';line-height: 100%;">'+hours+'</span>'+
1464                                    '<span class="rdc-product-countdown-desc" style="display: block;padding: 0 !important;text-transform: uppercase;color: '+resource.colorTextText+';">'+resource.exp653+'</span>'+
1465                                '</div>'+
1466                                '<div class="rdc-product-countdown-days">'+
1467                                    '<span class="rdc-product-countdown-nr rdc-product-countdown-minutes list-nav-subtitle" style="display: block;position: relative;padding: 0;font-family: \'RobotoMono\', \'Courier\', Monospace;color: '+resource.colorTextText+';line-height: 100%;">'+minutes+'</span>'+
1468                                    '<span class="rdc-product-countdown-desc" style="display: block;padding: 0 !important;text-transform: uppercase;color: '+resource.colorTextText+';">'+resource.exp654+'</span>'+
1469                                '</div>'+
1470                                '<div class="rdc-product-countdown-days">'+
1471                                    '<span class="rdc-product-countdown-nr rdc-product-countdown-secounds list-nav-subtitle" style="display: block;position: relative;padding: 0;font-family: \'RobotoMono\', \'Courier\', Monospace;color: '+resource.colorTextText+';line-height: 100%;">'+seconds+'</span>'+
1472                                    '<span class="rdc-product-countdown-desc" style="display: block;padding: 0 !important;text-transform: uppercase;color: '+resource.colorTextText+';">'+resource.exp655+'</span>'+
1473                                '</div>';
1474
1475                if (distance < 0) {
1476                    clearInterval(window['x_' + resource.id]);
1477                    $("#" + resource.id).closest('.rdc-product-countdown').remove();
1478                }
1479
1480                $("#" + resource.id).find('.rdc-product-countdown-id').html(HTML_ELEMENT);
1481
1482                return HTML_ELEMENT;
1483            }
1484
1485            return window['dateCountdown_func_' + resource.id](resource);
1486        },
1487        destroy: function(resourceId){
1488            if(resourceId == undefined) return;
1489
1490            clearInterval(window['x_' + resourceId]);
1491
1492            delete window['dateCountdown_' + resourceId];
1493            delete window['x_' + resourceId];
1494            delete window['dateCountdown_func_' + resourceId];
1495
1496            $('#' + resourceId).closest('.rdc-product-countdown').removeClass('initialized');
1497            $('#' + resourceId).remove();
1498        }
1499    }
1500
1501    _c.init();
1502
1503    productCountdown.destroy = _c.destroy;
1504}
1505
1506function itemRating() {
1507    $('.rating').each(function(){
1508        const rating = $(this).attr('data-rating');
1509
1510        $(this).html('');
1511
1512        for(i = 0; i < 5 ; i++){
1513            var starElement = $('<span class="rdc-icon-svg"></span>');
1514
1515            if(i < parseInt(rating)){
1516                starElement.addClass('sel rdc-icon-star-full');
1517            } else {
1518                starElement.addClass('rdc-icon-star-empty');
1519            }
1520
1521            $(this).append(starElement);
1522        }
1523
1524        if(rating > parseInt(rating)) {
1525            $($('span', this)[parseInt(rating)]).addClass("sel2 rdc-icon-star-half").removeClass("rdc-icon-star-empty");
1526        }
1527    });
1528
1529    $('.rating-bar').each(function(){
1530        const rating = $(this).attr('data-rating');
1531
1532        $(this).html('');
1533
1534        for(i = 0; i < 5 ; i++){
1535            var starElement = $('<span class="rdc-icon-svg"></span>');
1536
1537            if($(this).hasClass('top-bar')) {
1538                if(i == (parseInt(rating) - 1) ){
1539                    starElement.addClass('sel');
1540                }
1541            } else {
1542                if(i < parseInt(rating)){
1543                    starElement.addClass('sel');
1544                }
1545            }
1546                
1547            $(this).append(starElement);
1548        }
1549
1550        if(rating > parseInt(rating)) {
1551            $($('span', this)[parseInt(rating)]).addClass("sel2 rdc-icon-star-half").removeClass("rdc-icon-star-empty");
1552        }
1553    });
1554}
1555
1556/*
1557 * Abre o popup anterior à instância atual
1558 */
1559
1560// ANIMATED VERSION
1561var isForwardNavigationAnimated = false;
1562var popupReopeningAnimated = false;
1563var popupStackAnimated = [];
1564
1565(function () {
1566    const originalClose = $.magnificPopup.instance.close;
1567
1568    $.magnificPopup.instance.close = function () {
1569
1570        if (!isForwardNavigationAnimated && popupStackAnimated.length > 0 && !popupReopeningAnimated) {
1571            popupReopeningAnimated = true;
1572
1573            const lastTrigger = popupStackAnimated.pop();
1574            const delay = $.magnificPopup.instance.st.removalDelay || 0;
1575
1576            setTimeout(function () {
1577                lastTrigger.trigger('click');
1578                popupReopeningAnimated = false;
1579            }, delay + 50);
1580        }
1581
1582        originalClose.call(this);
1583    };
1584})();
1585
1586// Bloqueios a abertura de popups
1587(function () {
1588    const mfp = $.magnificPopup.instance;
1589    const originalOpen = mfp.open;
1590
1591    // Elementos que, quando visiveis, impedem a abertura
1592    const blockingSelectors = [
1593        '.rcc-search-widget-wrapper'
1594    ];
1595
1596    mfp.open = function () {
1597        if ($(blockingSelectors.join(',')).is(':visible')) return;
1598
1599        return originalOpen.apply(this, arguments);
1600    };
1601})();
1602
1603function openOldInstanceAnimated(elTrigger) {
1604    let currentAnimationTime = 0;
1605
1606    if ($.magnificPopup.instance.currItem != null) {
1607        const previousTrigger = $($.magnificPopup.instance.currItem.el);
1608        currentAnimationTime = $.magnificPopup.instance.st.removalDelay || 0;
1609
1610        popupStackAnimated.push(previousTrigger);
1611        isForwardNavigationAnimated = true;
1612
1613        $.magnificPopup.close();
1614    }
1615
1616    const safetyVal = currentAnimationTime > 0 ? currentAnimationTime + 50 : 0;
1617
1618    setTimeout(function () {
1619        isForwardNavigationAnimated = false;
1620        elTrigger.trigger('click');
1621    }, safetyVal);
1622}
1623
1624// CLEAR ON CLOSE DRAG
1625window.closeDragPopup = () => {
1626    popupStackAnimated = [];
1627    popupStack = []; 
1628}
1629
1630// STRAIGHT FORWARD VERSION
1631var popupStack = [];
1632let restoringFromStack = false;
1633let navigatingForward = false;
1634
1635(function () {
1636    const mfp = $.magnificPopup.instance;
1637    const originalClose = mfp.close;
1638
1639    mfp.close = function () {
1640
1641        if (!navigatingForward && popupStack.length && !restoringFromStack) {
1642            restoringFromStack = true;
1643
1644            const last = popupStack.pop();
1645
1646            setTimeout(() => {
1647                last.trigger('click');
1648                restoringFromStack = false;
1649            }, 0);
1650
1651            return;
1652        }
1653
1654        originalClose.call(this);
1655    };
1656})();
1657
1658function openOldInstance(elTrigger) {
1659    const instance = $.magnificPopup.instance;
1660
1661    if (instance && instance.isOpen && instance.currItem && instance.currItem.el) {
1662        popupStack.push($(instance.currItem.el));
1663        navigatingForward = true;
1664    }
1665
1666    elTrigger.trigger('click');
1667
1668    setTimeout(() => navigatingForward = false, 0);
1669}
1670
1671/* Tooltip Box */
1672$(document).ready(function(){
1673    (function ($) {
1674        const isMobile = () => window.innerWidth < 768;
1675        let tooltipTimeout = null;
1676
1677        function openTooltipModal($box) {
1678            if(tooltipTimeout) clearTimeout(tooltipTimeout);
1679
1680            const content = $box.find('.rdc-tooltip-box-content-wrapper').html();
1681            tooltipTimeout = setTimeout(() => {
1682                rdcModel.open({ content });
1683                tooltipTimeout = null;
1684            }, 50);
1685        }
1686
1687        function showTooltip($box) {
1688            $box.closest('article.product-item, .productDetailMiniBarPosition0').addClass('tooltip-box-visible');
1689            $box.find('.rdc-tooltip-box-content-wrapper')
1690                .stop(true, true).fadeIn(150);
1691        }
1692
1693        function hideTooltip($box) {
1694            $box.find('.rdc-tooltip-box-content-wrapper')
1695                .stop(true, true).fadeOut(150, function(){
1696                    $box.closest('.tooltip-box-visible').removeClass('tooltip-box-visible');
1697                });
1698        }
1699
1700        $('body')
1701            // Desktop: hover
1702            .on('mouseenter', '.rdc-tooltip-box', function (e) {
1703                if (!isMobile()) {
1704                    e.preventDefault();
1705                    e.stopPropagation();
1706                    showTooltip($(this));
1707                }
1708            })
1709            .on('mouseleave', '.rdc-tooltip-box', function () {
1710                if (!isMobile()) hideTooltip($(this));
1711            })
1712            .on('click', '.rdc-tooltip-box', function (e) {
1713                e.preventDefault();
1714                e.stopPropagation();
1715                    
1716                if (isMobile()) {
1717                    openTooltipModal($(this));
1718                } else {
1719                    showTooltip($(this));
1720                }
1721            })
1722            .on('click', '.rdc-tooltip-box-content-wrapper', function (e) {
1723                e.preventDefault();
1724                e.stopPropagation();
1725                e.stopImmediatePropagation();
1726                hideTooltip($(this).parent());
1727            });
1728    })(jQuery);
1729});
1730
1731
1732/*
1733 * Acessibilidade
1734 * Módulo central para melhorias de navegação via teclado e suporte a interações.
1735 */
1736const Accessibility = (function() {
1737    const focusableSelector = 'a, button, input, textarea, select, [tabindex]';
1738    const inputFocusSelector = 'input[type="text"], input[type="number"], input[type="date"], input[type="email"], input[type="password"], input[type="file"], input[type="tel"], input[type="search"], textarea';
1739
1740    let userUsedKeyboard = false;
1741
1742    function setFocusableState($target, isVisible) {
1743        const $el = $target instanceof jQuery ? $target : $($target);
1744        if ($el.length == 0) return;
1745
1746        const $focusables = $el.is(focusableSelector) ? $el : $el.find(focusableSelector);
1747
1748        $focusables.each(function () {
1749            const $item = $(this);
1750            const tabindex = parseInt($item.attr('tabindex'), 10);
1751            const prevTabindex = $item.data('prev-tabindex');
1752
1753            if ($item.hasClass('error') || $item.is('form') || Boolean($item.closest('.popUp').length)) return;
1754
1755            if (!isVisible) {
1756                $item.data('prev-tabindex', tabindex);
1757                $item.attr('tabindex', -1);
1758                return;
1759            }
1760
1761            if (tabindex < 0 || prevTabindex != undefined) {
1762                // Só elementos elegíveis recebem tabindex
1763                if (
1764                    !$item.prop('readonly') &&
1765                    !$item.prop('disabled') &&
1766                    !($item.hasClass('popup') && !$item.attr('title')) &&
1767                    !$item.attr('aria-hidden') &&
1768                    $item.closest('[inert]').length == 0 &&
1769                    $item.is(':visible')
1770                ) {
1771                    $item.data('prev-tabindex', tabindex);
1772                    $item.attr('tabindex', 0);
1773                } else {
1774                    // Se não for elegível, mantém tabindex -1
1775                    $item.attr('tabindex', -1);
1776                }
1777            }
1778        });
1779    }
1780
1781    function setupCustomButtonActivation() {
1782        $('body').on('keydown', function(event) {
1783            const $el = $(event.target);
1784
1785            const isCustomButton =
1786                $el.attr('role') === 'button' &&
1787                $el.attr('tabindex') == 0;
1788
1789            if (!isCustomButton) return;
1790
1791            if (event.key === 'Enter' || event.key === ' ') {
1792                if ($el.is('[onclick]')) {
1793                    event.preventDefault();
1794
1795                    const onclickCode = $el.attr('onclick');
1796
1797                    if (onclickCode) {
1798                        try {
1799                            new Function(onclickCode).call($el[0]);
1800                        } catch (e) {
1801                            // console.error('Erro ao executar onclick:', e);
1802                        }
1803                    }
1804                }
1805            }
1806        });
1807    }
1808
1809    function setupFocusVisibleHandling() {
1810        $(window).on('keydown', () => { userUsedKeyboard = true; });
1811        $(window).on('mousedown touchstart', () => { userUsedKeyboard = false; });
1812
1813        $(document).on('focus', 'select,' + inputFocusSelector, function () {
1814            if (!userUsedKeyboard) return;
1815
1816            const $el = $(this);
1817
1818            if ($el.is('select')) {
1819                $el.closest('.select').addClass('focus-visible');
1820            } else {
1821                $el.addClass('focus-visible');
1822            }
1823        });
1824
1825        $(document).on('blur', 'select,' + inputFocusSelector, function () {
1826            const $el = $(this);
1827
1828            if ($el.is('select')) {
1829                $el.closest('.select').removeClass('focus-visible');
1830            } else {
1831                $el.removeClass('focus-visible');
1832            }
1833        });
1834    }
1835
1836    function init() {
1837        setupCustomButtonActivation();
1838        setupFocusVisibleHandling();
1839    }
1840
1841    return {
1842        init,
1843        setFocusableState,
1844        get userUsedKeyboard() {
1845            return userUsedKeyboard;
1846        }
1847    };
1848})();
1849
1850// Inicializar funcionalidades ao carregar o documento
1851$(document).ready(function() {
1852    Accessibility.init();
1853});
1854
1855/* Normaliza o href do trigger para #hash antes do Magnific Popup o ler (ex.: _gl do Google tag) */
1856document.addEventListener('click', function (e) {
1857    const trigger = e.target.closest ? e.target.closest('a.popup[href*="#"]') : null;
1858    if (!trigger) return;
1859
1860    const currentHref = trigger.getAttribute('href');
1861    try {
1862        const hash = new URL(currentHref, location.href).hash;
1863        if (hash && hash !== currentHref) {
1864            trigger.setAttribute('href', hash);
1865        }
1866    } catch (err) {}
1867}, true);
1868
1869/*// MAPS
1870var mapaStyleBase = {
1871  // valores inicial do mapa
1872  distancia: 7,        //distancia para calcular o raio de lojas a pesquisar (à partida não se deve mexer neste valor)
1873  latitude: 39.39987,  //latitude inicial
1874  longitude: -8.22445, //longitude inicial
1875  zoomMapa: 6,         //zoom inicial
1876  // definições do mapa
1877  scrollwheel: false,       //permite fazer zoom no mapa com o scroll
1878  mapTypeControl: false,    //permite mostrar os tipo des mapa a serem exibidos (ex: mapa/satélite)
1879  fullscreenControl: false, //permite abrir o mapa em ecrã inteiro
1880  streetViewControl: false, //permite ativar/desativar o Street View
1881  minZoom: 2,               //zoom minimo do mapa
1882  // área clicável do marker
1883  shapeCoord: [3,4,7,1,10,0,14,0,17,1,20,1,21,3,23,5,24,7,25,9,26,11,27,15,26,17,24,20,24,23,23,24,21,26,19,30,17,32,15,34,14,35,12,35,11,34,8,32,7,29,4,26,3,22,1,19,0,17,0,11,1,7,2,6,3,4], //coordenadas
1884  shapeType: 'poly', //tipo
1885  // icon marker
1886  iconMarkerSrc: 'plugins/system/sysimgs/icon-marker.png', //src do icone
1887  iconMarkerWidth: 32,   //largura do icone
1888  iconMarkerHeight: 32,  //altura do icone
1889  iconMarkerAnchorX: 16, //posição X na qual o ponto de acesso do icone está localizado
1890  iconMarkerAnchorY: 32, //posição Y na qual o ponto de acesso do icone está localizado
1891  // infoBox
1892  infoBoxPixelOffsetPositionX: -174, //posição X da infoBox em relação ao marker
1893  infoBoxPixelOffsetPositionY: -38,  //posição Y da infoBox em relação ao marker
1894  infoBoxWidth: '330px',             //largura da infoBox
1895  infoBoxCloseIcon: '',              //iconclose da infoBox
1896  // icon marker clusterer
1897  iconMarkerClustererSrc: 'plugins/system/sysimgs/icon-marker-clustering.png', //src do icone
1898  iconMarkerClustererWidth: 32,               //largura do icone
1899  iconMarkerClustererHeight: 32,              //altura do icone
1900  iconMarkerClustererAnchorPositionX: 0,      //posição X do texto do marker clusterer
1901  iconMarkerClustererAnchorPositionY: 0,     //posição Y do texto do marker clusterer
1902  iconMarkerClustererTextSize: 12,            //font-size do texto no marker
1903  iconMarkerClustererTextColor: '#FFF',       //cor do texto no marker
1904  iconMarkerClustererTextAnchorPositionX: 0, //posição X na qual o ponto de acesso do icone está localizado
1905  iconMarkerClustererTextAnchorPositionY: 0, //posição Y na qual o ponto de acesso do icone está localizado
1906  // valores zoom
1907  bigZoom: 20,
1908  mediumZoom: 13,
1909  smallZoom: 7,
1910  // raio de pesquisa
1911  circleStrokeColor: '#1a618a', //cor da border
1912  circleStrokeOpacity: 0,       //opacidade da border
1913  circleStrokeWeight: 0,        //largura da border
1914  circleFillColor: '#2d97e6',   //cor de fundo
1915  circleFillOpacity: 0,         //opacidade da cor de fundo
1916  // personalizar cores mapa
1917  styleMap: []
1918}
1919
1920// SLICK SLIDER TPL_BANNER GERAL
1921var geral_banner_settings = {
1922  autoplay: false,
1923  infinite: true,
1924  variableWidth: false,
1925  adaptiveHeight: true,
1926  pauseOnHover: true,
1927  autoplaySpeed: 7000,
1928  speed: isMobileDevice() ? 400 : 1300,
1929  draggable: isMobileDevice() ? true : false,
1930  arrows: isMobileDevice() ? false : true,
1931  dots: isMobileDevice() ? true : false
1932}*/

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.