Add Bars To GFAQS Votals

adds bars to gamefaqs votals screen

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

Bạn sẽ cần cài đặt một tiện ích mở rộng như Tampermonkey hoặc Violentmonkey để cài đặt kịch bản này.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(Tôi đã có Trình quản lý tập lệnh người dùng, hãy cài đặt nó!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         Add Bars To GFAQS Votals
// @namespace    http://foolmoron.io
// @version      0.2
// @description  adds bars to gamefaqs votals screen
// @author       @foolmoron
// @match        http://*.gamefaqs.com/features/bge20_vote
// @grant        none
// ==/UserScript==

$(function() {
	BAR_HEIGHT = '20px';
	BORDER_RADIUS = '10px';
	FIRST_COLOR = '#3951C6';
	SECOND_COLOR = '#28398A';
	
	// kill ugly bars
	$('.battle_results').css('background-image', '')

    // add nice bars
    var detailedResults = $('.detailed_results');
    for (var i = 0; i < detailedResults.length; i++) {
        var detailedResult = detailedResults.eq(i);
        var firstPerc = $('.battle_results', detailedResult.siblings('.battler_box')[0]).text();
        var secondPerc = $('.battle_results', detailedResult.siblings('.battler_box')[1]).text();
        detailedResult.before('\
        	<div style="height: ' + BAR_HEIGHT + '; padding: 0px 4px;">\
        		<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>\
        		<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>\
    		</div>\
		');
    }
});