Skip to content

Instantly share code, notes, and snippets.

@mehdichaouch
Created May 23, 2021 17:25
Show Gist options
  • Save mehdichaouch/738d28b310c6bc660984784d81a472d4 to your computer and use it in GitHub Desktop.
Save mehdichaouch/738d28b310c6bc660984784d81a472d4 to your computer and use it in GitHub Desktop.
Bookmarklet send Amazon product to Hagglezon which allow to compare prices across all Amazon european stores
(function() {
var lang = navigator.language.split('-')[0],
amazonPattern = /amazon.(com|co\.uk|ca|de|fr|es|it|cn|co\.jp).*\/(asin|dp|gp|product|exec\/obidos|gp\/offer-listing|product\-reviews|gp\/aw\/d)\/[A-Z0-9]{10,13}/i,
isAmazon = location.href.search(amazonPattern) >= 0;
if (isAmazon) try {
var r = document.getElementById("ASIN").value;
window.open("https://www.hagglezon.com/" + lang + "/s/" + encodeURIComponent(window.location.origin + "/dp/" + r), "_blank")
} catch (d) {
window.open("http://github.com/mehdichaouch/bookmarklets", "_blank")
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment