您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Skip the half of the fun!
当前为
- // ==UserScript==
- // @name Sorryops
- // @namespace sorryops
- // @version 20240410.2
- // @description Skip the half of the fun!
- // @icon https://orioks.miet.ru/favicon.ico
- // @author electromagneticcyclone & angelbeautifull
- // @license Unlicense
- // @supportURL https://git.disroot.org/electromagneticcyclone/sorryops
- // @match https://orioks.miet.ru/student/student/test*
- // @grant GM_getValue
- // @grant GM_setValue
- // @run-at document-start
- // ==/UserScript==
- 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);
- }
- function actionFunction() {
- var i;
- var objects = new Object();
- var boxes = document.getElementsByTagName('input');
- var form = document.getElementById('testform-answer');
- for (i = 0; i < boxes.length; i++) {
- if (boxes[i].type === 'checkbox' | boxes[i].type === 'radio') {
- var span = document.createElement('span');
- span.innerHTML =
- boxes[i].type === 'radio' && boxes[i].value == "1"
- ? "<b>" + boxes[i].value + ")</b> "
- : boxes[i].value + ") ";
- boxes[i].parentNode.insertBefore(span, boxes[i]);
- objects[boxes[i].value] = boxes[i].parentNode;
- }
- }
- const sorted_objects = Object.keys(objects).sort().reduce(
- (obj, key) => {
- obj[key] = objects[key];
- return obj;
- }, {}
- );
- for (var key in sorted_objects) {
- sorted_objects[key].remove();
- form.appendChild(sorted_objects[key]);
- }
- 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;
- break;
- }
- }
- }