您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
User muting for Eternity Tower. Must refresh after altering list.
// ==UserScript== // @name Eternity Tower User Mute // @namespace http://tampermonkey.net/ // @version 0.1 // @description User muting for Eternity Tower. Must refresh after altering list. // @author Aes Sedai // @match http*://*.eternitytower.net/* // @grant none // ==/UserScript== (function() { 'use strict'; window.usermute = {}; window.usermute.users = JSON.parse(localStorage.getItem('usermute_users')) || []; var muteInterval = setInterval(function() { if (document.querySelector("#navbarSupportedContent > form > ul") !== null) { var shopNav = document.querySelector("#navbarSupportedContent > form > ul"); var muteButtonLi = document.createElement("li"); muteButtonLi.className = "nav-item"; var muteButton = document.createElement("a"); muteButton.className = "nav-link"; muteButton.href = "#"; muteButton.id = "muteButton"; muteButton.innerHTML = "Muted Users"; muteButton.onclick = function() { var users = prompt("Please enter a lowercased, comma-separated list of users", window.usermute.users.join(',')); if (users !== null) { window.usermute.users = users.split(','); console.log("usernames: ", window.usermute.users); } }; muteButtonLi.appendChild(muteButton); shopNav.insertBefore(muteButtonLi, shopNav.childNodes[0]); clearInterval(muteInterval); // here muteInterval is undefined, but when we call this function it will be defined in this context } }, 100); Meteor.connection._stream.on('message', function(sMeteorRawData){ try { var oMeteorData = JSON.parse(sMeteorRawData); if (oMeteorData.collection == "simpleChats") { if (window.usermute.users.indexOf(oMeteorData.fields.username) > -1) { var interval = setInterval(function() { if (document.getElementById(oMeteorData.id) !== null) { var elem = document.getElementById(oMeteorData.id); elem.setAttribute("style", "display:none;"); clearInterval(interval); // here interval is undefined, but when we call this function it will be defined in this context } }, 50); } } } catch (err) { } }); window.onbeforeunload = function() { localStorage.setItem('usermute_users', JSON.stringify(window.usermute.users)); }; })();