Skip to content

Instantly share code, notes, and snippets.

@divinity76
Last active August 15, 2021 21:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save divinity76/3f0278c49f86787041fec137394c9f2d to your computer and use it in GitHub Desktop.
Save divinity76/3f0278c49f86787041fec137394c9f2d to your computer and use it in GitHub Desktop.
alibaba cheapest quantity checker (price+shipping)
o={
getTotal:function(){return Number(document.querySelectorAll(".sub-total-area")[0].textContent.match(/[0-9\,\.]+/)[0].split(",").join(""));},
getUnits:function(){return Number(document.querySelectorAll("[data-role='wholesale-order-quantity']")[0].value.toString());},
getPricePerUnit:function(){return (this.getTotal()/this.getUnits());},
};
prices={};
theClearInterval=setInterval(function(){
prices[o.getUnits()]=o.getPricePerUnit();
document.querySelectorAll("a.quantity-up")[0].click();
},2000);
clearInterval(theClearInterval);
JSON.stringify(prices);
<?php
$js=;
$a=json_decode($js,true);
asort($a,SORT_NUMERIC);
var_dump($a);
$$("div.list-no-v2-outter").forEach(function(ele) {
ele.addEventListener("click", function() {
ele.parentNode.removeChild(ele);
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment