| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- // ==UserScript==
- // @name Simplify URLs
- // @version 0.2
- // @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/*
- // @match https://autoplius.lt/skelbimai/*.html
- // @match https://autogidas.lt/skelbimas/*.html
- // @match https://skelbiu.lt/skelbimai/*.html
- // @match https://www.fasttech.com/products/*
- // @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];
- }
- else if(window.location.hostname.indexOf("fasttech") !== -1) {
- let s = window.location.pathname.split('/');
- let d = s[s.length -1].split('-');
- redir = '/products/' + d[0];
- }
- else if(window.location.hostname.indexOf("autoplius.lt") !== -1 ||
- window.location.hostname.indexOf("autogidas.lt") !== -1) {
- let s = window.location.pathname.split('-');
- let d = window.location.pathname.split('/');
- redir = '/'+ d[1] + '/-' + s[s.length -1];
- }
- else if(window.location.hostname.indexOf("skelbiu.lt") !== -1) {
- let s = window.location.pathname.split('-');
- redir = '/skelbimai/' + s[s.length -1];
- }
- if(window.location.pathname === redir) return;
- console.log("Shorting URL:", window.location.href, "->", redir);
- history.pushState(null, '', redir);
- })();
|