您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Exclude Piazza Stories from the overall notifications badge
// ==UserScript== // @name Hide Piazza Stories Badge // @description Exclude Piazza Stories from the overall notifications badge // @match *://piazza.com/* // @grant none // @noframes // @version 1.1 // @icon https://piazza.com/favicon.ico // @namespace https://greasyforks.org/users/167667 // ==/UserScript== //console.log("Userscript is running"); globalBadge = document.getElementById("global_notifications_indicator"); if (globalBadge === null || globalBadge === undefined) { console.log("Userscript error: Global notification indicator not found"); return; } storiesBadge = document.getElementById("dropdown_notifications_stories_ixoaerg0y5u6e6"); if (storiesBadge === null || storiesBadge === undefined) { console.log("Userscript error: Piazza Stories notification badge not found"); return; } storiesNum = Number(storiesBadge.innerText); if (storiesNum === null || storiesNum === undefined || isNaN(storiesNum)) { console.log("Userscript error: Piazza Stories notification badge has non-numeric value"); return; } else if (storiesNum < 0) { console.log("Userscript error: Piazza Stories notification badge has negative value"); return; } globalNum = Number(globalBadge.innerText) - storiesNum; if (globalNum === null || globalNum === undefined) { return; } else if (globalNum < 0) { console.log("Userscript error: Notification number shouldn't be negative!"); return; } else if (globalNum === 0) { globalBadge.parentNode.style.visibility = 'hidden'; } else { globalBadge.innerText = globalNum; }