Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save azmodude/e2ae67918a28861b397dda9dff6fb403 to your computer and use it in GitHub Desktop.
Save azmodude/e2ae67918a28861b397dda9dff6fb403 to your computer and use it in GitHub Desktop.
AmazonSmile Redirect (Greasemonkey Script)
// ==UserScript==
// @name AmazonSmile Redirect
// @namespace http://jdel.us
// @description Redirect Amazon to AmazonSmile
// @include /^http://.*\.amazon\.(de|com)//
// @include /^https://.*\.amazon\.(de|com)//
// @version 0.6
// @grant none
// ==/UserScript==
var url = window.location.host;
if (url.match("smile.amazon") === null) {
url = window.location.href;
if (url.match("//www.amazon") !== null){
url = url.replace("//www.amazon", "//smile.amazon");
} else if (url.match("//amazon.") !== null){
url = url.replace("//amazon.", "//smile.amazon.");
} else {
return;
}
console.log(url);
window.location.replace(url);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment