Dropdown box question getting fix, small design changes

This commit is contained in:
YourFriendlyNeighborhoodDealer 2019-03-05 08:23:28 +01:00
parent b646640993
commit 69e32bd3bc

33
main.js
View file

@ -23,12 +23,12 @@
var data; // all data, which is in the resource txt
var addEventListener; // add event listener function
const lastChangeLog =
'- Passzív mód: ha bepipálod a menü gomb alatt, akkor nem tölti be minden alkalommal a kérdéseket.\n - Pár lényeges bugfix\n - Ha találkoztok bugokkal, akkor pls report! thanx';
'- Passzív mód: ha bepipálod a menü gomb alatt, akkor nem tölti be minden alkalommal a kérdéseket (csak csendben vár).\n - Pár lényeges bugfix\n - Ha találkoztok bugokkal, akkor pls report! thanx';
const serverAdress = "https://qmining.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;
@ -38,7 +38,7 @@ const motdShowCount = 3;
var motd = "";
var lastestVersion = "";
const minMatchAmmount = 60;
const minMatchAmmount = 55;
const lengthDiffMultiplier = 10;
//: Class descriptions {{{
@ -264,7 +264,14 @@ function Main() {
function GetAllQuestionsDropdown() {
if (logElementGetting)
Log("getting dropdown question");
return document.getElementById("responseform").getElementsByTagName("p")[0].innerText;
let items = document.getElementById("responseform").getElementsByTagName("p")[0].childNodes;
let r = "";
items.forEach((item) => {
if (item.tagName == undefined)
r += item.nodeValue;
});
return r;
}
function GetAllQuestionsQtext() {
@ -772,8 +779,13 @@ function ReadFile(cwith) {
var resource = "";
try {
resource = GM_getResourceText("data"); // getting data from txt
if (resource == null) {
return; // TODO show some msg what happened
if (resource == undefined) {
ShowMessage({
m: "Nem lehetett beolvasni a fájlt :c Ellenőrizd az elérési utat, vagy a fájl jogosultságokat",
isSimple: true
});
return;
}
if (EmptyOrWhiteSpace(resource)) {
throw {
@ -812,7 +824,6 @@ function ReadNetDB(cwith, useNetDB) {
/*
* Returns a question database from the given data.
* Parameter should be raw read file in string with "\n"-s
* TODO: ??? -s are not listed as errors, tho works correctly
* */
function ParseRawData(data) {
@ -1112,7 +1123,6 @@ function HandleQuiz() {
answers.push(r);
HighLightAnswer(result, j); // highlights the answer for the current result
}
console.log(GetAnswerOptions());
ShowAnswers(answers);
}
@ -1741,6 +1751,8 @@ function ShowMenu() {
menuButtonDiv.style.left = window.innerWidth - buttonWidth * 1.5 + 'px';
menuButtonDiv.style.zIndex = 999999; // TO THE MAX
menuButtonDiv.style.position = "fixed";
// menuButtonDiv.style.borderStyle = "solid";
// menuButtonDiv.style.borderWidth = "1px";
// design
menuButtonDiv.style.textAlign = "center";
@ -1751,8 +1763,9 @@ function ShowMenu() {
// menu text
// var menuTextBox = CreateNodeWithText(menuButtonDiv, "Kérdések\nMenü");
var menuButton = CreateNodeWithText(menuButtonDiv, "Helper Menu", "button");
var menuButton = CreateNodeWithText(menuButtonDiv, "Kérdések Menu", "button");
menuButton.style.width = buttonWidth + 'px';
menuButton.style.border = 'none';
menuButton.style.height = buttonHeight - 20 + 'px';
menuButton.style.background = "#222d32"; // background color
menuButton.style.color = "#ffffff"; // background color
@ -2007,7 +2020,6 @@ function ShowMenuList() {
var xButton = CreateNodeWithText(buttonCell, "Bezárás", "button");
xButton.style.position = "";
xButton.style.background = "white";
xButton.style.left = 10 + 'px';
xButton.style.margin = "5px 5px 5px 5px"; // fancy margin
xButton.style.top = menuDiv.offsetHeight + 'px';
@ -2019,7 +2031,6 @@ function ShowMenuList() {
var helpButton = CreateNodeWithText(buttonCell, "Help", "button");
helpButton.style.position = "";
helpButton.style.background = "white";
helpButton.style.left = 10 + 'px';
helpButton.style.margin = "5px 5px 5px 5px"; // fancy margin
helpButton.style.top = menuDiv.offsetHeight + 'px';