Add Images Option Back To imgur

Images option added to the Imgur user dropdown menu

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         Add Images Option Back To imgur
// @version      0.0.1
// @description  Images option added to the Imgur user dropdown menu
// @author       https://imgur.com/user/Putin/about
// @match        https://*.imgur.com/*
// @namespace https://greasyfork.org/users/1481804
// ==/UserScript==
 
(function() {
    'use strict';
 
    const observer = new MutationObserver((mutations, obs) => {
        const dropdown = document.querySelector('.Dropdown-list .Dropdown-option-group');
        if (dropdown) {
            const usernameElement = document.querySelector('.NavbarUserMenuCover-user');
            if (usernameElement) {
                const username = usernameElement.textContent.trim();
                const imagesOption = document.createElement('a');
                imagesOption.className = 'Dropdown-option';
                imagesOption.href = `https://${username}.imgur.com/all/`;
                imagesOption.textContent = 'Images';
                imagesOption.setAttribute('data-discover', 'true');
                dropdown.insertBefore(imagesOption, dropdown.firstChild);
                obs.disconnect();
            }
        }
    });
 
    observer.observe(document.body, { childList: true, subtree: true });
})();