Add Bars To GFAQS Votals

adds bars to gamefaqs votals screen

  1. // ==UserScript==
  2. // @name Add Bars To GFAQS Votals
  3. // @namespace http://foolmoron.io
  4. // @version 0.2
  5. // @description adds bars to gamefaqs votals screen
  6. // @author @foolmoron
  7. // @match http://*.gamefaqs.com/features/bge20_vote
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. $(function() {
  12. BAR_HEIGHT = '20px';
  13. BORDER_RADIUS = '10px';
  14. FIRST_COLOR = '#3951C6';
  15. SECOND_COLOR = '#28398A';
  16. // kill ugly bars
  17. $('.battle_results').css('background-image', '')
  18.  
  19. // add nice bars
  20. var detailedResults = $('.detailed_results');
  21. for (var i = 0; i < detailedResults.length; i++) {
  22. var detailedResult = detailedResults.eq(i);
  23. var firstPerc = $('.battle_results', detailedResult.siblings('.battler_box')[0]).text();
  24. var secondPerc = $('.battle_results', detailedResult.siblings('.battler_box')[1]).text();
  25. detailedResult.before('\
  26. <div style="height: ' + BAR_HEIGHT + '; padding: 0px 4px;">\
  27. <div style="float: right; height: 100%; background-color: ' + SECOND_COLOR + '; width: ' + secondPerc + '; border-top-right-radius: ' + BORDER_RADIUS + '; border-bottom-right-radius: ' + BORDER_RADIUS + '; border-left: 1px solid #ADD8E6;"></div>\
  28. <div style="float: right; height: 100%; background-color: ' + FIRST_COLOR + '; width: ' + firstPerc + '; border-top-left-radius: ' + BORDER_RADIUS + '; border-bottom-left-radius: ' + BORDER_RADIUS + '; border-right: 1px solid #ADD8E6;"></div>\
  29. </div>\
  30. ');
  31. }
  32. });