屏蔽知乎私信提醒

try to take over the world!

目前為 2020-08-09 提交的版本,檢視 最新版本

// ==UserScript==
// @name         屏蔽知乎私信提醒
// @namespace    http://tampermonkey.net/
// @version      0.7
// @description  try to take over the world!
// @author       You
// @match        http://*.zhihu.com/*
// @match        https://*.zhihu.com/*
// @grant        none
// @run-at          document-end
// ==/UserScript==

(function () {
  var titleRegexp = /^\(.*\)/;
  var documentTitle = document.querySelector('head > title');
  var observer = new MutationObserver(function (mutations) {
    mutations.forEach(function (mutation) {
      console.log('documentTitle changed:', mutation.target.textContent);
      setTimeout(function () {
        if (titleRegexp.test(mutation.target.textContent)) {
          document.title = document.title.replace(titleRegexp, '');
          var targetRedDot = document.querySelector('.AppHeader-messages div');
          // targetRedDot.parentNode.removeChild(targetRedDot);
          targetRedDot.style.display = 'none';
        }
      }, 100);
    });
  });
  observer.observe(documentTitle, {
    subtree: true,
    characterData: true,
    childList: true,
  });
})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址