High resolution images for tweetdeck

Make tweetdeck content be loaded to highest resolution possible

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

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

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

// ==UserScript==
// @name         High resolution images for tweetdeck
// @namespace    http://tampermonkey.net/
// @version      0.2
// @icon         https://tweetdeck.twitter.com/favicon.ico
// @description  Make tweetdeck content be loaded to highest resolution possible
// @author       mmorgat
// @match        https://tweetdeck.twitter.com/*
// @grant        none
// ==/UserScript==
 
(function() {
    'use strict';
    /* document.getElementsByClassName('stream-item'); */
    function loadHighRes(){
        let images = document.getElementsByClassName('js-media-image-link');
        for(let image of images){
            if(image.classList.contains('block') && image.classList.contains('media-item') && image.classList.contains('med-link')){
                //Replace the URL of the image so that twitter loads the best resolution possible
                image.style.backgroundImage = image.style.backgroundImage.replace('name=360x360', 'name=large');
                image.style.backgroundImage = image.style.backgroundImage.replace('name=medium', 'name=large');
                image.style.backgroundImage = image.style.backgroundImage.replace('name=small', 'name=large');
            }
        }
    }
    setInterval(function(){loadHighRes();},500); //Changes all images to higher res version every 0.5 seconds
})();