Smile@Amazon

Redirects Amazon shopping sites that offer Smile to their Smile representation

  1. // ==UserScript==
  2. // @name Smile@Amazon
  3. // @name:de Smile@Amazon
  4. // @description Redirects Amazon shopping sites that offer Smile to their Smile representation
  5. // @description:de Leitet Amazon Shopping Seiten die Smile anbieten zu ihrem Smile Äquivalent um
  6. // @namespace zScript
  7. // @match https://www.amazon.com/*
  8. // @match https://www.amazon.co.uk/*
  9. // @match https://www.amazon.de/*
  10. // @icon https://www.amazon.com/favicon.ico
  11. // @version 1.4
  12. // @grant none
  13. // ==/UserScript==
  14.  
  15. // I created this script because any other Script redirecting to Amazon Smile has one or another flaw
  16. // Most Scripts check for only one TLD like .COM, this script should work for all domains Tampermonkey supports.
  17. // As Amazon redirects its shopping site always to the HTTPS protocol and the WWW subdomain, i only include httpS://WWW.amazon...
  18. // As Amazon prevents to be included in Frames from other sites, i only prevent redirection if the top window is already smile.amazon
  19. // This way i leave (i)frames created by smile.amazon the way Amazon created them, hoping they know what they're doing.
  20.  
  21. // VERSION 1.1 (13.10.2018)
  22. // It came to my attention that not every Amazon site offers Smile. As far as I found out only .com .de and .co.uk offer Smile.
  23. // I changed the script so Amazon Sites not offering Smile will work with this script.
  24. // VERSION 1.2 (13.10.2018)
  25. // removed unnecessary regex to distinguish between http and https as Amazon switches always to https
  26. // VERSION 1.3 (04.10.2022)
  27. // switched from @include to @match
  28. // VERSION 1.4 (06.10.2022)
  29. // @match didn't work as @include - should work aqgain now, sorry
  30.  
  31. (function() {
  32. 'use strict';
  33. if(top.location.href.match(/^https:\/\/smile\.amazon\.[^/]+\//i) === null){
  34. window.location.replace(window.location.href.replace(/^https:\/\/www\./i, "https://smile."));
  35. }
  36. })();