Greasy Fork

Greasy Fork is available in English.

GameFAQs Daily Poll Radio Buttons

Changes GameFAQs Poll to use radio button display

当前为 2019-03-27 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==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 http://greasyfork.icu/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();