Greasy Fork

Greasy Fork is available in English.

安全教育平台快速填写问卷

一键点击页面上的所有选项

当前为 2018-09-25 提交的版本,查看 最新版本

// ==UserScript==
// @name         安全教育平台快速填写问卷
// @description  一键点击页面上的所有选项
// @namespace    http://greasyfork.icu/users/197529
// @version      0.1
// @author       kkocdko
// @include      *://zhuanti.xueanquan.com/*
// ==/UserScript==

function addButton(showText, clickEvent)
{
    var button=document.createElement('button')
    button.style='position:fixed;float:left;margin:5px;padding:5px;border:1px #000 solid;background:#eee;z-index:3';
    button.addEventListener('click',clickEvent);
    button.innerText=showText;
    var topBar=document.body;
    topBar.insertBefore(button,topBar.firstElementChild);
}

addButton('Click All', ()=>
{
    document.querySelectorAll('*[type=radio]').forEach((item)=>{item.click()});
    document.querySelectorAll('*[type=checkbox]').forEach((item)=>{item.click()});
});