GameFAQs Daily Poll Radio Buttons

Changes GameFAQs Poll to use radio button display

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     GameFAQs Daily Poll Radio Buttons
// @description Changes GameFAQs Poll to use radio button display
// @version  1.2
// @grant    none
// @include https://gamefaqs.gamespot.com/
// @namespace https://greasyfork.org/users/5885
// ==/UserScript==
function potd_radio_buttons() {
    var po_blocks = document.getElementsByClassName('po_block');
    var selected = false;
    var disable_buttons = false;
    var disabled = document.getElementsByClassName('po_disabled');
    if (disabled.length > 0) {
        disable_buttons = true;
    }
    for (var i = 0; i < po_blocks.length; i++) {
        if (!disable_buttons) {
            po_blocks[i].addEventListener("click", potd_radio_buttons);
        }
        var po_box = po_blocks[i].getElementsByClassName('po_box')[0];
        if (po_box.textContent == '☒' || po_box.textContent == '☑') {
            selected = true;
        } else {
            selected = false;
        }
        po_box.textContent = '';
        var input = document.createElement('input');
        input.setAttribute("type", "radio");
        input.setAttribute("name", "gfaqs_poll");
        if (disable_buttons) {
            input.setAttribute("disabled", "disabled");
        }
        if (selected) {
            input.setAttribute("checked", "checked");
        }
        po_box.appendChild(input);
    }
}
potd_radio_buttons();