Advertisement
Nightrush

[WIP] Battle Count

May 29th, 2015
342
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name           TPPC: Battle Count
  3. // @description    Counts battles -- click "total battles" to reset
  4. // @author         Nightrush
  5. // @include        http://*tppcrpg.net*
  6. // @require        http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js
  7. // @require        https://gist.github.com/raw/2625891/waitForKeyElements.js
  8. // @version        0.35
  9. // @grant          GM_getValue
  10. // @grant          GM_setValue
  11. // @grant          GM_deleteValue
  12. // ==/UserScript==
  13. waitForKeyElements("#cancelBattle",battleCount);
  14. function battleCount() {
  15.     if ($("#cancelBattle a").text() == "Restart Battle") {
  16.         var addBattle = GM_getValue("battles") + 1;
  17.         GM_setValue("battles",addBattle);
  18.     }
  19. }
  20. $(document).ready(function(){
  21.     if (!GM_getValue("battles")) { GM_setValue("battles",0); }
  22.     $(".lvlitem").append("<br><a href='#' style='color:#FFFFFF;text-decoration:none;'>Total Battles:</a> " + GM_getValue("battles"));
  23.     $(".lvlitem a").click(function() {
  24.         if (confirm("Reset battle count?")) {
  25.             GM_deleteValue("battles");
  26.         }
  27.     });
  28. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement