Skip to content

Instantly share code, notes, and snippets.

@phts
Last active June 10, 2016 14:09
Show Gist options
  • Save phts/70edee69d0445f4d71ff to your computer and use it in GitHub Desktop.
Save phts/70edee69d0445f4d71ff to your computer and use it in GitHub Desktop.
Bookmarklet to add USD prices to an item page on catalog.onliner.by
javascript:(function(){
"use strict";
var $a = $(".b-offers-desc__info-sub > a.b-offers-desc__info-price-value_secondary");
var byrPricesText = $a.text();
var byrPrices = byrPricesText.replace(/[^0-9–]/g, "").split("–");
var currencyText = $("#currency-informer > a > span").text().replace(/[^0-9]/g, "");
var currency = parseInt(currencyText);
var usdPrices = [];
for (var byrPrice of byrPrices) {
usdPrices.push(Math.round(parseInt(byrPrice) / currency));
}
$a.append(" ( $" + usdPrices.join(" – $") + " )");
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment