Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name TPPC: Battle Count
- // @description Counts battles -- click "total battles" to reset
- // @author Nightrush
- // @include http://*tppcrpg.net*
- // @require http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js
- // @require https://gist.github.com/raw/2625891/waitForKeyElements.js
- // @version 0.35
- // @grant GM_getValue
- // @grant GM_setValue
- // @grant GM_deleteValue
- // ==/UserScript==
- waitForKeyElements("#cancelBattle",battleCount);
- function battleCount() {
- if ($("#cancelBattle a").text() == "Restart Battle") {
- var addBattle = GM_getValue("battles") + 1;
- GM_setValue("battles",addBattle);
- }
- }
- $(document).ready(function(){
- if (!GM_getValue("battles")) { GM_setValue("battles",0); }
- $(".lvlitem").append("<br><a href='#' style='color:#FFFFFF;text-decoration:none;'>Total Battles:</a> " + GM_getValue("battles"));
- $(".lvlitem a").click(function() {
- if (confirm("Reset battle count?")) {
- GM_deleteValue("battles");
- }
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement