Last active
April 3, 2018 08:09
-
-
Save smeagol91/354783821d737fa726423369d195a8f0 to your computer and use it in GitHub Desktop.
JS to use Amazon-Smile
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== | |
// @id force-smile@smeagol | |
// @name Amazon plugin to use smile | |
// @category Tweaks | |
// @version 1.0.0.20180103.162525 | |
// @namespace https://github.com/smeagol91 | |
// @updateURL https://gist.githubusercontent.com/smeagol91/354783821d737fa726423369d195a8f0/raw | |
// @downloadURL https://gist.githubusercontent.com/smeagol91/354783821d737fa726423369d195a8f0/raw | |
// @description Force usage of smile.amazon.* instead of a none smile url | |
// @include https://*.amazon.de/* | |
// @include http://*.amazon.de/* | |
// @match https://*.amazon.de/* | |
// @match https://*.amazon.de/* | |
// @grant none | |
// ==/UserScript== | |
if(window.location.href.indexOf('smile') === -1) { | |
var redir = window.location.href | |
.replace(/^http:/, 'https:') | |
.replace(/\/www\./, '/smile.'); | |
if(redir != window.location.href) { | |
// only redirect if there is any change | |
window.location = redir; | |
throw('Need to load amazon smile version.'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment