Add Images Option Back To imgur

Images option added to the Imgur user dropdown menu

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

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

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

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

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

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.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==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 });
})();