GAB Notification Count in Title

Show a notification count in the title of the page for tab browsing convenience.

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         GAB Notification Count in Title
// @namespace    http://gab.ai/Jeremy20_9
// @version      0.1
// @description  Show a notification count in the title of the page for tab browsing convenience.
// @author       Jeremiah 20:9
// @match        https://gab.ai/*
// @grant        none
// ==/UserScript==

var pagetitle = document.title;
var itvcheck = -1;
$(document).ready(function(){
    itvcheck = setInterval(function(){
        var indicator = $(".header__link--notifications");
        if(indicator.length > 0)
        {
            indicator = $(indicator).find("span");
            var count = parseInt($(indicator).text());
            if(count > 0)
                document.title = pagetitle + "(" + count + ")";
            else
                document.title = pagetitle;
        }
    }, 1000);
});