V3 Accounts Nav

Adds a basic navbar to V3 accounts page

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

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

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         V3 Accounts Nav
// @namespace    http://tampermonkey.net/
// @version      2025-07-13 2
// @description  Adds a basic navbar to V3 accounts page
// @author       IvyClaw24
// @match        *://*.youtube.com/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=youtube.com
// @run-at       document-end
// @license MIT
// ==/UserScript==

(function() {

    'use strict';
    function addNav() {
        //IMPORTANT
        var style = 1 //set to 1 for 2012-13 style
        //IMPORTANT END
        var ytAdmin = document.getElementById("yt-admin");
        var nav = document.createElement("div");
        const navStr = ["Video Manager","Video Editor","Subscriptions","Analytics"];
        const navLinks = ["/my_videos","/editor","/my_subscriptions","/analytics"];
        const navStr2 = [];
        const navLinks2 = [];
        var sel = 4; //placeholder in case VM gets added
        if (style == 1){
            navStr2.push("Settings");
            navLinks2.push("/account");
        } else {
            navStr.push("Settings");
            navLinks.push("/account");
        }
        nav.setAttribute("class","yt-nav yt-nav-dark");
        var navUl = document.createElement("ul");
        var navUl2 = document.createElement("ul");
        navUl2.setAttribute("class", "yt-nav-aside")
        var i;
        for (i=0; i < navStr.length; i++){
            let navLi = document.createElement("li");
            let navItem
            if (i == sel) {
                navItem = document.createElement("span");
                navLi.setAttribute("class","selected");
            } else {
                navItem = document.createElement("a");
                navItem.href = navLinks[i];
                navLi.setAttribute("class","");
            }
            navItem.setAttribute("class","yt-nav-item");
            navItem.innerText = navStr[i];
            navLi.appendChild(navItem);
            navUl.appendChild(navLi);
            console.log("appended");
        }
        if (style == 1){
            for (i=0; i < navStr2.length; i++){
                let navLi = document.createElement("li");
            let navItem
            if (i == sel - navStr.length) {
                navItem = document.createElement("span");
                navLi.setAttribute("class","subnav-secondary selected");
            } else {
                navItem = document.createElement("a");
                navItem.href = navLinks2[i];
                navLi.setAttribute("class","subnav-secondary");
            }
                navItem.setAttribute("class","yt-nav-item");
            navItem.innerText = navStr2[i];
            navLi.appendChild(navItem);
            navUl2.appendChild(navLi);
                nav.appendChild(navUl2);
            console.log("appended");
            }
        }
        nav.appendChild(navUl);
        console.log("Starting injection");
        if (ytAdmin && document.querySelector(".yt-nav") == null){
            ytAdmin.insertBefore(nav, ytAdmin.firstChild);
            console.log("Success")
            observer.disconnect();
            observer.observe(document.body, { childList: true, subtree: true });
        }
    }
    const observer = new MutationObserver(addNav);

    observer.observe(document.body, { childList: true, subtree: true });

    addNav();
})();