您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Adds attack links on enemy list
当前为
// ==UserScript== // @name Attack links on enemy list // @namespace https://gitgud.com/stephenlynx // @version 1.1.1 // @description Adds attack links on enemy list // @author Stephen Lynx // @license MIT // @match https://www.torn.com/blacklist.php // @icon https://www.google.com/s2/favicons?sz=64&domain=torn.com // @run-at document-body // @grant none // ==/UserScript== (function() { 'use strict'; var observer = new MutationObserver(function(mutationList, observer) { mutationList.forEach(function(event) { if (event.addedNodes.length && event.target.className === 'blacklist' && event.target.tagName === 'DIV') { event.addedNodes.forEach(function(addedNode) { if (addedNode.classList && addedNode.classList.contains('user-info-blacklist-wrap')) { var links = addedNode.getElementsByClassName('user name'); Array.from(links).forEach( function(link) { var cell = link.parentNode.parentNode.parentNode; var okStatus = !!cell .getElementsByClassName('user-green-status ').length; if (!okStatus) { cell.style.display = 'none'; return; } var destination = link.href; var id = destination.match(/\/profiles\.php\?XID=(\d*)/)[1]; var attackLink = document.createElement('a'); var oldOnClick = attackLink.onclick; attackLink.onclick = function(event){ event.stopPropagation(); oldOnClick(); } attackLink.innerHTML = 'Attack'; attackLink.target = '_blank'; attackLink.href = '/loader.php?sid=attack&user2ID=' + id; link.after(attackLink); }); } }); } }); }); observer.observe(document.getElementsByTagName('body')[0], { childList : true, subtree : true }); })();