您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Empêche les notifications pour les vidéos "Shorts" sur YouTube
// ==UserScript== // @name DYSN (Disable YouTube Shorts Notifications) // @namespace http://tampermonkey.net/ // @version 1.4 // @description Empêche les notifications pour les vidéos "Shorts" sur YouTube // @author yglsan // @match https://www.youtube.com/* // @grant none // @run-at document-start // @license GPL-3.0-or-later ### cf. terms of the Gnu General Public License between /* */ symbols ### // ==/UserScript== /* GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2025 yglsan This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. */ (function() { 'use strict'; const SHORTS_SELECTOR = 'ytd-notification-renderer a[href*="/shorts/"]'; const NOTIFICATIONS_CONTAINER = "ytd-notification-renderer"; function removeShortsNotifications() { document.querySelectorAll(SHORTS_SELECTOR).forEach(link => { link.closest(NOTIFICATIONS_CONTAINER)?.remove(); }); } const observer = new MutationObserver(mutations => { mutations.forEach(mutation => { mutation.addedNodes.forEach(node => { if (node.nodeType === 1 && node.matches(NOTIFICATIONS_CONTAINER)) { removeShortsNotifications(); } }); }); }); function startObserver() { const container = document.querySelector("#notifications"); if (container) { observer.observe(container, { childList: true, subtree: true }); removeShortsNotifications(); } else { setTimeout(startObserver, 500); } } startObserver(); setInterval(removeShortsNotifications, 3000); })();