您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Hover a thumbnail to see icons at the right: "block video" is an and "block channel"
当前为
// ==UserScript== // @name YT: not interested in one click // @description Hover a thumbnail to see icons at the right: "block video" is an and "block channel" // @version 1.0.0 // @match https://www.youtube.com/* // @noframes // @grant none // @author wOxxOm // @namespace wOxxOm.scripts // @license MIT License // ==/UserScript== const ME = 'yt-one-click-dismiss'; const NAV_FINISH = 'yt-navigate-finish'; const THUMB_TAG = 'ytd-thumbnail'; const ELEMENTS = document.createDocumentFragment(); let STYLE; addEventListener('mouseover', onHover); addEventListener('click', onClick); function onHover(e) { const thumb = e.composedPath().find(el => el.localName === THUMB_TAG); if (thumb && !thumb.getElementsByClassName(ME)[0]) { if (!STYLE) init(thumb); thumb.appendChild(( thumb.data.playlistId || thumb.closest('ytd-compact-video-renderer') ? ELEMENTS.firstChild : ELEMENTS ).cloneNode(true)); } } async function onClick({target}) { const {block} = target.classList.contains(ME) && target.dataset; if (!block) return; const index = STYLE.sheet.insertRule('ytd-menu-popup-renderer { display: none !important }'); const entry = target.closest('ytd-rich-item-renderer, ytd-compact-video-renderer'); const more = entry.querySelector('yt-icon-button.dropdown-trigger'); await 0; more.dispatchEvent(new Event('tap')); await 0; for (const el of document.querySelector('ytd-menu-popup-renderer [role="listbox"]').children) { if (block === 'video' && el.data.icon.iconType === 'NOT_INTERESTED' || block === 'channel' && el.data.icon.iconType === 'REMOVE') { el.click(); await new Promise(setTimeout); break; } } document.body.click() STYLE.sheet.deleteRule(index); } function init(thumb) { try { const {items} = thumb.data.menu.menuRenderer; for (const [type, iconType, title] of [ ['video', 'NOT_INTERESTED', 'Not interested!'], ['channel', 'REMOVE', "Don't recommend channel!"], ]) { const el = document.createElement('div'); el.className = ME; el.title = title; el.dataset.block = type; ELEMENTS.appendChild(el) for (const {menuServiceItemRenderer: {icon, text}} of items) { if (icon.iconType === iconType) { el.title = text.runs[0].text; break; } } } } catch (e) {} STYLE = document.createElement('style'); STYLE.textContent = /*language=CSS*/ ` ${THUMB_TAG}:hover .${ME} { display: block; } .${ME} { display: none; position: absolute; width: 16px; height: 16px; border-radius: 100%; border: 2px solid #fff; right: 10px; box-shadow: .5px .5px 7px #000; cursor: pointer; opacity: .75; z-index: 100; } .${ME}:hover { opacity: 1; } .${ME}:active { color: yellow; } .${ME}[data-block="video"] { top: 70px; } .${ME}[data-block="channel"] { top: 100px; } .${ME}::after { content: ""; position: absolute; top: 0; left: 0; right: 0; bottom: 0; height: 0; margin: auto; border: none; border-bottom: 2px solid #fff; } .${ME}[data-block="video"]::after { transform: rotate(45deg); } .${ME}[data-block="channel"]::after { margin: auto 3px; } `.replace(/;/g, '!important;'); document.head.appendChild(STYLE); }
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址