您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
问卷网储存答案
当前为
// ==UserScript== // @name wenjuan::问卷网储存答案 // @namespace http://tampermonkey.net/ // @version 1.0 // @description 问卷网储存答案 // @author Cosil.C // @match http*://www.wenjuan.com/s/* // @icon https://www.wenjuan.com/favicon.ico // @grant GM_setValue // @grant GM_getValue // @grant GM_deleteValue // @grant unsafeWindow // @license GPLv3 // ==/UserScript== //问卷id localStorage.clear(); sessionStorage.clear(); let questionnaire = /(?<=\/s\/)[^\/]+/.exec(location.pathname)[0]; unsafeWindow.saveAnswers = () => {GM_setValue(questionnaire,unsafeWindow.total_answers);alert(`成功保存问卷${questionnaire}的答案`)} unsafeWindow.resetAnswers = () => {GM_deleteValue(questionnaire);alert(`成功清除问卷${questionnaire}的答案`)} let answers = GM_getValue(questionnaire, {}); for(let queId in answers){ for(let valueId of answers[queId]){ let valueEle = //document.querySelector(`[value='${valueId}']`); document.querySelector(`input[value='${valueId}'],.w-selection-option[value='${valueId}']`) console.group(); console.log('queId',queId); console.log('valueId',valueId); console.log('selector',`[value='${valueId}']`); console.log('valueEle',valueEle); console.groupEnd(); valueEle?.click(); } } $('body').prepend(`<div style="float: left; position: fixed; width: 55px; height: 29px; line-height: 30px; background: #2e82ff; color: #ffffff; margin: 13px 0 0 13px; border-radius: 6px; text-align: center; " onclick='saveAnswers()'> <span>保存</span> </div> <div style="float: left; width: 55px; height: 29px; line-height: 30px; background: #cccccc; color: #5f5f5f; border: #2e82ff; margin: 55px 0 0 13px; border-radius: 6px; text-align: center; position: fixed; " onclick='resetAnswers()'> <span>重置</span> </div>`);