mirror of
https://gitlab.com/MrFry/moodle-test-userscript
synced 2025-04-01 20:22:48 +02:00
Fixed question highlighting in some cases
This commit is contained in:
parent
52d6bd9be9
commit
775e973681
3 changed files with 15 additions and 3 deletions
|
@ -12,7 +12,7 @@ If you want to install from here then:
|
||||||
Paste main.js between '(function() {' and '})();'
|
Paste main.js between '(function() {' and '})();'
|
||||||
Search for 'function Main', and type Main(); right before it
|
Search for 'function Main', and type Main(); right before it
|
||||||
|
|
||||||
You could also add '// <AT>require file://<path>/main.js' to frame.js, and simply call 'Main();'
|
You could also add '// (AT)require file://<path>/main.js' to frame.js, and simply call 'Main();'
|
||||||
there.
|
there.
|
||||||
|
|
||||||
<img src="http://qmining.tk/img/1.png" width="420">
|
<img src="http://qmining.tk/img/1.png" width="420">
|
||||||
|
|
2
frame.js
2
frame.js
|
@ -21,7 +21,7 @@
|
||||||
|
|
||||||
// ==UserScript==
|
// ==UserScript==
|
||||||
// @name Moodle/Elearning/KMOOC test help
|
// @name Moodle/Elearning/KMOOC test help
|
||||||
// @version 1.6.2.1
|
// @version 1.6.2.3
|
||||||
// @description Online Moodle/Elearning/KMOOC test help
|
// @description Online Moodle/Elearning/KMOOC test help
|
||||||
// @author YourFriendlyNeighborhoodDealer
|
// @author YourFriendlyNeighborhoodDealer
|
||||||
// @match https://elearning.uni-obuda.hu/main/*
|
// @match https://elearning.uni-obuda.hu/main/*
|
||||||
|
|
14
main.js
14
main.js
|
@ -1415,7 +1415,16 @@ function SortByPercent(results) {
|
||||||
|
|
||||||
// removes stuff like " a. q1" -> "q1"
|
// removes stuff like " a. q1" -> "q1"
|
||||||
function RemoveLetterMarking(inp) {
|
function RemoveLetterMarking(inp) {
|
||||||
return RemoveUnnecesarySpaces(inp.substr(inp.indexOf(".") + 1, inp.length));
|
let dotIndex = inp.indexOf('.');
|
||||||
|
let doubledotIndex = inp.indexOf(':');
|
||||||
|
let maxInd = 4; // inp.length * 0.2;
|
||||||
|
|
||||||
|
if (dotIndex < maxInd)
|
||||||
|
return RemoveUnnecesarySpaces(inp.substr(inp.indexOf(".") + 1, inp.length));
|
||||||
|
else if (doubledotIndex < maxInd)
|
||||||
|
return RemoveUnnecesarySpaces(inp.substr(inp.indexOf(":") + 1, inp.length));
|
||||||
|
else
|
||||||
|
return inp;
|
||||||
}
|
}
|
||||||
|
|
||||||
// highlights the possible solutions to the current question
|
// highlights the possible solutions to the current question
|
||||||
|
@ -1436,6 +1445,9 @@ function HighLightAnswer(results, currQuestionNumber) {
|
||||||
// removing stuff like "a."
|
// removing stuff like "a."
|
||||||
answer = RemoveLetterMarking(answer);
|
answer = RemoveLetterMarking(answer);
|
||||||
|
|
||||||
|
if (EmptyOrWhiteSpace(correct) || EmptyOrWhiteSpace(answer))
|
||||||
|
continue;
|
||||||
|
|
||||||
if (NormalizeSpaces(RemoveUnnecesarySpaces(correct)).includes(answer)) // if the correct answer includes the current answer
|
if (NormalizeSpaces(RemoveUnnecesarySpaces(correct)).includes(answer)) // if the correct answer includes the current answer
|
||||||
{
|
{
|
||||||
toColor.push(i); // adding the index
|
toColor.push(i); // adding the index
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue