Greasy Fork is available in English.

Amazon Auto-Smile

Automatically redirects all www.amazon.com URLs to their smile.amazon.com equivalent.

< Σχολιασμός για τον κώδικα Amazon Auto-Smile

Αναφορά: Καλός - ο κώδικας λειτουργεί

§
Δημοσιεύτηκε: 21/10/2019

2019-Oct-21 works fine assuming you're already logged in to smile.amazon

Functionality:

As of 21 Oct, 2019, this appears to be working fine assuming that you are already logged into smile.amazon.com (e.g. either you checked 'remember me' in normal browsing mode or you have it logged in from another tab in private browsing mode).

Tested in Chromium w/ ViolentMonkey running on Linux Mint 19.2; opening www.amazon.com links from google/review sites, it was correctly redirected to smile.amazon.com.

Note: that if a site omits the www and just has the url as just 'https://amazon.com' (rather than 'https://www.amazon.com'), then this script will not work out-of-the-box. You can fix this (after installing) by duplicating the 2 lines with '@match' so that you have 4 @match lines that cover http and https for amazon.com and www.amazon.com.

Security:

I am a professional web developer and have reviewed the script. I do not see anything harmful; it is restricted to only operating only on amazon.com, operates only under safe conditions (e.g. top-level page only, no iframes), and does not contain remote calls.

§
Δημοσιεύτηκε: 21/10/2019

minor correction: For the fix I mentioned relating to 'amazon.com' urls:

  1. Probably not required as amazon.com redirects to www.amazon.com autoamtically
  2. If you wanted the script to handle it anyway, then in addition to the @match lines, you would also need to modify the replace statement from
var new_host = window.location.host.replace(/^www\./, 'smile.');

to

var new_host = window.location.host.replace(/^(www\.)?/, 'smile.');

which would make the 'www.' at the beginning of the site's host name be optional.

Δημοσίευση απάντησης

Συνδεθείτε για να δημοσιεύσετε μια απάντηση.