Last active
April 2, 2024 12:48
-
-
Save maxtheaxe/b47de2a6290ed4e456485ef53c82cf5b to your computer and use it in GitHub Desktop.
Calculate Total Deposited in Alliance Bank on PnW
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name PnW Total Deposited | |
// @version 1 | |
// @description calculates total sent to alliance bank (not including withdrawals) | |
// @author https://github.com/maxtheaxe | |
// @match https://politicsandwar.com/nation/id=*&display=bank | |
// @grant none | |
// ==/UserScript== | |
let totalDeposited = 0; | |
let bankName = "Alliance Bank Name"; // replace this | |
if (bankName === "Alliance Bank Name") { // do not edit this line | |
console.log("update your alliance bank name in the script"); | |
} else { | |
let visibleRows = document.querySelector('p.center:nth-child(1) > input:nth-child(3)').value; | |
if (visibleRows === "15") { | |
console.log("don't forget to update the number of visible rows!"); | |
} | |
Array.from(document.querySelectorAll('.nationtable > tbody:nth-child(1) td:nth-child(4) > a:nth-child(1)')).filter((x) => (x.innerText === bankName)).forEach((x) => totalDeposited = totalDeposited + parseInt(x.parentNode.parentNode.querySelector('td:nth-child(6)').innerText.slice(1,).split(".")[0].replace(/,/g, ''))); | |
console.log(`total deposited in the bank so far: $${totalDeposited.toLocaleString()}`); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment