mirror of
https://gitlab.com/MrFry/moodle-test-userscript
synced 2025-04-01 20:22:48 +02:00
Next/prev question button bug fixes
This commit is contained in:
parent
7789c92f93
commit
9c75edfc3c
1 changed files with 5 additions and 7 deletions
12
main.js
12
main.js
|
@ -32,7 +32,7 @@ var serverAdress = "https://questionmining.tk/";
|
|||
|
||||
// forcing pages for testing. unless you test, do not set these to true!
|
||||
// only one of these should be true for testing
|
||||
const forceTestPage = false;
|
||||
const forceTestPage = true;
|
||||
const forceResultPage = false;
|
||||
const forceDefaultPage = false;
|
||||
const logElementGetting = false;
|
||||
|
@ -1189,14 +1189,13 @@ function SaveQuiz(quiz, questionData) {
|
|||
for (var i = 0; i < quiz.length; i++) // going though quiz
|
||||
{
|
||||
// searching for same questions in questionData
|
||||
var matchAt = SearchSameQuestion(questionData, quiz, i);
|
||||
var toAdd = ""; // this will be added to some variable depending on if its already in the database
|
||||
toAdd += "?" + RemoveUnnecesarySpaces(quiz[i].Q) + "\n"; // adding quiz question
|
||||
toAdd += "!" + RemoveUnnecesarySpaces(quiz[i].A) + "\n"; // adding quiz answer
|
||||
if (quiz[i].HasImage()) {
|
||||
toAdd += ">" + RemoveUnnecesarySpaces(quiz[i].I) + "\n"; // adding quiz image if there is any
|
||||
}
|
||||
if (matchAt == -1) // if there is no such item in the database (w/ same q and a)
|
||||
if (SearchSameQuestion(questionData, quiz, i) == -1) // if there is no such item in the database (w/ same q and a)
|
||||
{
|
||||
output += toAdd; // adding to output
|
||||
newQuestions.push(quiz[i]);
|
||||
|
@ -1208,17 +1207,16 @@ function SaveQuiz(quiz, questionData) {
|
|||
var sendSuccess = false;
|
||||
var sentData = {};
|
||||
try {
|
||||
var subj = "NOSUBJ";
|
||||
try {
|
||||
subj = GetCurrentSubjectName();
|
||||
sentData.subj = GetCurrentSubjectName();
|
||||
} catch (e) {
|
||||
sentData.subj = "NOSUBJ";
|
||||
console.log("unable to get subject name :c");
|
||||
}
|
||||
var useNetDB = GM_getValue("useNetDB");
|
||||
if (useNetDB != undefined && useNetDB == 1) {
|
||||
sentData.allData = quiz;
|
||||
sentData.data = newQuestions;
|
||||
sentData.subj = subj;
|
||||
sentData.version = GM_info.script.version;
|
||||
SendXHRMessage("datatoadd=" + JSON.stringify(sentData));
|
||||
sendSuccess = true;
|
||||
|
@ -1575,7 +1573,7 @@ function ShowMessage(msgItem, timeout, funct) {
|
|||
}
|
||||
|
||||
var buttonMargin = "2px 2px 2px 2px"; // uniform button margin
|
||||
if (msgItem[currItem].length == 0) { // TODO: test this
|
||||
if (msgItem[currItem].length > 1) { // TODO: test this
|
||||
// PREV SUGG BUTTON ------------------------------------------------------------------------------------------------------------
|
||||
var prevSuggButton = CreateNodeWithText(prevSuggestionCell, "<", "button");
|
||||
prevSuggButton.style.margin = buttonMargin; // fancy margin
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue