您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Gray out notification area when disconnected from updates and try to reconnect.
当前为
- // ==UserScript==
- // @name Gab.ai Connection Status
- // @namespace https://www.ekkooff.com/
- // @version 0.1
- // @description Gray out notification area when disconnected from updates and try to reconnect.
- // @author Kevin Roberts
- // @match https://gab.ai/*
- // @grant none
- // ==/UserScript==
- (function() {
- 'use strict';
- // Your code here...
- setInterval(function() {
- var state = null,count=null;
- if(Pusher && Pusher.instances[0] && Pusher.instances[0].connection && Pusher.instances[0].connection.state) {
- state = Pusher.instances[0].connection.state;
- } else {
- return;
- }
- //console.log('state:',state);
- if(state==='disconnected') {
- count = $('.notification-count span');
- count.css('background-color','#444');
- count.removeClass('hidden');
- Pusher.instances[0].connection.connect();
- } else {
- count = $('.notification-count span');
- count.css('background-color','');
- if(parseInt(count.text()) === 0) {
- count.addClass('hidden');
- }
- }
- },5000);
- })();