Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name Amazon Smile Redirector
- // @namespace http://danrossiter.org/
- // @version 1.0
- // @description Redirects all Amazon URLs to Amazon Smile subdomain. Also handles potential for infinite looping when smile subdomain doesn't exist.
- // @match http*://amazon.com/*
- // @match http*://www.amazon.com/*
- // @grant unsafeWindow
- // @copyright 2014+, Dan Rossiter
- // ==/UserScript==
- var cont = true;
- var query = window.location.search.substring(1);
- var vars = query.split('&');
- for (var i = 0; i < vars.length; i++) {
- var pair = vars[i].split('=');
- if (pair[0] === 'dr_smile') {
- cont = false;
- break;
- }
- }
- if (cont) {
- query = '?dr_smile' + (query ? '&' + query : '');
- window.location = window.location.protocol + '//smile.amazon.com/' + window.location.pathname + query;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement