Created
June 27, 2019 21:13
-
-
Save Bolukan/5ac1c30a3c1d3268506c29ebb6eb5402 to your computer and use it in GitHub Desktop.
Show Total Price on Aliexpress
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
// ==UserScript== | |
// @name Aliexpress Total Price Script | |
// @namespace https://bolukan.nl | |
// @description Show Total Price on Aliexpress | |
// @version 0.1 | |
// @author Bolukan | |
// @match *://*.aliexpress.com/wholesale* | |
// @match *://*.aliexpress.com/w/wholesale* | |
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
})(); | |
var minimumprice = 999999; | |
$("#hs-list-items .list-item .info").each((ind, e)=>{ | |
var price = $(e).find(".price-m .value").text().slice(1).trim(); | |
var shipping = $(e).find(".pnl-shipping .value").text().slice(1).trim(); | |
console.log("price: " + price + " shipping: " + shipping); | |
var totp = document.createElement("span"); | |
totp.setAttribute("class","totalprice"); | |
totp.setAttribute("class","value"); | |
totp.setAttribute("itemprop","price"); | |
var pricep = parseFloat(price.replace(',', '.')); | |
var prices = parseFloat(shipping.replace(',', '.')); | |
var totalprice = (isNaN(pricep) ? 0 : pricep) + (isNaN(prices) ? 0 : prices); | |
totp.innerText = "€ " + totalprice.toLocaleString('nl-NL', {minimumIntegerDigits: 1, minimumFractionDigits: 2, useGrouping:false}); | |
$(e).find(".price-m").append(totp); | |
if (totalprice < minimumprice) { | |
minimumprice = totalprice; | |
} | |
//$(e).find(".price-m").insertAdjacentElement("afterend", totp); | |
}); | |
$(".n-sort-filter").append("Minimum price: " + minimumprice.toLocaleString('nl-NL', {minimumIntegerDigits: 1, minimumFractionDigits: 2, useGrouping:false})); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment