Shows some info in Attack Logs
当前为
// ==UserScript==
// @name Visible Bonus
// @version 1.0
// @description Shows some info in Attack Logs
// @author Elvay [3095345]
// @match https://www.torn.com/loader.php?sid=attackLog&ID=*
// @match https://www.torn.com/loader.php?sid=attack&user2ID=*
// @namespace https://greasyfork.org/users/1279378
// ==/UserScript==
'use strict';
function colorByType(type){
switch(type) {
case "crit":
return '#FF0000';
break;
case "leave":
case "hospitalize":
case "mug":
case "lose":
return '#000000'
break;
case "grenade":
return '#FFA500';
break;
default:
return '#0000FF'
}
}
var list = document.querySelector('ul[class^="log-list"]');
if(list==null){
list= document.querySelector('ul[class^="list"]')
}
const exclusions = ["damage","miss","reloading"]
list.querySelectorAll('li').forEach(e => {
const span = e.querySelector('span[class^="attacking-events-"]');
const msg = e.querySelector('span.message');
if (span && msg) {
const type = span.className.replace("attacking-events-", "").replace("standart-","").replace("attack-","").replace("critical-hit","crit").replace("-use","");
const tag = document.createElement('span');
tag.textContent = `${type}`;
tag.style.color = '#FFF';
tag.style.background= colorByType(type);
tag.style.display = 'inline-block'
tag.style.width = 'fit-content'
tag.style.fontSize = '11px';
tag.style.borderRadius = '5px';
tag.style.padding = '2px 4px';
tag.style.fontWeight = 'bold';
tag.style.margin= '0px 0px 0px 0px';
tag.style.textTransform = 'uppercase';
if(!exclusions.includes(type)){
msg.prepend(tag);
}
}
});