PageSourceSearch

https://www.luleg.com.br/custom-js/computer/81bddb9328996bfe1d904506d8a58507/all.js

js luleg.com.br collected 2026-10-06 05:04:47 UTC 20,478 bytes, 296 lines download raw bytes

1const search = document.querySelector('button.search__button');
2  const linhasearch = document.querySelector('.search__input');
3
4  if (search) {
5    function callback() {
6      linhasearch.classList.toggle('ativo');
7    }
8
9    search.addEventListener('click', callback);
10  } $(document).ready(function() {
11     $('.search__button').on('click', function (e) {
12            e.preventDefault();
13           if( $('.search__input').val() == '') {
14               $('.search__input').focus();
15              $('#form-search').toggleClass('search-focus');
16             return false;
17          }
18          if($('.search__input').focus()) {
19              $('#form-search').submit();   
20          }
21       });
22    
23     $('.search__input').blur(function(){
24            $('#form-search').removeClass('search-focus');
25     });
26    })
27    
28$('.search__input').val(''); function loadButtonAndSize() {
29    $('<div class="sizeAndBuy"><div>').insertAfter('body[data-device="computer"] .item .product:not(.updated) .product-list-info');
30    $('.item .product').not( ".updated" ).each(function () {
31        var $size = $(this).find('.product-list-info').find('.description').find('.sizeBox');
32        $(this).find('.sizeAndBuy > div').append($size);
33        $(this).find('.product-list-info').find('.description').find('.sizeBox').remove();
34        
35        var $button = $(this).find('.product-list-info').find('.action-control').find('.btn-more-details');
36        $(this).find('.sizeAndBuy > div').append($button);
37        $(this).find('.product-list-info').find('.action-control').find('.btn-more-details').remove();
38        $(this).addClass('updated')
39    });
40}
41
42if (window.location.href.indexOf("disableJs=true") === -1) {
43    $(document).ready(function(){
44        loadButtonAndSize();
45    });
46    
47    $(document).on('paginator-dinamic-page-loaded', function(e, variantId) { 
48        loadButtonAndSize();
49    });
50} $('.wishlistButton').prependTo('#left-column');
51
52$('.wishlist-add-button')
53  .attr('title', 'Adicionar a lista de desejos')
54  .html('<svg xmlns="http://www.w3.org/2000/svg" fill="black" stroke="black" stroke-width="2" width="22" height="22" class="empty-fav-icon" viewBox="0 0 5120 5120"><path d="M2505 4831c-22-11-161-124-310-252-148-127-416-356-595-508-469-397-546-466-730-650-372-372-611-729-739-1105-153-445-125-857 86-1269 201-393 580-675 1014-753 124-22 327-22 442 0 184 35 385 126 543 244 95 72 248 219 304 295 19 25 37 46 40 46s21-21 40-46c56-76 209-223 304-295 160-120 357-208 546-245 112-21 316-21 439 1 438 79 814 360 1018 762 204 401 233 807 87 1244-128 384-365 742-744 1121-184 184-261 253-730 650-179 152-446 381-595 508-248 214-324 271-365 271-8 0-33-9-55-19zm399-613c188-161 477-408 642-548 461-392 735-676 917-948 228-343 327-630 327-952 0-260-71-496-215-715-50-77-212-240-292-294-129-86-291-153-443-182-110-21-290-14-401 14-276 71-514 258-711 559-74 113-105 138-168 138s-94-25-167-138c-228-347-521-549-847-582-184-18-383 22-571 115-133 65-218 129-318 234-159 170-264 383-311 631-21 108-22 326-2 440 80 452 372 906 889 1381 71 66 330 289 576 498 245 208 514 438 596 509 83 72 151 131 153 131 2 1 157-131 346-291z" style="transform:none"></path></svg>');
55
56$('.wishlist-remove-button')
57  .attr('title', 'Remover da lista de desejos')
58  .html('<?xml version="1.0" encoding="utf-8"?><svg viewBox="0 0 5120 5120" width="22px" height="22px" fill="black" stroke="black" stroke-width="2" xmlns="http://www.w3.org/2000/svg"><path d="M 2505 4831 C 2483 4820 2344 4707 2195 4579 C 2047 4452 1779 4223 1600 4071 C 1131 3674 1054 3605 870 3421 C 498 3049 259 2692 131 2316 C -22 1871 6 1459 217 1047 C 418 654 797 372 1231 294 C 1355 272 1558 272 1673 294 C 1857 329 2058 420 2216 538 C 2311 610 2464 757 2520 833 C 2539 858 2557 879 2560 879 C 2563 879 2581 858 2600 833 C 2656 757 2809 610 2904 538 C 3064 418 3261 330 3450 293 C 3562 272 3766 272 3889 294 C 4327 373 4703 654 4907 1056 C 5111 1457 5140 1863 4994 2300 C 4866 2684 4629 3042 4250 3421 C 4066 3605 3989 3674 3520 4071 C 3341 4223 3074 4452 2925 4579 C 2677 4793 2601 4850 2560 4850 C 2552 4850 2527 4841 2505 4831 Z" style=""/></svg>'); const substituirIcone = setInterval(function () {
59  const iconElement = document.querySelector('.product-detail-popup .fa-check');
60
61  if (iconElement) {
62    const newImg = document.createElement('img');
63    newImg.src = 'https://adaptive-images.uooucdn.com.br/tr:w-iw,q-90/static/images/loja_virtual/luleg/aceitar.png';
64    newImg.alt = 'Ícone de confirmação';
65
66    // Aplicando os estilos via JavaScript
67    newImg.style.fontSize = '120px';
68    newImg.style.display = 'block';
69    newImg.style.margin = '20px auto';
70    newImg.style.color = 'black'; // Apenas decorativo para manter compatibilidade
71
72    iconElement.replaceWith(newImg);
73    clearInterval(substituirIcone);
74  }
75}, 300); $(function () {
76
77  const $codigoCupom = $('#cupom-copy');
78  const $textoCupom  = $('#texto-cupom');
79  const $iconeCupom  = $('#icone-cupom');
80
81  // Um único listener para os três elementos
82  $codigoCupom.add($textoCupom).add($iconeCupom).on('click', copiaCupom);
83
84  async function copiaCupom() {
85    const codigo = $.trim($codigoCupom.text());
86    if (!codigo) return;
87
88    try {
89      await navigator.clipboard.writeText(codigo);
90    } catch (e) {
91      // fallback para navegadores antigos
92      const $temp = $('<textarea>');
93      $temp.val(codigo).appendTo('body').select();
94      document.execCommand('copy');
95      $temp.remove();
96    }
97
98    // feedback visual
99    $textoCupom.text('Copiado!');
100    $iconeCupom.attr('src', 'https://adaptive-images.uooucdn.com.br/tr:w-iw,q-90/static/images/loja_virtual/luleg/teste-1.svg');
101
102    // volta ao estado original após 3 s
103    setTimeout(() => {
104      $textoCupom.text('Cupom:');
105      $iconeCupom.attr('src', 'https://adaptive-images.uooucdn.com.br/tr:w-iw,q-90/static/images/loja_virtual/luleg/12564-1.svg');
106    }, 3000);
107  }
108
109}); (function () {
110  var menuItem = document.querySelector('li.dropdown.fullwidth-menu.last');
111  if (!menuItem) return;
112
113  var link = menuItem.querySelector('a[href="https://www.luleg.com.br/classics"]');
114  if (!link) return;
115
116  link.textContent = '';
117
118  if (!menuItem.querySelector('.menu-classics-image')) {
119    var img = document.createElement('img');
120    img.src = 'https://adaptive-images.uooucdn.com.br/tr:w-iw,q-90/static/images/loja_virtual/luleg/classics.svg';
121    img.alt = 'Classics';
122    img.className = 'menu-classics-image';
123
124    link.appendChild(img);
125  }
126})(); (function () {
127  var html = [
128    '<div class="vantagemCart" data-minicart-vantagens="true">',
129      '<div class="card">',
130        '<img class="iconVantagem lazyload" src="https://adaptive-images.uooucdn.com.br/static/images/loja_virtual/luleg/troca-1.png" data-src="https://adaptive-images.uooucdn.com.br/static/images/loja_virtual/luleg/troca-1.png" alt="troca">',
131        '<p class="textVantagem">',
132          '<span class="firstText">1º troca Grátis</span>',
133          '<span class="secondText">Em todos os pedidos</span>',
134        '</p>',
135      '</div>',
136      '<div class="card">',
137        '<img class="iconVantagem lazyload" src="https://adaptive-images.uooucdn.com.br/static/images/loja_virtual/luleg/giftback-1.png" data-src="https://adaptive-images.uooucdn.com.br/static/images/loja_virtual/luleg/giftback-1.png" alt="giftback">',
138        '<p class="textVantagem">',
139          '<span class="firstText">10% Giftback</span>',
140          '<span class="secondText">Para utilizar em novas compras</span>',
141        '</p>',
142      '</div>',
143      '<div class="card">',
144        '<img class="iconVantagem lazyload" src="https://adaptive-images.uooucdn.com.br/static/images/loja_virtual/luleg/pix-1.png" data-src="https://adaptive-images.uooucdn.com.br/static/images/loja_virtual/luleg/pix-1.png" alt="pix">',
145        '<p class="textVantagem">',
146          '<span class="firstText">5% off no pix</span>',
147          '<span class="secondText">Ganhe desconto na forma de pagamento</span>',
148        '</p>',
149      '</div>',
150    '</div>'
151  ].join('');
152
153  function inserirVantagens() {
154    var actions = document.querySelector('.minicart-modal__footer .minicart-modal__actions');
155    if (!actions) return;
156
157    var footer = actions.parentNode;
158    if (!footer) return;
159
160    if (footer.querySelector('[data-minicart-vantagens="true"]')) {
161      return;
162    }
163
164    actions.insertAdjacentHTML('afterend', html);
165  }
166
167  function iniciar() {
168    inserirVantagens();
169
170    var observer = new MutationObserver(function () {
171      inserirVantagens();
172    });
173
174    observer.observe(document.body, {
175      childList: true,
176      subtree: true
177    });
178  }
179
180  if (document.readyState === 'loading') {
181    document.addEventListener('DOMContentLoaded', iniciar);
182  } else {
183    iniciar();
184  }
185})();;
186window.Uoou=window.Uoou||{};Uoou.colorGroupFilter=(function(){'use strict';var GRUPOS=[{label:'JEANS',match:function(c){return /^JEANS/i.test(c);}},{label:'LISTRADO',match:function(c){return /^LISTRADO|^LISTRA|^STRIPES/i.test(c)||c==='CIRCULAR';}},{label:'ANIMAL PRINT',match:function(c){return /onça|leopard|snake/i.test(c);}},{label:'XADREZ',match:function(c){return /XADREZ|COLORFUL CUBES|^CUBO$/i.test(c);}},{label:'PRETO',match:function(c){return /^PRETO/i.test(c)||['AZULPRETO','MILITARPRETO','PRETOPINK','P&B','MARÉ NOTURNA','SOMBRA FRESCA','HORIZONTE MONOCROMÁTICO'].indexOf(c)>-1;}},{label:'BRANCO / OFF WHITE',match:function(c){return /^BRANCO|^OFF WHITE|^GELO$|^AVEIA$|^MARFIM$|^CREME$/i.test(c)||/^All white/i.test(c);}},{label:'CINZA',match:function(c){return /^CINZA|^CHUMBO|^GRAFITE|^MESCLA|^CONCRETO/i.test(c);}},{label:'AZUL',match:function(c){return /^AZUL|^MARINHO|^BRISA|^ACQUA|^TURQUESA/i.test(c)||/^BLUE$|^NEW NAVY$|^MILITARY BLUE$|^COSTA SERENA$|^JEANS AZUL$/i.test(c);}},{label:'VERDE',match:function(c){return /^VERDE|^GREEN|^LIMA$|^PISTACHE$|^OLIVA$|^MENTA/i.test(c);}},{label:'MILITAR / KHAKI',match:function(c){return /^MILITAR/i.test(c)||['KAKI','ALLEGRO KHAKI','SONATA KHAKI'].indexOf(c)>-1;}},{label:'AMARELO',match:function(c){return /^AMARELO|^MOSTARDA|^CIDRA$|^OCRE$/i.test(c);}},{label:'LARANJA',match:function(c){return /^LARANJA|^TANGERINA|^PAPRICA|^CORAL$|^TERRACOTA$/i.test(c);}},{label:'VERMELHO',match:function(c){return /^VERMELHO|^Vermelho|^Red|^CEREJA$/i.test(c);}},{label:'ROSA / PINK',match:function(c){return /^ROSA|^PINK|^FUCSIA$|^HOT MAGENTA|^MAGENTA$|^NEW PINK$|^ROSE$|^PESSEGO$/i.test(c);}},{label:'ROXO / LILÁS',match:function(c){return /^Roxo|^ROXO|^LILAS|^PURPURA$|^UVA$/i.test(c);}},{label:'VINHO / MARSALA',match:function(c){return /^VINHO$|^MARSALA$|^MALBEC$|^TELHA$|^BORDO$/i.test(c);}},{label:'MARROM / CAMEL',match:function(c){return /^MARROM|^CARAMELO|^CASTANHA|^Castanho|^CHOCOLATE$|^Cafe$/i.test(c)||/^OLD BROWN|^CAPUCCINO$|^BROWN/i.test(c)||c==='CAMEL';}},{label:'AREIA / BEGE / NATURAL',match:function(c){return /^AREIA|^BEGE$|^CRU$|^NATURAL|^NUDE$|^Areia|^DUNES$|^SAFARI$/i.test(c);}},{label:'DOURADO / PRATA',match:function(c){return /^Dourado|^DOURADO|^PRATA$|^CHAMPANHE$|^OURO$/i.test(c)||/Golden hour/i.test(c);}},{label:'OUTROS',match:function(){return true;}}];var FACET_SEL='[data-facet-name="color_with_stock"]';function _injectCss(){if(document.getElementById('cgf-style'))return;var css=['.cgf-list{list-style:none;margin:0;padding:0}','.cgf-group{margin-bottom:1px}','.cgf-header{display:flex;align-items:center;gap:6px;padding:3px 0}','.cgf-lbl{flex:1;margin:0!important;cursor:pointer}','.cgf-btn{background:none;border:1px solid #ddd;border-radius:3px;
186cursor:pointer;font-size:11px;line-height:1;padding:2px 5px;color:#666;flex-shrink:0;width:22px;text-align:center}','.cgf-btn:hover{background:#f0f0f0}','.cgf-children{padding:2px 0 4px 18px;border-left:2px solid #eee;margin-top:1px}'].join('');var el=document.createElement('style');el.id='cgf-style';el.textContent=css;document.head.appendChild(el);}function _getGrupo(cor){for(var i=0;i<GRUPOS.length;i++)if(GRUPOS[i].match(cor))return GRUPOS[i];return GRUPOS[GRUPOS.length-1];}function _calcCount(els){return els.reduce(function(total,el){var e=el.querySelector('.facet__item-count');var n=e?parseInt(e.textContent.replace(/[()]/g,''),10):0;return total+(isNaN(n)?0:n);},0);}function _buildGroupItem(grupo,items,isMobile){var count=_calcCount(items);var $wrapper=$(isMobile?'<div class="cgf-group">':'<li class="cgf-group">');var $header=$('<div class="cgf-header">');var $lbl=$('<label class="checkbox__label block-element cgf-lbl">');var $cb=$('<input class="cgf-cb" type="checkbox">');var $text=$('<span class="facet__item-name">').html(grupo.label+' <span class="facet__item-count">('+count+')</span>');var $btn=$('<button class="cgf-btn" type="button">+</button>');var $children=$(isMobile?'<div class="cgf-children">':'<ul class="cgf-list cgf-children">').hide();var hasChecked=items.some(function(el){return $(el).find('.input-filter-option').prop('checked');});if(hasChecked){$cb.prop('checked',true);$children.show();$btn.text('−');}items.forEach(function(el){$children.append(el);});$lbl.append($cb).append($text);$header.append($lbl).append($btn);return $wrapper.append($header).append($children);}function _rebuild(){var $facet=$(FACET_SEL);if(!$facet.length)return false;var $ul=$facet.find('> ul');var isMobile=false;var $container,items;if($ul.length){items=$.makeArray($ul.find('> li[data-name]'));$container=$ul;}else{var $pb=$facet.find('.panel-body');if(!$pb.length)return false;items=$.makeArray($pb.find('> label[data-name]'));$container=$pb;isMobile=true;}if(!items.length)return false;var map={};GRUPOS.forEach(function(g){map[g.label]={g,items:[]};});items.forEach(function(el){var cor=el.getAttribute('data-name')||'';map[_getGrupo(cor).label].items.push(el);});if(isMobile){var $wrap=$('<div class="cgf-wrap">');GRUPOS.forEach(function(g){var e=map[g.label];if(!e.items.length)return;$wrap.append(e.items.length===1?e.items[0]:_buildGroupItem(g,e.items,true));});$container.empty().append($wrap);}else{var $newUl=$('<ul class="cgf-list">');GRUPOS.forEach(function(g){var e=map[g.label];if(!e.items.length)return;$newUl.append(e.items.length===1?e.items[0]:_buildGroupItem(g,e.items,false));});$container.replaceWith($newUl);}return true;}function _bindEvents(){$(document).on('click','.cgf-btn',function(e){e.stopPropagation();var $g=$(this).closest('.cgf-group');var $ch=$g.find('> .cgf-children');var open=$ch.is(':visible');$ch.toggle(!open);$(this).text(open?'+':'−');});$(document).on('change','.cgf-cb',function(){var chk=this.checked;var $g=$(this).closest('.cgf-group');var $ch=$g.find('> .cgf-children');$ch.find('.input-filter-option').prop('checked',chk);if(chk){$ch.show();$g.find('> .cgf-header > .cgf-btn').text('−');}});$(document).on('change','.cgf-children .input-filter-option',function(){var $g=$(this).closest('.cgf-group');if(!$g.length)return;var $sibs=$g.find('> .cgf-children .input-filter-option');$g.find('> .cgf-header .cgf-cb').prop('checked',$sibs.length===$sibs.filter(':checked').length);});}function _init(){try{_injectCss();if(!_rebuild()){setTimeout(_init,600);return;}_bindEvents();}catch(e){}}return {init:_init};}());$(document).ready(function(){Uoou.colorGroupFilter.init();});;
187window.Uoou=window.Uoou||{};Uoou.miniCartSilentRemove=(function($){'use strict';var _skipNextSuccessFlash=false;var _resetTimer=null;function _patchAlerts(){var _orig=(Uoou.alert&&typeof Uoou.alert.processFlashMessages==='function')?Uoou.alert.processFlashMessages:null;Uoou.alert=Uoou.alert||{};
187Uoou.alert.processFlashMessages=function(alerts){if(!_orig){_skipNextSuccessFlash=false;return false;}if(_skipNextSuccessFlash){_skipNextSuccessFlash=false;if(_resetTimer){clearTimeout(_resetTimer);_resetTimer=null;}var filtered=(alerts||[]).filter(function(a){return a.type!=='success';});return filtered.length?_orig.call(this,filtered):false;}return _orig.apply(this,arguments);};}function _bindRemove(){$(document).off('click.miniCartSilentRemove','.minicart-modal__remove').on('click.miniCartSilentRemove','.minicart-modal__remove',function(){if(_resetTimer)clearTimeout(_resetTimer);_skipNextSuccessFlash=true;_resetTimer=setTimeout(function(){_skipNextSuccessFlash=false;_resetTimer=null;},8000);});}function init(){if(!Uoou.alert||typeof Uoou.alert.processFlashMessages!=='function'){$(document).ready(function(){if(Uoou.alert&&typeof Uoou.alert.processFlashMessages==='function')_patchAlerts();_bindRemove();});return;}_patchAlerts();_bindRemove();}return {init};}(jQuery));Uoou.miniCartSilentRemove.init();;
188document.addEventListener('DOMContentLoaded', () => {
189    // Define um atraso de 1 segundo (1000 milissegundos)
190    setTimeout(() => {
191        const div1 = document.querySelector("div.product-options");
192        const div2 = document.querySelector(".preço.do.produto"); // Ajuste o seletor conforme necessário
193
194        if (div1 && div2) {
195            // Inserir div1 depois de div2
196            div2.insertAdjacentElement('afterend', div1);
197            console.log("div1 foi movida para depois de div2");
198        } else {
199            console.error("Não foi possível encontrar uma ou ambas as divs.");
200        }
201    }, 1000); // 1000 milissegundos = 1 segundo
202}); /* ── Giftback / Cashback ── */
203(function ($) {
204  'use strict';
205
206  var CASHBACK_RATE = 0.10;
207  var _observer     = null;
208  var _debounce     = null;
209
210  function parsePrecoBRL(text) {
211    var raw = (text || '').trim();
212    if (!raw) return NaN;
213    return parseFloat(
214      raw
215        .replace(/\s/g, '')
216        .replace(/[^\d.,-]/g, '')
217        .replace(/\./g, '')
218        .replace(',', '.')
219    );
220  }
221
222  function obterElementoCashback() {
223    var el = document.querySelector('.next-purchase-bonus');
224    if (el) return el;
225
226    // Ancora APÓS .new-price-layout (nunca dentro):
227    // o JS da loja faz innerHTML replace no layout a cada troca de variante —
228    // ficando fora, o cashback sobrevive sem ser destruído.
229    var anchor = document.querySelector('.new-price-layout');
230    if (!anchor) return null;
231
232    // Lê o margin-bottom atual do layout ANTES de zerá-lo.
233    // Esse valor (ex.: 34.8px) é o espaço original que separava
234    // o bloco de preço das variantes — repassamos ao cashback
235    // para manter o espaçamento correto entre cashback e variantes.
236    var layoutMb = parseFloat(getComputedStyle(anchor).marginBottom) || 0;
237    anchor.style.marginBottom = '0'; // transfere a responsabilidade ao cashback
238
239    el = document.createElement('div');
240    el.className = 'next-purchase-bonus';
241    el.style.cssText = [
242      'font-size:14px',
243      'text-align:center',
244      'opacity:0',
245      'transition:opacity 0.25s ease',
246      'margin-top:6px',                         // gap natural abaixo do preço
247      'margin-bottom:' + layoutMb + 'px'        // restaura espaço antes das variantes
248    ].join(';');
249
250    anchor.insertAdjacentElement('afterend', el);
251    return el;
252  }
253
254  function exibirCashback() {
255    var priceEl    = document.querySelector('.current-price-value');
256    var cashbackEl = obterElementoCashback();
257    if (!priceEl || !cashbackEl) return;
258
259    var price = parsePrecoBRL(priceEl.textContent);
260    // Preço temporariamente vazio (JS da loja atualizando variante):
261    // não faz nada — mantém o valor anterior visível, sem piscar.
262    if (isNaN(price) || price <= 0) return;
263
264    cashbackEl.innerHTML =
265      'Ganhe até <strong>R$\u00a0' +
266      (price * CASHBACK_RATE).toFixed(2).replace('.', ',') +
267      '</strong> em <strong>GIFTBACK</strong> nessa compra';
268    cashbackEl.style.opacity = '1';
269  }
270
271  function instalarObserver() {
272    if (_observer) { _observer.disconnect(); }
273    var priceLayout = document.querySelector('.new-price-layout');
274    if (!priceLayout) return;
275
276    // Detecta o innerHTML replace que o updatePrices() faz a cada variante
277    _observer = new MutationObserver(function () {
278      clearTimeout(_debounce);
279      _debounce = setTimeout(exibirCashback, 50);
280    });
281    _observer.observe(priceLayout, {
282      childList: true, subtree: true, characterData: true
283    });
284  }
285
286  // NÃO usa $(function(){}) — o .new-price-layout ainda não existe no DOMContentLoaded.
287  // O product.js da loja cria-o no window.load + 100ms; esperamos + 200ms de margem.
288  $(window).on('load', function () {
289    setTimeout(function () {
290      obterElementoCashback(); // cria placeholder (opacity:0) e ajusta margens
291      exibirCashback();        // preenche com o preço já no DOM
292      instalarObserver();      // observa trocas de variante daqui em diante
293    }, 300);
294  });
295
296}(jQuery));

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.