Last active
August 24, 2021 01:38
-
-
Save dbaynard/bd2a9910f71a1ba0a27738c042d60b7a to your computer and use it in GitHub Desktop.
Show price changes in amazon basket or after adding item
This file contains hidden or 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
// Paste into dev console | |
[...document.querySelectorAll(".a-list-item, .huc-v2-item-msg")].map(x => { | |
const lims = x.innerText.match(/from £([0-9.]+) to £([0-9.]+)/)?.slice(1,3); | |
if (!!lims) { | |
const p = lims[1] - lims[0]; | |
const y = 100*p/lims[0]; | |
return [p, `£${p.toFixed(2)} (${y.toFixed(1)} %): ${x.innerText}`]; | |
} | |
}).filter(x => !!x).sort((a,b) => b[0] - a[0]).forEach(([_,v]) => console.log(v)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment