您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Add notification check and count-update each 3 seconds to Habitica's system message notifcation area and adds a marking if notifications are still present
// ==UserScript== // @name Habitica Redesign 2017 Enhanced Notifications // @namespace http://nico-siebler.de/ // @version 0.1 // @description Add notification check and count-update each 3 seconds to Habitica's system message notifcation area and adds a marking if notifications are still present // @author Nico Siebler <[email protected]> // @match https://habitica.com/* // @grant none // @require https://code.jquery.com/jquery-3.2.1.min.js // ==/UserScript== (function() { 'use strict'; setInterval(function() { if (typeof jQuery !== "undefined") { // Re read content if content was replaced var notifyRootEl = jQuery('div.svg-icon.notifications'); if (typeof notifyRootEl !== "undefined" && notifyRootEl.length > 0) { var notifySvgEl = notifyRootEl.find('svg path'); var notifyDefaultFill = notifySvgEl.attr('defaultfill'); if (! notifyDefaultFill) { notifySvgEl.attr('defaultfill', notifySvgEl.attr('fill')); notifyDefaultFill = notifySvgEl.attr('defaultfill'); } if (jQuery('#dropdown-count').length === 0) { notifyRootEl.append('<span id="dropdown-count"></span>'); } var notifyMsgLen = jQuery('.dropdown-menu .dropdown-item .glyphicon-comment').length; if (notifyMsgLen) { jQuery('#dropdown-count').html(notifyMsgLen); notifySvgEl.attr('fill', '#FF0000'); } else { jQuery('#dropdown-count').html(''); notifySvgEl.attr('fill', notifyDefaultFill); } } } }, 3000); })();