Amazon.com auto redirect mobile to desktop version

Automatically redirect from mobile version to desktop version of the page.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

You will need to install an extension such as Tampermonkey to install this script.

Θα χρειαστεί να εγκαταστήσετε μια επέκταση διαχείρισης κώδικα χρήστη για να εγκαταστήσετε αυτόν τον κώδικα.

(Έχω ήδη έναν διαχειριστή κώδικα χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

// ==UserScript==
// @id             amazon.com_mobile2desktop
// @name           Amazon.com auto redirect mobile to desktop version
// @version        1.3.2
// @namespace      V@no
// @author         V@no
// @description    Automatically redirect from mobile version to desktop version of the page.
// @include        http://amazon.com/*
// @include        http://www.amazon.com/*
// @include        https://amazon.com/*
// @include        https://www.amazon.com/*
// @grant          none
// @run-at         document-start
// ==/UserScript==

//redirect mobile to desktop
(function()
{
	let log = console.log.bind(console);
	if (location.pathname.match(/^\/gp\/aw\//i))
	{
		window.location.replace(window.location.toString().replace(/^(https?:\/\/(www\.)?amazon\.com\/)gp\/aw\/(d\/)?(.*)/ig, "$1dp/$4"));
	}
	else
	{
		//redirect to charity amazon
		if (!location.hostname.match(/smile\.amazon\.com/i) && location.href.indexOf("signin") == -1)
		{
			let smile = window.location.toString().replace(/^(https?:\/\/)([^\/]+)\/(.*)/ig, "$1smile.amazon.com/$3");
			if (location.search.indexOf("pldnSite") == -1)
			{
log("Redirecting to smile.amazon.com");
				window.location.replace(smile);
			}
			else
			{
log("Can't redirect to smile.amazon.com due to pldnSite")
			}
		}
	}
})();