您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
automatically closes torn profile pages if target is not a punchbag
// ==UserScript== // @name AutoCloseTheStrong // @namespace http://tampermonkey.net/ // @version 0.2 // @description automatically closes torn profile pages if target is not a punchbag // @author WizardRubic // @match *.torn.com/profiles.php* // @grant window.close // ==/UserScript== (function() { 'use strict'; var isWeak = function(title) { // returns true if the targets is any of the following titles return title=="Punchbag" || title=="Healer" || title=="Loser"; }; var profileElement = (document.getElementsByClassName("content-wrapper")[0]); var callback = function(mutationsList) { var rankTitleElement = document.getElementsByClassName("two-row"); if(rankTitleElement==undefined) { return; } var rankTitleArray = rankTitleElement[0]; if(rankTitleArray == undefined) { return; } var title = rankTitleArray.children[1].innerText; if(title!=undefined && !isWeak(title)) { window.close(); } observer.disconnect(); }; var mutationConfig = { attributes: true, childList: true, subtree: true }; var observer = new MutationObserver(callback); observer.observe(profileElement, mutationConfig); })();