Amazon URL Shortener

Replaces the current Amazon URL with a shorter version.

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey, Greasemonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

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

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

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

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

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

(I already have a user script manager, let me install it!)

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.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         Amazon URL Shortener
// @namespace    https://ohlinis.me/
// @version      0.0.2
// @description  Replaces the current Amazon URL with a shorter version.
// @author       Murphy
// @match        https://www.amazon.com/*
// @match        https://www.amazon.de/*
// @match        https://www.amazon.es/*
// @match        https://www.amazon.fr/*
// @match        https://www.amazon.it/*
// @match        https://www.amazon.nl/*
// @match        https://www.amazon.com.be/*
// @run-at       document-start
// ==/UserScript==

(function () {
    'use strict';
    if(document.location.href.split("/dp/").length !== 1&&document.location.href.split("/dp/")[1].split("/")[1] !== ""){
        var url = "https://"+document.domain+"/dp/"+document.location.href.split("/dp/")[1].split("/")[0].split("?")[0]
        if (url === document.location.href) {return}
        else {document.location.replace(url)}
    } else {return}
})();