YouTube Revert Icon Dropdown

Remove the 'Google Account' Button from the Icon Dropdown

2023-10-31 기준 버전입니다. 최신 버전을 확인하세요.

이 스크립트를 설치하려면 Tampermonkey, Greasemonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

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

이 스크립트를 설치하려면 Tampermonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Userscripts와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 유저 스크립트 관리자 확장 프로그램이 필요합니다.

(이미 유저 스크립트 관리자가 설치되어 있습니다. 설치를 진행합니다!)

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

(이미 유저 스타일 관리자가 설치되어 있습니다. 설치를 진행합니다!)

// ==UserScript==
// @name         YouTube Revert Icon Dropdown
// @namespace    https://greasyfork.org/en/users/1008366-trickyclock
// @author       TrickyClock
// @version      1.0
// @description  Remove the 'Google Account' Button from the Icon Dropdown
// @license      MIT
// @match        https://www.youtube.com/*
// @grant        none
// @run-at       document-body
// @require      https://cdn.jsdelivr.net/gh/rybak/userscript-libs@e86c722f2c9cc2a96298c8511028f15c45180185/waitForElement.js
// ==/UserScript==

function insertAfter(newNode, referenceNode) {
  referenceNode.parentNode.insertBefore(newNode, referenceNode.nextSibling);
}

(async () => {
  waitForElement('#contentContainer #endpoint[title="Your channel"]').then((yourChannelButton) => {
    yourChannelButton.parentNode.style.display = "none";
  });

  const observer = new MutationObserver(mutations => {
    const intervalId = setInterval(() => {
      waitForElement('tp-yt-iron-dropdown #sections yt-multi-page-menu-section-renderer:nth-child(1) #endpoint:nth-child(1)').then(async (googleAccountButton) => {
        const yourChannelButton = await waitForElement('#contentContainer #endpoint[title="Your channel"]');
        const yourDataInYoutubeButton = await waitForElement('tp-yt-iron-dropdown #sections yt-multi-page-menu-section-renderer:nth-child(3) #endpoint:nth-child(1)');

        const channelUrl = yourChannelButton.href;
        const channelIcon = yourChannelButton.querySelector('yt-icon yt-icon-shape')
        const googleAccountIcon = googleAccountButton.querySelector('yt-icon yt-icon-shape');
        const googleAccountLabel = googleAccountButton.querySelector('#primary-text-container span');

        googleAccountButton.href = channelUrl;
        googleAccountButton.tabindex = "0";

        googleAccountLabel.innerHTML = "Your channel";
        googleAccountIcon.innerHTML = channelIcon.innerHTML;


        const youtubeStudioButton = document.querySelector('tp-yt-iron-dropdown #endpoint[href^="https://studio.youtube.com"]');
        if (youtubeStudioButton) {
          insertAfter(youtubeStudioButton.parentNode, googleAccountButton.parentNode);
        }

        clearInterval(intervalId);
      });
    }, 100);
 });

  observer.observe((await waitForElement('#contentWrapper ytd-multi-page-menu-renderer')), {
    childList: true,
    subtree: true
  });
})();