diff --git a/stable.user.js b/stable.user.js index dc09b10..948ca67 100755 --- a/stable.user.js +++ b/stable.user.js @@ -62,7 +62,7 @@ // forcing pages for testing. unless you test, do not set these to true! // only one of these should be true for testing - const forceTestPage = true + const forceTestPage = false const forceResultPage = false const forceDefaultPage = false const logElementGetting = false @@ -963,6 +963,7 @@ function ShowSaveQuizDialog (sendResult, sentData, newQuestions) { // FIXME: normal string building with localisation :/ var msg = '' + // TODO: '0 új kérdés' if (sendResult) { msg = 'Kérdések elküldve, katt az elküldött adatokért. ' + newQuestions + ' új kérdés' } else { @@ -1605,10 +1606,10 @@ } } - function SafeGetElementById (id, todo) { + function SafeGetElementById (id, next) { let element = document.getElementById(id) if (element) { - todo(element) + next(element) } else { Log(`Unable to safe get element by id: ${id}`) } @@ -1662,7 +1663,20 @@ url: url, onload: function (response) { try { - resolve(JSON.parse(response.responseText)) + let res = JSON.parse(response.responseText) + // FIXME: check if res is a valid answer array + // res.json({ + // result: r, + // success: true + // }) + // ERROR: + // res.json({ + // message: `Invalid question :(`, + // result: [], + // recievedData: JSON.stringify(req.query), + // success: false + // }) + resolve(res.result) } catch (e) { reject(new Error('json parse error')) }