Last active
November 17, 2019 15:15
-
-
Save mateusmaaia/4c756abaf41e582ea4ea720ecb1a022c to your computer and use it in GitHub Desktop.
Discover what products are sold and distributed by Dafiti's
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript:( | |
function(){ | |
$(".banner-text-box").css("display", "none"); | |
$(".col-md-3").css("width","15%"); | |
$(".col-md-9").css("width","85%"); | |
$(".product-list-col-3 .product-box").css({"width": "30%", "margin-right": "3%"}); | |
$(".product-box").each((i, item) => { | |
url = $(item).find(".quickview-link.product-box-preview").attr("data-remote"); | |
$.get(url, function(data) { | |
var elements = $(data); | |
var soldByDafiti = $('.product-seller-name', elements).find("strong").text(); | |
var soldByKanui = $('.product-seller-name', elements).text(); | |
$(item).css({"border-radius":"2%","border-width":"3px"}); | |
if (soldByDafiti === "Dafiti" || soldByKanui.indexOf("Kanui") > 0) { | |
$(item).css({ | |
"border-style":"solid", | |
"border-color":"green" | |
}); | |
var price = ($(item).find(".product-box-price .product-box-price-to").text() !="" && $(item).find(".product-box-price .product-box-price-to") != undefined) | |
? $(item).find(".product-box-price .product-box-price-to").text() : $(item).find(".product-box-price .product-box-price-from").text(); | |
var v = parseInt(price.replace(/\D/g,"")); | |
var d = (v * 0.7).toFixed(0) + ""; | |
var discount = (!isNaN(v)) ? d.substring(0, d.length-2) + ',' + d.substring(d.length-2) : ""; | |
$(item).find(".product-box-price").append("<br /><span style='color:green;'>-30%: R$ " + discount +"</span>"); | |
} else { | |
$(item).css({ | |
"border-style":"dotted", | |
"border-color":"red" | |
}); | |
} | |
}); | |
}); | |
} | |
) (document); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@julio-maia Added Kanui store support