// ==UserScript== // @name 【全题型支持】EasyWJX附加-问卷星随机答案填写问卷;速通问卷,可配合EasyWJX使用;问卷星随机填写;问卷星快速填写; // @namespace http://tampermonkey.net/ // @version 1.1 // @description EasyWJX附加脚本,随机填写答案,速通问卷 // @author MelonFish // @match https://ks.wjx.top/*/* // @match http://ks.wjx.top/*/* // @match https://www.wjx.*/*/* // @match http://www.wjx.*/*/* // @icon https://www.google.com/s2/favicons?sz=64&domain=tampermonkey.net // @grant none // @require https://www.layuicdn.com/layer/layer.js // @license GNU GPLv3 // @downloadURL none // ==/UserScript== (function() { 'use strict'; // Your code here.. var randWrite_btn = document.createElement("button"); //创建一个input对象(提示框按钮) randWrite_btn.id = "randWrite_btn"; randWrite_btn.textContent = "随机填写"; randWrite_btn.style.width = "4rem"; randWrite_btn.style.height = "2rem"; randWrite_btn.style.marginLeft = '1rem'; randWrite_btn.type = 'button'; randWrite_btn.onclick = function (e){ writeAnswer() } $('#toptitle h1').eq(0).append(randWrite_btn) function getRandInt(num) { return Math.round(Math.random()*num); } function randomString(length) { var chars = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' var result = ''; for (var i = length; i > 0; --i) result += chars[Math.floor(Math.random() * chars.length)]; return result; } function writeAnswer() { var ans_ls_html = document.querySelectorAll('.field.ui-field-contain'); // 填写radio for (var i=0; i