Skip to content

Instantly share code, notes, and snippets.

@Plasmoxy
Created October 3, 2023 17:30
Show Gist options
  • Save Plasmoxy/c627960141a36b5077f4b11167ab4790 to your computer and use it in GitHub Desktop.
Save Plasmoxy/c627960141a36b5077f4b11167ab4790 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name Yt swishsh chan
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://www.youtube.com/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=youtube.com
// @grant none
// ==/UserScript==
(function() {
'use strict';
function getElementByXpath(path) {
return document.evaluate(path, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
}
const headdiv = getElementByXpath('/html/body/ytd-app/div[1]/div/ytd-masthead/div[4]/div[1]');
const swChan = getElementByXpath('/html/body/ytd-app/ytd-popup-container/tp-yt-iron-dropdown/div/ytd-multi-page-menu-renderer/div[4]/ytd-multi-page-menu-renderer/div[3]/div[1]/ytd-account-section-list-renderer[4]/div[2]/ytd-account-item-section-renderer/div[2]/ytd-account-item-renderer/tp-yt-paper-icon-item');
const pmjp = document.createElement('div');
pmjp.innerHTML = `<span style="color: white; font-size: 18px; cursor: pointer;">S</span>`;
pmjp.addEventListener('click', () => {
swChan.click();
});
headdiv.appendChild(pmjp);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment