HSReplay/HDT Deck Counters

Shows the numbers of cards, doubles and legendaries, next to HSReplay build names, that you need to complete them [#n=needed/#d=doubles/#★=legendaries]

  1. // ==UserScript==
  2. // @name HSReplay/HDT Deck Counters
  3. // @namespace https://greasyfork.org/en/users/10118-drhouse
  4. // @version 1.0
  5. // @run-at document-end
  6. // @description Shows the numbers of cards, doubles and legendaries, next to HSReplay build names, that you need to complete them [#n=needed/#d=doubles/#★=legendaries]
  7. // @include https://hsreplay.net/decks/*
  8. // @require http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js
  9. // @require https://code.jquery.com/ui/1.12.1/jquery-ui.js
  10. // @author drhouse
  11. // ==/UserScript==
  12. //this.$ = this.jQuery = jQuery.noConflict(true);
  13. //debugger;
  14. /* global $ */
  15.  
  16. $(document).ready(function () {
  17.  
  18. var missingcount = 0;
  19. var ownedcount = 0;
  20. var doubles = 0;
  21. var legends = 0;
  22. var rows = 0;
  23. var row = 0;
  24. var indexb = 0;
  25. var indexc = 0;
  26.  
  27. function runit(){
  28.  
  29. var list = $("#decks-container > div > div.deck-list-wrapper > div > ul");
  30. var missingx = $("#decks-container > div > div.deck-list-wrapper > div > ul > li");
  31.  
  32. $(missingx).each( function (index, value) {
  33.  
  34. missingcount = 0;
  35. doubles = 0;
  36. legends = 0;
  37.  
  38. $(this).find("a > div > div.col-lg-6.col-md-7.col-sm-8.hidden-xs > ul > li").each(function (index, value) {
  39. indexc = index + 1;
  40. console.log("indexc: " + indexc)
  41.  
  42. if($(this).attr('class') == 'missing-card'){
  43. missingcount = missingcount + 1;
  44. if($(this).find("div > a > div > span").text() == '×2')
  45. doubles = doubles + 1;
  46. if($(this).find("div > a > div > span").text() == '★')
  47. legends = legends + 1;
  48.  
  49. }
  50. })
  51. var title = $(this).find(" a > div > div.col-lg-2.col-md-2.col-sm-2.col-xs-6 > span");
  52. $("<span> - " + missingcount + "n ( " + doubles + "d / " + legends + "★)</span>").appendTo(title);
  53. });
  54. };
  55.  
  56. setTimeout(function() {
  57. runit()
  58. }, 500);
  59.  
  60. $(window).on('hashchange',function(){
  61. setTimeout(function() {
  62. runit()
  63. }, 500);
  64. });
  65.  
  66. });
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.