PageSourceSearch

http://www.huelvashop.com/js/custom_571.js

js huelvashop.com collected 2026-10-05 01:30:19 UTC 14,904 bytes, 299 lines download raw bytes

1var _____WB$wombat$assign$function_____=function(name){return (self._wb_wombat && self._wb_wombat.local_init && self._wb_wombat.local_init(name))||self[name];};if(!self.__WB_pmw){self.__WB_pmw=function(obj){this.__WB_source=obj;return this;}}{
2let window = _____WB$wombat$assign$function_____("window");
3let self = _____WB$wombat$assign$function_____("self");
4let document = _____WB$wombat$assign$function_____("document");
5let location = _____WB$wombat$assign$function_____("location");
6let top = _____WB$wombat$assign$function_____("top");
7let parent = _____WB$wombat$assign$function_____("parent");
8let frames = _____WB$wombat$assign$function_____("frames");
9let opens = _____WB$wombat$assign$function_____("opens");
10function isNumber(n) {
11  return !isNaN(parseFloat(n)) && isFinite(n);
12}
13
14var custom = {
15    isResponsive: false,
16    initialize: function () {
17        this.cachingSystem;
18        this.jQueryInitialize;
19        this.fixActiveMenus;
20    },
21    cachingSystem: (function($){
22        $.caching = function( selector, $ctxt, reset ) {
23            if ( 'boolean' === typeof $ctxt ) { reset = $ctxt; $ctxt = false }
24            var cacheKey = $ctxt ? $ctxt.selector + ' ' + selector : selector;
25            if ( undefined === $.caching.elementCache[ cacheKey ] || reset ) {
26                $.caching.elementCache[ cacheKey ] = $ctxt ? $ctxt.find( selector ) : jQuery( selector );
27            }
28            return $.caching.elementCache[ cacheKey ];
29        };
30        $.caching.elementCache = {};
31        return $.caching;
32    })(jQuery),
33    jQueryInitialize: (function ($) {
34        this.isResponsive = $("#art-resp").is(":visible");
35    })(jQuery),
36    fixActiveMenus: (function ($) {
37        //Active parents elements in Categories art-vmenu and Nav art-hmenu
38        $('.art-vmenu a.active').parents('.art-vmenu > li').find('ul, > a').addClass('active');
39        $('.art-hmenu > li.active').find('> ul, > a').addClass('active');
40    })(jQuery),
41    /* Call to set menu items direction function because otherwise it's only fired by responsive.script */
42    setHMenuOpenDirection: function ($) {
43        if (typeof setHMenuOpenDirection !== 'undefined') {
44            setHMenuOpenDirection({
45                container: "div.art-sheet",
46                defaultContainer: "#art-main",
47                menuClass: "art-hmenu",
48                leftToRightClass: "art-hmenu-left-to-right",
49                rightToLeftClass: "art-hmenu-right-to-left"
50            });
51        }
52    },
53    /* Build NavBar for Responsive*/
54    responsiveNavBar: function() {
55        if (!this.responsiveNavBar.alreadyExecuted && this.isResponsive) {
56            var artNav =  $('.art-nav:not(.art-bar)');
57            var artMenuButton = $('.art-menu-btn').eq(0);
58            //Set MENU label in menu button
59            artMenuButton.click(function(e) {
60                var menu = $('#shop-menu');
61                if (menu.is(":visible")) {
62                    menu.slideUp("fast", function() {$(this).removeClass("visible").css("display", "");});
63                } else {
64                    menu.slideDown("fast", function() {$(this).addClass("visible").css("display", "");});
65                }
66                $('li.customer-shop-menu, li.customer-shop-menu .active').removeClass('active');
67                e.preventDefault();
68            });
69            //Set responsive menu button and art-nav as active when clicked
70            artNav.on('click', '.art-menu-btn', function(e){
71                $(this).add($(this).parents('.art-nav')).toggleClass('active');
72            });
73            //Add submenu-button to menu items on mobile
74            var submenus = $('.art-hmenu a');
75            for (var i = 0, len = submenus.length; i < len; i++) {
76                var submenu = $(submenus[i]);
77                var submenuClass = submenu.hasClass('active') ? 'submenu-button active' : 'submenu-button';
78                if (submenu.next('ul').length > 0 && submenu.attr('href').indexOf('void') === -1 && !submenu.hasClass('customer-shop-menu')){
79                    submenu.after("<a href='javascript:void(0)' class='"+submenuClass+"'></a>");
80                }
81            }
82            $('.art-hmenu li.active > a.submenu-button').addClass("active");
83
84            //Add click behaviour on mobile menu
85            artNav.on('click', '.art-hmenu a:not(.customer-search-menu-form-link)', function(e){
86                var parentsel;
87                if (!$(this).hasClass('active')) {
88                    $('.art-hmenu .active').removeClass('active');
89                    parentsel=$(this).parents('li');
90                } else {
91                    parentsel=$(this).parent();
92                }
93                var nextel = $(this).next('ul');
94                if(nextel.length>0){
95                    $(parentsel).add(parentsel.children('a')).add(nextel).add($(this)).toggleClass('active');
96                }
97                //Focus on search box when clicked on search menu
98                if ($(this).hasClass('customer-search-menu-link') && $(this).hasClass('active')) {
99                    $('#menu-search-input').click().focus();
100                }
101
102            });
103
104            //Detach reponsive MENU from art-nav-inner to allow using flex in it
105            $('.art-nav-inner .art-hmenu').detach().appendTo(artNav);
106            var avoidNextSlide = $('<div>', {'class': 'avoid-next-slide'});
107            avoidNextSlide.insertAfter(artMenuButton);
108
109            //Wrap the customer-shop-menu for mobiles
110            var responsiveCustomerShopMenu = $('li.customer-shop-menu').wrapAll('<ul class="art-hmenu visible" id="responsive-customer-shop-menu"/>').parent();
111
112            //Set logo in responsive menu if present, and add the customer-shop-menu
113            if ($('#header-logo').length > 0) {
114                var menuLogoWrapper = $('<div>', {'class': 'menu-logo-wrapper'});
115                menuLogoWrapper = $('#header-logo .header-logo-link').clone().wrap(menuLogoWrapper).parent();
116                menuLogoWrapper.insertAfter(avoidNextSlide);
117                responsiveCustomerShopMenu.insertAfter(menuLogoWrapper);
118            } else {
119                responsiveCustomerShopMenu.insertAfter(avoidNextSlide);
120            }
121            $('li.customer-shop-menu > ul').prepend('<a class="customer-shop-menu-close">X</a>');
122            $('.customer-shop-menu-close').click(function(){$(this).parents('.active').removeClass('active')});
123            //Remove the customer shop menu links to act only as a menu, and remove the active class inserterd by php when you go to a page with the same url as the link
124            $('a.customer-shop-menu').prop('href', 'javascript:void(0)').removeClass('active');
125            $('li.customer-shop-menu').removeClass('active').find('>ul').removeClass('active');
126
127            this.responsiveNavBar.alreadyExecuted = true;
128
129        } else  if (!this.responsiveNavBar.alreadyExecuted && !this.isResponsive) {
130            var submenus = $('.art-hmenu a');
131            for (var i = 0, len = submenus.length; i < len; i++) {
132                var submenu = $(submenus[i]);
133                if (submenu.next('ul').length>0 && !submenu.hasClass('customer-shop-menu')){
134                    submenu.addClass('art-hmenu-dropdown');
135                }
136            }
137        }
138    },
139    setHeader: function() {
140        var $artNav = $('.desktop .art-header .art-nav');
141        //check not responsive, nav inside header and not top or bottom position
142        if ($artNav.length > 0 && parseInt($artNav.css('bottom')) > 0 && parseInt($artNav.css('top')) > 0 ) {
143            //Avoid navbar overlapping over logo
144            $artNav.css('padding-left',
145                $.caching('#header-logo').offset().left +
146                $.caching('#header-logo').width() -
147                $.caching('.desktop .art-header .art-nav').offset().left + 5
148            );
149        }
150    },
151    setLogo: function() {
152        var leftPosition = Math.abs($.caching('#header-logo').offset().left - $.caching('.art-header').offset().left);
153        var centerPosition = leftPosition + $.caching('#header-logo').width() / 2;
154        var relativePosition = centerPosition / $.caching('.art-header').width();
155
156        if (relativePosition < 0.33) {
157            $.caching('#header-logo').addClass('header-logo-left');
158        } else if (relativePosition >= 0.33 && relativePosition <= 0.66){
159            $.caching('#header-logo').addClass('header-logo-center');
160        } else {
161            $.caching('#header-logo').addClass('header-logo-right');
162        }
163    },
164    responsiveFixedCheckout: function () {
165        var _addToCartForm = $('#addtocart-form');
166        var _addToCartSubmit = $('#addtocart-submit-wrapper');
167        var _productCustomization = $('#product-customization .product-customization-wrapper'); //we use the wrapper class to avoid cases in which id product-customization is present but empty
168        var _productVariants = $('.product-options-dropdown-wrapper');
169        var _productCheckoutCell = $('#product-checkout-cell');
170        if (!this.responsiveFixedCheckout.alreadyExecuted && this.isResponsive
171            && _addToCartForm.length > 0 && _productCustomization.length === 0 && _productVariants.length < 3) {
172            var topOffset = _addToCartSubmit.offset().top + 50; //espacio hasta el checkout + some space
173            var scroller = function () {
174                var scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
175                var isFixed = _addToCartForm.hasClass('addtocart-form-fixed');
176                if (scrollTop > topOffset && !isFixed) {
177                    _productCheckoutCell.height(_addToCartForm.height());
178                    _addToCartForm.hide().addClass('addtocart-form-fixed').fadeIn();
179                } else if (scrollTop < topOffset && isFixed) {
180                    _productCheckoutCell.height('');
181                    _addToCartForm.removeClass('addtocart-form-fixed');
182                }
183            };
184
185            if (window.addEventListener) {
186                window.addEventListener('scroll', scroller, false);
187            } else if (window.attachEvent) {
188                window.attachEvent('onscroll', scroller);
189            }
190            this.responsiveFixedCheckout.alreadyExecuted = true;
191        }
192    },
193    responsiveTables: function() {
194        if (this.isResponsive) {
195            $('table.table-responsive').wrap($('<div>', {'class': 'table-container-outer'})).wrap($('<div>',{'class':'table-container'}));
196        }
197    },
198    megaMenuCreate: (function($) {
199        var sheet = $(".art-sheet");
200        var hmenu = $(".art-hmenu");
201        if (sheet.length == 0 || hmenu.length == 0) { return; }
202        var sheetLeft = sheet.offset().left, sheetWidth = sheet.width();
203        sheetWidth -= (parseInt(hmenu.parents("nav").css("padding-left").replace("px", ""), 10) || 0) * 2;
204
205        // reset
206        $(".pal-hmenu-mega-menu").css("width", "").css("left", "").css("right", "").removeAttr("data-ext-l").removeAttr("data-ext-r").children("li").css("width", "").css("margin-left", "").css("margin-right", "").siblings("li.cleared").remove();
207
208        $(".pal-hmenu-mega-menu").each(function() {
209            var ul = $(this);
210            var ltr = !ul.hasClass("art-hmenu-right-to-left");
211            var widths = [];
212            var horizontalMargin = parseInt($('.pal-hmenu-mega-menu>li>ul>li').css('margin-bottom'), 10);
213            ul.children("li").each(function() {
214                widths.push($(this).width());
215            });
216            var maxWidth = Math.max.apply(window, widths);
217
218            var submenusWidth = maxWidth * widths.length;
219            var minMegaMenuWidth = Math.min(sheetWidth, submenusWidth);
220            var colsPerRow = parseInt(minMegaMenuWidth / maxWidth, 10);
221            var megaMenuWidth = (maxWidth * colsPerRow) + (horizontalMargin > 0 ? horizontalMargin * colsPerRow - 1 : colsPerRow - 1);
222            var parentWidth = ul.parent("li").children("a").outerWidth(false);
223
224            if (submenusWidth > parentWidth) {
225                ul.children("li").css("width", Math.round(parseFloat(maxWidth, 10)) + "px");
226                ul.css("width", Math.round(parseFloat(megaMenuWidth, 10)) + "px");
227            }
228
229            ul.children("li").each(function(index) {
230                $(this).find('> ul > li').first().css("margin-top", horizontalMargin + "px");
231                if (index % colsPerRow !== 0)
232                    $(this).css("margin-left", horizontalMargin + "px");
233            });
234
235            if (submenusWidth > sheetWidth) {
236                var newlineLis = [];
237                ul.children("li").each(function(index) {
238                    if ((index + 1) % colsPerRow === 0) {
239                        newlineLis.push($(this));
240                    }
241                });
242                $(newlineLis).each(function(index, value) {
243                    $("<li class=\"cleared\" style=\"padding-top:2px;float:none;\"></div>").insertAfter(value);
244                });
245            }
246
247            sheetWidth = sheet.outerWidth(false);
248            var li = ul.parent("li");
249            var ulLeft = li.offset().left;
250            var ulWidth = ul.outerWidth(false) - 60;
251            if (ltr) {
252                var leftOffset = 0;
253                if (ulLeft + ulWidth > sheetLeft + sheetWidth) {
254                    leftOffset = (ulLeft + ulWidth) - (sheetLeft + sheetWidth);
255                    ul.css("left", "-" + Math.round(parseFloat(leftOffset, 10)) + "px");
256                    ul.attr("data-ext-l", Math.round(parseFloat(leftOffset, 10)));
257                    ul.attr("data-ext-r", Math.round(parseFloat(ulWidth - leftOffset - li.outerWidth(false), 10)));
258                }
259            } else {
260                var rightOffset = 0;
261                ulLeft = ulLeft + li.outerWidth(false) - ulWidth;
262                if (ulLeft < sheetLeft) {
263                    rightOffset = sheetLeft - ulLeft;
264                    ul.css("right", "-" + Math.round(parseFloat(rightOffset, 10)) + "px");
265                    ul.attr("data-ext-r", Math.round(parseFloat(rightOffset, 10)));
266                    ul.attr("data-ext-l", Math.round(parseFloat(ulWidth - rightOffset - li.outerWidth(false), 10)));
267                }
268            }
269        });
270    })(jQuery),
271    searchForm: (function($) {
272        $(document).on('click', '#menu-search-input-button', function() {
273            $(this).closest('form').submit();
274        });
275    })(jQuery)
276}
277/* Initialize custom */
278custom.initialize();
279
280jQuery(window).on("responsiveResize", function () {
281    custom.isResponsive = $("#art-resp").is(":visible");
282    custom.responsiveNavBar();
283    custom.responsiveFixedCheckout();
284    custom.responsiveTables();
285});
286
287jQuery(window).on("resize", function () {
288    custom.setHeader();
289    custom.setHMenuOpenDirection();
290});
291
292jQuery(window).on("load", function () {
293    // custom.setLogo();
294});
295
296
297
298
299}

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.