您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Replaces the YouTube home button with a Pinterest link of your choosing
- // ==UserScript==
- // @name YouTube Home Button Override
- // @namespace http://tampermonkey.net/
- // @description Replaces the YouTube home button with a Pinterest link of your choosing
- // @author You
- // @license MIT
- // @match *://www.youtube.com/*
- // @run-at document-end
- // @version 0.0.1.20230725074000
- // ==/UserScript==
- (function() {
- // Replace the YouTube home button with a Pinterest link
- function overrideHomeButton() {
- const pinterestLink = "https://i.pinimg.com/originals/62/28/5a/62285a5f6ce177bb4fb752bb294bc649.gif"; // Replace this with your Pinterest link
- const homeButton = document.querySelector("#logo-icon");
- if (homeButton) {
- const newLink = document.createElement("a");
- newLink.href = pinterestLink;
- newLink.target = "_blank";
- newLink.innerHTML = `<img src="${pinterestLink}" style="width: 100%; height: 100%; opacity: 0;" alt="Pinterest">`; // Set opacity to 0 (fully transparent)
- homeButton.parentNode.replaceChild(newLink, homeButton);
- }
- }
- // Wait for the YouTube page to load and then override the home button
- const observer = new MutationObserver(() => {
- const homeButton = document.querySelector("#logo-icon");
- if (homeButton) {
- overrideHomeButton();
- observer.disconnect();
- }
- });
- observer.observe(document.body, { childList: true, subtree: true });
- })();