Skip to content

Instantly share code, notes, and snippets.

@smeagol91
Last active April 3, 2018 08:09
Show Gist options
  • Save smeagol91/354783821d737fa726423369d195a8f0 to your computer and use it in GitHub Desktop.
Save smeagol91/354783821d737fa726423369d195a8f0 to your computer and use it in GitHub Desktop.
JS to use Amazon-Smile
// ==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