Created
May 23, 2021 17:25
-
-
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
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
(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