function FlagController() {
var app = this,
el = {
produtoEl: '.prateleira .prateleira li',
flagElements: '.priceOff ul li span',
priceDe: ".regularPrice",
pricePor: '.salePrice strong',
precoDe: '.valor-de',
productEl: '.skuList',
productPriceDe: '.valor-de strong',
productPricePor: '.valor-por strong',
productFlagElements: '.precoOff'
};
console.log(app)
app.mountProductFlag = function (discount) {
console.log(this);
return '' +
' OFF' +
'
' +
'
' +
'
'+ discount +'% OFF
'+ 'OFF
"; // console.log('-- Loop Shelves!', {'De': de, 'Por': por}, discountPercentage) if (produto.find('.priceOff').length === 0) { produto.append(app.mountProductFlag(discountPercentage)).css({ 'left': '10px' }); } // produto.find(el.flagElements).html(flagContent); } }); // console.log(de); // console.log(por); }; app.addProductFlags = function () { var priceDe = 0, pricePor = 0, discount = ""; console.log('-------------', { 'findDe': $(el.productEl).find(el.productPriceDe).html(), 'findPor': $(el.productEl).find(el.productPricePor).html() }); if ($(el.productEl).find(el.productPriceDe).html() && $(el.productEl).find(el.productPricePor).html()) { console.log('Entrei no produto!', el.productEl); priceDe = $(el.productEl).find(el.productPriceDe).html(); pricePor = $(el.productEl).find(el.productPricePor).html(); discount = app.calculateDiscount(priceDe, pricePor); // console.log(priceDe); // console.log(pricePor); // 'Nenhum resultado encontrado para a palavra "'+ searchWord + '".
\Não há comentários neste produto.
"); // } }); // 100) { floatingBar.fadeIn("slow"); if($('body').hasClass('home')){ $('body').addClass('floatingBar'); } // $(".floatingCart").css("left",$(".floatingTopBar .fulltext-search-box").offset().left+600); } else { floatingBar.stop(true).fadeOut("slow"); $('body').removeClass('floatingBar'); } }); }); // ]]> $(document).ready(function () { if ($('.helperComplement').length > 0) { $('.helperComplement').remove(); } // página de produto if ($('body').hasClass('produto')) { $('.prod-description').insertAfter('.nomeSku'); } // institucional $(".institucional .item-accordion h3").click(function () { $(this).siblings(".container-accordion").slideToggle("slow", function () { // Animation complete. }); }); $(".institucional .container-accordion ul li").click(function () { $(this).find("p").slideToggle("slow", function () { // Animation complete. }); }); }) $(document).ajaxStop(function () { $(".ui-autocomplete li").each(function () { if ($(this).find('img').length) { $(this).addClass('ui-complete-item-product'); } }); $('.fulltext-search-box').on('focus', function () { if (!$('#ui-complete-overlay').length) { $('').insertAfter("body"); } }); $('.fulltext-search-box').on('focusout', function () { $('#ui-complete-overlay').remove(); }); // altero tamanho da imagem da busca $('.fulltext-search-box').on("keydown", function () { $(".ui-autocomplete.ui-menu.ui-widget").on("DOMSubtreeModified", function () { $(".ui-autocomplete .ui-menu-item a img").each(function () { var newImg = $(this).attr("src").replace(/(-25-25)/g, "-90-100"); $(this).attr("src", newImg); }); }); }); }); var comparar = { itens: [], retorno: function() { if(window.location.search.indexOf('ComparacaoProdutos=') >= 0) { var arrProdSelecionados = window.location.search.split('ComparacaoProdutos=')[1].split('&')[0].split(','); for(var i=0; i