Forked from jdelamater99/AmazonSmile_redirect.user.js
Last active
August 9, 2022 12:37
-
-
Save rwv37/3b079e6ec8dd34e6f2c7 to your computer and use it in GitHub Desktop.
This file contains 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
// ==UserScript== | |
// @name AmazonSmile Redirect | |
// @namespace http://jdel.us | |
// @description Redirect Amazon to AmazonSmile | |
// @include http://*.amazon.com/* | |
// @include https://*.amazon.com/* | |
// @version 0.4 | |
// @grant none | |
// ==/UserScript== | |
var url = window.location.host; | |
if (url.match("smile.amazon") == null) { | |
url = window.location.href; | |
if (url.match("//www.") != null){ | |
url = url.replace("//www.", "//smile."); | |
} 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
Thanks, I just saw this edit. I tried to merge your changes back into my version, but couldn't figure out how (also new to gist), so I just copy/pasted your code over mine.