返回首頁 

Greasy Fork is available in English.

去除标题中的(消息提示)

知乎,CSDN等网站打开时,浏览器的标题栏会显示消息提示,例如「(10条消息)首页 - 知乎」,「(5条消息)某CSDN博客」。本脚本可以去除标题中括号里的消息这一段文字,简化标签。


Installer dette script?
// ==UserScript==// @name         去除标题中的(消息提示)// @version      1.1// @description  知乎,CSDN等网站打开时,浏览器的标题栏会显示消息提示,例如「(10条消息)首页 - 知乎」,「(5条消息)某CSDN博客」。本脚本可以去除标题中括号里的消息这一段文字,简化标签。// @author       Zhou Yucheng// @match        *://*.zhihu.com/*// @match        *://*.csdn.net/*// @grant        none// @namespace http://tampermonkey.net/// ==/UserScript==function removeNotification () {let t=document.querySelector("head > title")let s=t.innerHTMLconsole.log('title', s)let i=s.indexOf('(')let k=s.indexOf('消息')let j=s.indexOf(')')if (i==0 && i<k && k<j){t.innerHTML = s.substring(j+1).trim()document.title = t.innerHTML}i=s.indexOf('(')j=s.indexOf(')')if (i==0 && i<k && k<j){t.innerHTML=s.substring(j+1).trim()document.title = t.innerHTML}}(function() {'use strict';document.addEventListener('DOMContentLoaded', () => setInterval(removeNotification, 500));window.addEventListener('load', () => setInterval(removeNotification, 500));})();