Greasy Fork

Shined up real nice.

AmazonSmile Redirect

Redirect to AmazonSmile

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// ==UserScript==
// @name        AmazonSmile Redirect
// @icon        http://i.imgur.com/HKxjaKP.jpg
// @namespace   skoshy.com
// @author      Stefan Koshy
// @description Redirect to AmazonSmile
// @include     http://*.amazon.com/*
// @version     0.6
// @run-at      document-start
// @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.");
    }
    window.location.replace(url);
}