// ==UserScript== // @name Simplify URLs // @version 0.1 // @description Shortens URL for various websites // @author min // @license MIT; https://gogs.infcof.com/min/userscripts/src/master/LICENSE // @updateURL https://gogs.infcof.com/min/userscripts/raw/master/simplify.user.js // @match https://www.ebay.co.uk/itm/* // @match https://www.amazon.co.uk/*/dp/* // @match https://www.amazon.co.uk/gp/product/* // @match https://www.aliexpress.com/item/* // @grant none // ==/UserScript== (function() { 'use strict'; //let domain = window.location.protocol + '//' + window.location.hostname; let redir; if(window.location.hostname.indexOf("ebay") !== -1) { let s = window.location.pathname.split('/'); redir = '/itm/' + s[s.length -1]; } else if(window.location.hostname.indexOf("amazon") !== -1) { let s = window.location.pathname.split('/'); redir = '/dp/' + s[s.length -2]; } else if(window.location.hostname.indexOf("aliexpress") !== -1) { let s = window.location.pathname.split('/'); redir = '/item//' + s[s.length -1]; } if(window.location.pathname === redir) return; console.log("Shorting URL:", window.location.href, "->", redir); history.pushState(null, '', redir); })();