EmbedImagesOnReddit-stream

EmbeddedImages

Verze ze dne 18. 12. 2023. Zobrazit nejnovější verzi.

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         EmbedImagesOnReddit-stream
// @namespace    just.a.guyy
// @version      1
// @description  EmbeddedImages
// @match        http://reddit-stream.com/*
// @grant        none
// @license MIT
// ==/UserScript==
// Inspired by: https://greasyfork.org/en/scripts/432548-reddit-stream-dinger/code (Thanks a lot!)

new MutationObserver(function (mutations) {
    for (let mutation of mutations) {
        for (let node of mutation.addedNodes) {
            if (node.nodeType == Node.ELEMENT_NODE) {
                var links = node.getElementsByTagName('a');
                for (var i = 0;i< links.length;i++)
                {
                    if((links[i].href).includes("https://preview.redd.it")){
                        links[i].innerHTML = `<img src="`+links[i].href+`" style="height:35vh;width:25vw">`;
                    }

                }
            }
        }
    }
}).observe(document.getElementById('c-main'), {
    childList: true,
    subtree: true
});