Skip to content

Instantly share code, notes, and snippets.

@aasmpro
Last active March 24, 2022 21:42
Show Gist options
  • Save aasmpro/9e087895d072c5b4428a71b247adb2a4 to your computer and use it in GitHub Desktop.
Save aasmpro/9e087895d072c5b4428a71b247adb2a4 to your computer and use it in GitHub Desktop.
A script to convert prices to another one on numbeo.com. simply just open the console, copy, paste and enter!
let currency_symbol = "IRT";
let currency_ratio = 30;
let convert = (value) => {return (parseFloat(value.replaceAll(',',''))*currency_ratio).toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")};
let price_elements = document.getElementsByClassName("first_currency");
Array.prototype.map.call(price_elements, (item) => {item.innerHTML = `${convert(item.innerHTML.match(/[\d,]*[.]{0,1}[\d]+/g)[0])} ${currency_symbol}`;});
@aasmpro
Copy link
Author

aasmpro commented Mar 24, 2022

for example, open the Munich page on Numbeo.com and enter open console with F12 and copy/paste this script to convert Euro prices to Iran Toman (1 euro = 30 Toman)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment