twimg redirect to original

Redirect twimg to :orig

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

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

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το 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==
// @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