Autoclicker, copiable field
This commit is contained in:
parent
e6b5d74962
commit
0a7e011166
41
user.js
41
user.js
|
@ -1,7 +1,7 @@
|
|||
// ==UserScript==
|
||||
// @name Sorryops
|
||||
// @namespace sorryops
|
||||
// @version 20240410.2
|
||||
// @version 20240410.3
|
||||
// @description Skip the half of the fun!
|
||||
// @icon https://orioks.miet.ru/favicon.ico
|
||||
// @author electromagneticcyclone & angelbeautifull
|
||||
|
@ -10,26 +10,49 @@
|
|||
// @match https://orioks.miet.ru/student/student/test*
|
||||
// @grant GM_getValue
|
||||
// @grant GM_setValue
|
||||
// @grant GM_addStyle
|
||||
// @grant GM_registerMenuCommand
|
||||
// @run-at document-start
|
||||
// @require https://raw.github.com/odyniec/MonkeyConfig/master/monkeyconfig.js
|
||||
// @downloadURL https://update.greasyfork.org/scripts/481036/Sorryops.user.js
|
||||
// @updateURL https://update.greasyfork.org/scripts/481036/Sorryops.meta.js
|
||||
// ==/UserScript==
|
||||
|
||||
const config = new MonkeyConfig({
|
||||
title: 'Configure My Userscript!',
|
||||
menuCommand: true,
|
||||
params: {
|
||||
auto_answer: {
|
||||
type: 'select',
|
||||
choices: [ 'No', 'Click', 'Click + Display' ],
|
||||
default: 'No'
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
GM_registerMenuCommand('Configure My Userscript!', () => {
|
||||
config.open();
|
||||
})
|
||||
|
||||
window.addEventListener('load', actionFunction);
|
||||
|
||||
// https://stackoverflow.com/a/15710692
|
||||
function hashCode(s) {
|
||||
return s.split("").reduce(function(a, b) {
|
||||
a = ((a << 5) - a) + b.charCodeAt(0);
|
||||
return a & a;
|
||||
}, 0);
|
||||
return s.split("").reduce(function(a, b) {
|
||||
a = ((a << 5) - a) + b.charCodeAt(0);
|
||||
return a & a;
|
||||
}, 0);
|
||||
}
|
||||
|
||||
function actionFunction() {
|
||||
var i;
|
||||
var objects = new Object();
|
||||
var boxes = document.getElementsByTagName('input');
|
||||
var answers = [];
|
||||
var form = document.getElementById('testform-answer');
|
||||
for (i = 0; i < boxes.length; i++) {
|
||||
if (boxes[i].type === 'checkbox' | boxes[i].type === 'radio') {
|
||||
answers.push(boxes[i]);
|
||||
var span = document.createElement('span');
|
||||
span.innerHTML =
|
||||
boxes[i].type === 'radio' && boxes[i].value == "1"
|
||||
|
@ -49,13 +72,19 @@ function actionFunction() {
|
|||
sorted_objects[key].remove();
|
||||
form.appendChild(sorted_objects[key]);
|
||||
}
|
||||
const auto_answer = config.get('auto_answer');
|
||||
var randansw;
|
||||
if (auto_answer != 'No') {
|
||||
randansw = Math.floor(Math.random() * answers.length);
|
||||
answers[randansw].click();
|
||||
}
|
||||
var variant = document.getElementById('w0').parentNode.textContent;
|
||||
variant = variant.slice(variant.indexOf("Вопрос:"));
|
||||
var pboxes = document.getElementsByTagName('p');
|
||||
for (i = 0; i < pboxes.length; i++) {
|
||||
var pbox = pboxes[i];
|
||||
if (pbox.textContent == "Вопрос:") {
|
||||
pbox.innerHTML = "<i>(Вариант " + hashCode(variant) + ")</i><br>" + pbox.textContent;
|
||||
pbox.innerHTML = "<i>(Вариант <input onfocus='this.select();' id='variant' value='" + hashCode(variant) + (auto_answer == 'Click + Display' ? (" " + answers[randansw].value) : "") + "' readonly>)</i><br>" + pbox.textContent;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue