mirror of
https://gitlab.com/MrFry/moodle-test-userscript
synced 2025-04-01 20:22:48 +02:00
Small design change, small bug fix, smol msg on passive mode
This commit is contained in:
parent
73f3631f75
commit
477d10123e
3 changed files with 46 additions and 38 deletions
80
stable.js
80
stable.js
|
@ -21,7 +21,7 @@
|
|||
|
||||
// ==UserScript==
|
||||
// @name Moodle/Elearning/KMOOC test help
|
||||
// @version 1.6.2.6
|
||||
// @version 1.6.2.7
|
||||
// @description Online Moodle/Elearning/KMOOC test help
|
||||
// @author YourFriendlyNeighborhoodDealer
|
||||
// @match https://elearning.uni-obuda.hu/main/*
|
||||
|
@ -250,6 +250,8 @@
|
|||
//: Main function {{{
|
||||
function Main() {
|
||||
'use strict';
|
||||
console.time('main');
|
||||
|
||||
Init(function(count, subjCount) {
|
||||
var url = location.href;
|
||||
|
||||
|
@ -260,36 +262,38 @@
|
|||
m: "Passzív mód bekapcsolva, válaszok megjelenítéséhez menü gomb alatt kapcsold ki, és frissíts!",
|
||||
isSimple: true
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
if ((url.includes("/quiz/") && url.includes("attempt.php")) || forceTestPage) { // if the current page is a test
|
||||
HandleQuiz();
|
||||
} else if ((url.includes("/quiz/") && url.includes("review.php")) || forceResultPage) { // if the current window is a test-s result
|
||||
HandleResults(url);
|
||||
} else if ((!url.includes("/quiz/") && !url.includes("review.php") && !url.includes(".pdf")) ||
|
||||
(forceDefaultPage)) { // if the current window is any other window than a quiz or pdf.
|
||||
HandleUI(url, count, subjCount);
|
||||
}
|
||||
} catch (e) {
|
||||
ShowMessage({
|
||||
m: "Fatál error. Check console (f12). Kattints az üzenetre az összes kérdés/válaszért manuális kereséshez!",
|
||||
isSimple: true
|
||||
}, undefined, function() {
|
||||
GM_openInTab(serverAdress + 'legacy', {
|
||||
active: true
|
||||
} else {
|
||||
try {
|
||||
if ((url.includes("/quiz/") && url.includes("attempt.php")) || forceTestPage) { // if the current page is a test
|
||||
HandleQuiz();
|
||||
} else if ((url.includes("/quiz/") && url.includes("review.php")) || forceResultPage) { // if the current window is a test-s result
|
||||
HandleResults(url);
|
||||
} else if ((!url.includes("/quiz/") && !url.includes("review.php") && !url.includes(".pdf")) ||
|
||||
(forceDefaultPage)) { // if the current window is any other window than a quiz or pdf.
|
||||
HandleUI(url, count, subjCount);
|
||||
}
|
||||
} catch (e) {
|
||||
ShowMessage({
|
||||
m: "Fatál error. Check console (f12). Kattints az üzenetre az összes kérdés/válaszért manuális kereséshez!",
|
||||
isSimple: true
|
||||
}, undefined, function() {
|
||||
GM_openInTab(serverAdress + 'legacy', {
|
||||
active: true
|
||||
});
|
||||
});
|
||||
});
|
||||
Exception(e, "script error at main:");
|
||||
Exception(e, "script error at main:");
|
||||
}
|
||||
if (url.includes("eduplayer")) // if the current site is a video site
|
||||
AddVideoHotkeys(url); // adding video hotkeys
|
||||
Log(
|
||||
"Itteni hibák 100% a moodle hiba. Kivéve, ha oda van írva hogy script error ;) Ha ilyesmi szerepel itt, akkor olvasd el a segítség szekciót! Nagy esélyel a kérdéseket nem lehetett beolvasni."
|
||||
);
|
||||
}
|
||||
if (url.includes("eduplayer")) // if the current site is a video site
|
||||
AddVideoHotkeys(url); // adding video hotkeys
|
||||
Log(
|
||||
"Itteni hibák 100% a moodle hiba. Kivéve, ha oda van írva hogy script error ;) Ha ilyesmi szerepel itt, akkor olvasd el a segítség szekciót! Nagy esélyel a kérdéseket nem lehetett beolvasni."
|
||||
);
|
||||
});
|
||||
|
||||
console.log("Moodle Test Script run time:");
|
||||
console.timeEnd('main');
|
||||
|
||||
if (forceTestPage || forceResultPage || forceDefaultPage)
|
||||
alert("TEST MODE");
|
||||
}
|
||||
|
@ -1611,7 +1615,7 @@
|
|||
mainDiv.style.background = "#222d32"; // background color
|
||||
mainDiv.style.color = "#ffffff"; // text color
|
||||
mainDiv.style.borderColor = "#035a8f"; // border color
|
||||
mainDiv.style.border = "solid";
|
||||
mainDiv.style.border = "none";
|
||||
mainDiv.style.top = (startFromTop) + 'px';
|
||||
mainDiv.style.left = (window.innerWidth - width) / 2 + 'px';
|
||||
mainDiv.style.opacity = "0.9"; // setting starting opacity
|
||||
|
@ -1841,12 +1845,16 @@
|
|||
|
||||
questionsTickBox.addEventListener("click", function() {
|
||||
GM_setValue("skipLoad", questionsTickBox.checked);
|
||||
if (GM_getValue("skipLoad")) {
|
||||
ShowMessage({
|
||||
m: "Passzív mód bekapcsolva, mostantól kérdések nem lesznek betöltve/lekérve.",
|
||||
isSimple: true
|
||||
}, 10);
|
||||
}
|
||||
var msg = "";
|
||||
if (GM_getValue("skipLoad"))
|
||||
msg = "Passzív mód bekapcsolva, mostantól kérdések nem lesznek betöltve/lekérve.";
|
||||
else
|
||||
msg = "Passzív mód kikapcsolva, frissíts az érvénybe lépéshez!";
|
||||
|
||||
ShowMessage({
|
||||
m: msg,
|
||||
isSimple: true
|
||||
}, 6);
|
||||
|
||||
});
|
||||
var loadDataCheckBoxText = CreateNodeWithText(questionsTickBox,
|
||||
|
@ -1884,7 +1892,7 @@
|
|||
menuDiv.style.background = "#222d32"; // background color
|
||||
menuDiv.style.color = "#ffffff"; // text color
|
||||
menuDiv.style.borderColor = "#035a8f"; // border color
|
||||
menuDiv.style.border = "solid";
|
||||
menuDiv.style.border = "none";
|
||||
menuDiv.style.opacity = "1"; // setting starting opacity
|
||||
|
||||
var fiveMargin = "5px 5px 5px 5px";
|
||||
|
@ -2145,7 +2153,7 @@
|
|||
|
||||
// removes some crap from "q"
|
||||
function SimplifyQuery(q) {
|
||||
var result = q.replace(/\n/g, "").replace(/\s/g, ' '); // WHY TF ARE THERE TWO KINDA SPACES??? (charcode 160 n 32)
|
||||
var result = q.replace(/\n/g, " ").replace(/\s/g, ' '); // WHY TF ARE THERE TWO KINDA SPACES??? (charcode 160 n 32)
|
||||
return RemoveUnnecesarySpaces(result);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue