您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Show finishing hits on items page
当前为
// ==UserScript== // @name Torn: Finishing Hits // @namespace http://tampermonkey.net/ // @version 1.0 // @description Show finishing hits on items page // @author Untouchable [1360035] // @match https://www.torn.com/item.php // @grant none // ==/UserScript== GM_addStyle ( ` table { table-layout:fixed; width:100%; } #finishing_hits > tbody > tr > td { padding:5px } table, td { border: 1px solid black; border-collapse: collapse; } td { width: 16.6% } .strike { text-decoration: line-through; } ` ); (function() { 'use strict'; let apiKey = localStorage.getItem('uapikey'); if(apiKey === null) { apiKey = ''; while(apiKey !== null && apiKey.length != 16) { apiKey = prompt("Please enter a valid Torn API key"); } if(apiKey !== null && apiKey.length == 16) { localStorage.setItem('uapikey', apiKey); } } fetch('https://api.torn.com/user/?selections=personalstats&key=' + apiKey) .then(response => response.json()) .then(data => { let ps = data.personalstats; let hr = '#mainContainer > div.content-wrapper.m-left20.left.summer > div.main-items-cont-wrap > hr'; $(hr).after( ` <div id="finishing-hits-title" class="title-black title-toggle" role="heading" aria-level="5"> <div class="arrow-999 right"></div> Finishing Hits <div class="clear"></div> </div> <table id="finishing_hits"> <tr> <td>Heavy Artillery: </td> <td>${nwc(ps.heahits)}</td> <td>Machine Guns: </td> <td>${nwc(ps.machits)}</td> <td>Rifles: </td> <td>${nwc(ps.rifhits)}</td> </tr> <tr> <td>Sub Machine Guns: </td> <td>${nwc(ps.smghits)}</td> <td>Shotguns: </td> <td>${nwc(ps.shohits)}</td> <td>Pistols: </td> <td>${nwc(ps.slahits)}</td> </tr> <tr> <td>Temporary Weapons: </td> <td>${nwc(ps.grehits)}</td> <td>Piercing Weapons: </td> <td>${nwc(ps.piehits)}</td> <td>Slashing Weapons: </td> <td>${nwc(ps.smghits)}</td> </tr> <tr> <td>Clubbing Weapons: </td> <td>${nwc(ps.axehits)}</td> <td>Mechanical Weapons: </td> <td>${nwc(ps.chahits)}</td> <td>Hand-to-Hand: </td> <td>${nwc(ps.h2hhits)}</td> </tr> </table> <br> ` ); }); })(); function GM_addStyle (cssStr) { var D = document; var newNode = D.createElement ('style'); newNode.textContent = cssStr; var targ = D.getElementsByTagName ('head')[0] || D.body || D.documentElement; targ.appendChild (newNode); } function nwc(x) { return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ","); }