twimg redirect to original

Redirect twimg to :orig

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

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

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

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

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

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.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==UserScript==
// @name        twimg redirect to original
// @namespace   https://mzile.net
// @version     1.3.2
// @description Redirect twimg to :orig
// @author      eai04191
// @license     MIT
// @supportURL  https://github.com/eai04191/twimg-redirect-to-original/issues
// @match       *://pbs.twimg.com/media/*
// @exclude     *://pbs.twimg.com/media/*name=orig
// @run-at      document-start
// @grant       none
// ==/UserScript==

//https://pbs.twimg.com/media/ABC.jpg:large
//https://pbs.twimg.com/media/ABC?format=jpg&name=large

var url = window.document.location + "";
url = url.replace(/\?format=/, ".");
url = url.replace(/\&name=/, ":");
//https://pbs.twimg.com/media/ABC.jpg:large
//https://pbs.twimg.com/media/ABC.jpg:large

url = url.replace(/\.(?=[^.]*$)/, "?format=");
//https://pbs.twimg.com/media/ABC?format=jpg:large

url = url.replace( /(:large|:medium|:small|:orig|:thumb|:360x360|:900x900)/, "");
//https://pbs.twimg.com/media/ABC?format=jpg

window.location.replace( url + "&name=orig" );
//https://pbs.twimg.com/media/ABC?format=jpg&name=orig