Question getting mode switch, scrollable subject list

This commit is contained in:
YourFriendlyNeighborhoodDealer 2019-03-01 17:53:17 +01:00
parent 962274040c
commit 2c19d05489
2 changed files with 29 additions and 12 deletions

View file

@ -21,7 +21,7 @@
// ==UserScript==
// @name Moodle/Elearning/KMOOC test help
// @version 1.6.1.0
// @version 1.6.2.1
// @description Online Moodle/Elearning/KMOOC test help
// @author YourFriendlyNeighborhoodDealer
// @match https://elearning.uni-obuda.hu/main/*

31
main.js
View file

@ -26,7 +26,7 @@
var data; // all data, which is in the resource txt
var addEventListener; // add event listener function
const lastChangeLog =
'- Új domain név\n- Apró bugfixek';
'- Eredmények oldalon kérdésekre válasz szerzés mód váltás\n - Görgethető tárgyak, mert túl sok van már :p\nHa rosz választ szed ki a script pls küldj feedbacket! IRC is van.';
const serverAdress = "https://qmining.tk/";
// forcing pages for testing. unless you test, do not set these to true!
@ -1133,7 +1133,6 @@ function ShowSaveQuizDialog(addedQ, allQ, allOutput, output, sendSuccess, sentDa
else
msg += "Az új kérdések elküldve.";
}
msg += "Az új kérdések elküldve.";
} else // if there is 0 or less new question
{
msg = "A kérdőívben nincsen új kérdés. Ha mégis le akarod menteni klikk ide.";
@ -1255,9 +1254,9 @@ function GetQuiz() {
if (q != undefined)
question.q = SimplifyQuery(q);
// RIGHTANSWER ---------------------------------------------------------------------------------------------------------------------
var a = GetRightAnswerFromResultv2(i);
var a = GetRightAnswerFromResult(i);
if (a == undefined)
a = GetRightAnswerFromResult(i);
a = GetRightAnswerFromResultv2(i);
if (a != undefined)
question.a = SimplifyQuery(a);
// IMG ---------------------------------------------------------------------------------------------------------------------
@ -1743,7 +1742,12 @@ function ShowMenuList() {
tbl.style.width = "98%";
// adding headers ---------------------------------------------------------------------------------------------------------------
var tr = tbl.insertRow();
var subjTable = document.createElement('table');
subjTable.style.margin = fiveMargin;
subjTable.style.textAlign = "left";
subjTable.style.width = "98%";
var tr = subjTable.insertRow();
var header1 = tr.insertCell();
var headerSubjInfoParagraph = CreateNodeWithText(header1, "Tárgynév [darab kérdés]", "center");
@ -1754,8 +1758,9 @@ function ShowMenuList() {
headerSubjInfoParagraph.style.margin = fiveMargin; // fancy margin
if (data && data.length > 0) {
for (let i = 0; i < data.length; i++) {
var subjRow = tbl.insertRow();
var subjRow = subjTable.insertRow();
subjRow.style.border = "1px solid #131319";
var td = subjRow.insertCell();
@ -1785,6 +1790,18 @@ function ShowMenuList() {
data.ChangeActive(i, checked);
}); // adding click
}
var scrollDiv = document.createElement("div");
scrollDiv.style.width = window.innerWidth / 2 + 'px';
scrollDiv.style.height = window.innerHeight - (window.innerHeight * 0.4) + "px";
scrollDiv.style.overflow = "auto";
scrollDiv.appendChild(subjTable);
var subjtblrow = tbl.insertRow();
var subjtbltd = subjtblrow.insertCell();
subjtbltd.appendChild(scrollDiv);
} else // if no data
{
var noDataRow = tbl.insertRow();
@ -1932,7 +1949,7 @@ function ShowMenuList() {
menuDiv.style.left = window.innerWidth / 2 + 'px';
});
menuDiv.appendChild(tbl); // adding table box to main div
menuDiv.appendChild(tbl);
appedtTo.appendChild(menuDiv);
} catch (e) {
Exception(e, "script error at showing menu list:");