From 0fde080ab8e760cd692d47ad6beb2a5ed7ae12f2 Mon Sep 17 00:00:00 2001 From: Andras Schmelczer Date: Sat, 6 Jun 2026 19:37:55 +0100 Subject: [PATCH] Format --- backend/public/index.html | 2 +- backend/server.test.js | 156 ++++++++++++++ frontend/css/button.css | 57 +++--- frontend/css/card.css | 78 +++---- frontend/css/fizika.css | 420 +++++++++++++++++++------------------- frontend/css/radio.css | 72 +++---- frontend/index.html | 14 +- frontend/js/fizika.js | 132 ++++++------ 8 files changed, 555 insertions(+), 376 deletions(-) create mode 100644 backend/server.test.js diff --git a/backend/public/index.html b/backend/public/index.html index 8dd795a..516206b 100644 --- a/backend/public/index.html +++ b/backend/public/index.html @@ -1,4 +1,4 @@ - + diff --git a/backend/server.test.js b/backend/server.test.js new file mode 100644 index 0000000..9e16e7f --- /dev/null +++ b/backend/server.test.js @@ -0,0 +1,156 @@ +const { test, before, after, beforeEach } = require("node:test"); +const assert = require("node:assert"); +const fs = require("node:fs"); +const os = require("node:os"); +const path = require("node:path"); + +// Point the server at a throwaway data dir before importing it, so tests never +// touch real question data. +const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), "fizika-test-")); +const dataPath = path.join(tmpDir, "fizika.json"); +const picsPath = path.join(tmpDir, "pics"); +fs.mkdirSync(picsPath, { recursive: true }); + +process.env.DATA_PATH = dataPath; +process.env.PICS_PATH = picsPath; + +const { app, isUnsafeFilename } = require("./server"); + +const seedQuestions = [ + { + id: 1, + source: "2016/m1/1", + description: "q1", + a: "a", + b: "b", + c: "c", + d: "d", + correct: 1, + type: "mk", + image: null, + }, + { + id: 2, + source: "2016/m1/2", + description: "q2", + a: "a", + b: "b", + c: "c", + d: "d", + correct: 2, + type: "md", + image: null, + }, +]; + +let server; +let baseUrl; + +const api = (route, options) => fetch(`${baseUrl}${route}`, options); +const sendJson = (route, method, body) => + api(route, { + method, + headers: { "content-type": "application/json" }, + body: JSON.stringify(body), + }); + +before(async () => { + server = app.listen(0); + await new Promise((resolve) => server.once("listening", resolve)); + baseUrl = `http://127.0.0.1:${server.address().port}`; +}); + +after(() => { + server.close(); + fs.rmSync(tmpDir, { recursive: true, force: true }); +}); + +beforeEach(() => { + fs.writeFileSync(dataPath, JSON.stringify(seedQuestions, null, 2)); +}); + +test("GET /api/fizika returns every question", async () => { + const res = await api("/api/fizika"); + assert.equal(res.status, 200); + const body = await res.json(); + assert.equal(body.length, 2); +}); + +test("POST creates a question with an incremented id", async () => { + const res = await sendJson("/api/admin/questions", "POST", { + source: "2020/1/1", + description: "new", + a: "a", + b: "b", + c: "c", + d: "d", + correct: 3, + type: "h", + image: null, + }); + assert.equal(res.status, 201); + const created = await res.json(); + assert.equal(created.id, 3); + + const all = await (await api("/api/fizika")).json(); + assert.equal(all.length, 3); +}); + +test("PUT updates an existing question", async () => { + const res = await sendJson("/api/admin/questions/1", "PUT", { + description: "updated", + }); + assert.equal(res.status, 200); + const updated = await res.json(); + assert.equal(updated.description, "updated"); + // unchanged fields are preserved + assert.equal(updated.source, "2016/m1/1"); +}); + +test("PUT returns 404 for a missing question", async () => { + const res = await sendJson("/api/admin/questions/999", "PUT", { a: "x" }); + assert.equal(res.status, 404); +}); + +test("DELETE removes a question", async () => { + const res = await api("/api/admin/questions/1", { method: "DELETE" }); + assert.equal(res.status, 200); + const all = await (await api("/api/fizika")).json(); + assert.equal(all.length, 1); + assert.equal(all[0].id, 2); +}); + +test("DELETE returns 404 for a missing question", async () => { + const res = await api("/api/admin/questions/999", { method: "DELETE" }); + assert.equal(res.status, 404); +}); + +test("DELETE image rejects an unsafe filename", async () => { + // Percent-encoded so the path survives client-side URL normalization and + // reaches the route with a separator the guard must reject. + const res = await api(`/api/admin/images/${encodeURIComponent("a\\b")}`, { + method: "DELETE", + }); + assert.equal(res.status, 400); +}); + +test("DELETE image returns 404 for a missing but valid filename", async () => { + const res = await api("/api/admin/images/nope.png", { method: "DELETE" }); + assert.equal(res.status, 404); +}); + +test("unknown routes return 404 JSON", async () => { + const res = await api("/api/does-not-exist"); + assert.equal(res.status, 404); + const body = await res.json(); + assert.equal(body.error, "Not found"); +}); + +test("isUnsafeFilename blocks traversal but allows plain names", () => { + for (const bad of ["../etc", "a/b", "a\\b", "..", ".", "/abs.png", ""]) { + assert.equal(isUnsafeFilename(bad), true, `${bad} should be unsafe`); + } + for (const ok of ["pic.png", "image_1.jpg", "2016-m1-1.png"]) { + assert.equal(isUnsafeFilename(ok), false, `${ok} should be safe`); + } +}); diff --git a/frontend/css/button.css b/frontend/css/button.css index 2d2ad8f..af3711a 100644 --- a/frontend/css/button.css +++ b/frontend/css/button.css @@ -1,31 +1,32 @@ -.button { - font-family: "Roboto", serif; - color: #003366; - font-weight: 400; - font-size: 1.5em; - padding: 0.75em; - margin: 1em; - width: auto; - cursor: pointer; - background-color: rgba(0,0,0,0); - display: inline-block; - border-style: solid; - border-width: 3px; - border-color: #003366; - box-shadow: 0 8px 16px 0 rgba(0,0,0,0.15), 0 6px 20px 0 rgba(0,0,0,0.15); - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; +.button { + font-family: "Roboto", serif; + color: #003366; + font-weight: 400; + font-size: 1.5em; + padding: 0.75em; + margin: 1em; + width: auto; + cursor: pointer; + background-color: rgba(0, 0, 0, 0); + display: inline-block; + border-style: solid; + border-width: 3px; + border-color: #003366; + box-shadow: + 0 8px 16px 0 rgba(0, 0, 0, 0.15), + 0 6px 20px 0 rgba(0, 0, 0, 0.15); + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; } -.button:hover { - box-shadow:none; +.button:hover { + box-shadow: none; } -@media only screen and (max-width: 1000px){ - .button { - font-size: 1.45em; - padding: 0.3em; - margin: 0.15em; - } +@media only screen and (max-width: 1000px) { + .button { + font-size: 1.45em; + padding: 0.3em; + margin: 0.15em; + } } - \ No newline at end of file diff --git a/frontend/css/card.css b/frontend/css/card.css index f37e524..1a5d483 100644 --- a/frontend/css/card.css +++ b/frontend/css/card.css @@ -1,45 +1,47 @@ -.card { - background-color: #fff; - padding: 2em; - text-align: left; - margin: 2em 0em 2em 0em; - box-shadow: 0 8px 16px 0 rgba(0,0,0,0.5), 0 6px 20px 0 rgba(0,0,0,0.09); - height: auto; - width: auto; - overflow: auto; +.card { + background-color: #fff; + padding: 2em; + text-align: left; + margin: 2em 0em 2em 0em; + box-shadow: + 0 8px 16px 0 rgba(0, 0, 0, 0.5), + 0 6px 20px 0 rgba(0, 0, 0, 0.09); + height: auto; + width: auto; + overflow: auto; } -h2 { - font-family: "Roboto", sans-serif; - font-weight: 300; - font-size: 2em; - margin: auto; - text-align: center; - color: #0A0F14; +h2 { + font-family: "Roboto", sans-serif; + font-weight: 300; + font-size: 2em; + margin: auto; + text-align: center; + color: #0a0f14; } -pre { - text-align: justify; - font-family: "Open sans", sans-serif; - font-weight: 300; - font-size: 1.5em; - white-space: normal; - width: 100%; +pre { + text-align: justify; + font-family: "Open sans", sans-serif; + font-weight: 300; + font-size: 1.5em; + white-space: normal; + width: 100%; } img { - display: block; - max-height: 100%; - float: right; - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; - margin: 1px; - max-width: 500px; + display: block; + max-height: 100%; + float: right; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + margin: 1px; + max-width: 500px; } -@media only screen and (max-width: 1000px){ - h2 { +@media only screen and (max-width: 1000px) { + h2 { font-size: 1.6em; - } - pre { + } + pre { font-size: 1em; - } -} \ No newline at end of file + } +} diff --git a/frontend/css/fizika.css b/frontend/css/fizika.css index f4dab20..b09a58b 100644 --- a/frontend/css/fizika.css +++ b/frontend/css/fizika.css @@ -1,268 +1,276 @@ - body { - font-size: 1em; - text-align: center; - color: #003366; - background-image: url("../auxIMG/bg.jpg"); - background-color: #fff; - background-repeat: repeat; - word-wrap: break-word; - margin-bottom: 1em; +body { + font-size: 1em; + text-align: center; + color: #003366; + background-image: url("../auxIMG/bg.jpg"); + background-color: #fff; + background-repeat: repeat; + word-wrap: break-word; + margin-bottom: 1em; } -::-moz-selection { - background: #003366; - color: #fff; - text-shadow: none; +::-moz-selection { + background: #003366; + color: #fff; + text-shadow: none; } ::selection { - background: #003366; - color: #fff; - text-shadow: none; + background: #003366; + color: #fff; + text-shadow: none; } h1:hover { - text-shadow: 0.3px 0.3px #002D5B, - 0.6px 0.6px #002851, - 1px 1px #002347, - 1.3px 1.3px #001E3D, - 1.6px 1.6px #001933, - 2px 2px #001326, - 2.3px 2.3px #000E1C, - 2.6px 2.6px #000A14, - 3px 3px #00070F, - 3.3px 3.3px #00050A, - 3.6px 3.6px #000205, - 4px 4px #000000; + text-shadow: + 0.3px 0.3px #002d5b, + 0.6px 0.6px #002851, + 1px 1px #002347, + 1.3px 1.3px #001e3d, + 1.6px 1.6px #001933, + 2px 2px #001326, + 2.3px 2.3px #000e1c, + 2.6px 2.6px #000a14, + 3px 3px #00070f, + 3.3px 3.3px #00050a, + 3.6px 3.6px #000205, + 4px 4px #000000; } -h1 { - font-family: "Poiret One", "Montserrat", serif; - font-size: 5em; - text-align: center; - margin: 0.2em 0 0.3em 0; - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; - display: inline; - transition: all 0.6s ease-out; +h1 { + font-family: "Poiret One", "Montserrat", serif; + font-size: 5em; + text-align: center; + margin: 0.2em 0 0.3em 0; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + display: inline; + transition: all 0.6s ease-out; } #titlebox { - padding-bottom: 0.5em; + padding-bottom: 0.5em; } -hr { - border-bottom: 2px solid #003366; - width: 35%; +hr { + border-bottom: 2px solid #003366; + width: 35%; } -.menu { - text-align: center; - width: 100%; - margin: auto; - font-weight: 400; - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; +.menu { + text-align: center; + width: 100%; + margin: auto; + font-weight: 400; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; } -ul { - list-style-type: none; - margin: 0; - padding: 0; +ul { + list-style-type: none; + margin: 0; + padding: 0; } li { - font-family: "Roboto", serif; - font-weight: 300; - display: inline-block; - padding: 0.5em 1em; - font-size: 1.5em; + font-family: "Roboto", serif; + font-weight: 300; + display: inline-block; + padding: 0.5em 1em; + font-size: 1.5em; } li:hover { - cursor: pointer; - text-shadow: 1px 1px 1px #0A0F14; + cursor: pointer; + text-shadow: 1px 1px 1px #0a0f14; } #wrapper { - width: 75%; - margin: auto; - padding-top: 0.5em; + width: 75%; + margin: auto; + padding-top: 0.5em; } -#bfooldal { - font-weight: 700; +#bfooldal { + font-weight: 700; } -.szoveg, #buttonwrapper { - width: 80%; - margin: auto; +.szoveg, +#buttonwrapper { + width: 80%; + margin: auto; } p:first-of-type { - padding-top: 2em; + padding-top: 2em; } -p { - font-family: "Open sans", sans-serif; - font-weight: 300; - font-size: 1.3em; - color: #0A0F14; - text-align: justify; - margin: auto; - padding: 0.5em 0; +p { + font-family: "Open sans", sans-serif; + font-weight: 300; + font-size: 1.3em; + color: #0a0f14; + text-align: justify; + margin: auto; + padding: 0.5em 0; } p:last-of-type { - padding-bottom: 2em; + padding-bottom: 2em; } -.buttonwrapper { - text-align: center; +.buttonwrapper { + text-align: center; } -#teszt, #eredmenyek, #kereses, #temakor { - display: none; +#teszt, +#eredmenyek, +#kereses, +#temakor { + display: none; } #temak { - width: 100%; - display: flex; - text-align: left; + width: 100%; + display: flex; + text-align: left; } .fele { - width: 40%; - display: block; + width: 40%; + display: block; } #bal { - float: left; - margin-left: 20%; + float: left; + margin-left: 20%; } #jobb { - float: right; + float: right; } .negyzet { - margin-left: 1.5em; - font-family: "Open sans", sans-serif; - font-weight: 400; + margin-left: 1.5em; + font-family: "Open sans", sans-serif; + font-weight: 400; } .main { - font-size: 1.5em; - margin-left: 0; - font-family: "Roboto", serif; + font-size: 1.5em; + margin-left: 0; + font-family: "Roboto", serif; } -#numberof { - box-sizing: border-box; - border: 2px solid #ccc; - border-radius: 4px; - font-size: 1.2em; - font-weight: 300; - background-color: white; - width: 63%; +#numberof { + box-sizing: border-box; + border: 2px solid #ccc; + border-radius: 4px; + font-size: 1.2em; + font-weight: 300; + background-color: white; + width: 63%; } -.f2006, .f2016 { - display: none; +.f2006, +.f2016 { + display: none; } -#load, #loadingGif { - display: none; +#load, +#loadingGif { + display: none; } #loading { - width: 100%; - text-align: center; - height: auto; + width: 100%; + text-align: center; + height: auto; } #loadingGif { - float: none; - margin: auto; - padding-bottom: 2em; + float: none; + margin: auto; + padding-bottom: 2em; } #megoldas { - display: none; + display: none; } -#percentage { - font-family: "Poiret One", "Montserrat", serif; - font-size: 3em; - text-align: center; +#percentage { + font-family: "Poiret One", "Montserrat", serif; + font-size: 3em; + text-align: center; } -#state, #state2 { - font-weight: 300; - font-size: 2em; - text-align: center; - padding: 0.6em; +#state, +#state2 { + font-weight: 300; + font-size: 2em; + text-align: center; + padding: 0.6em; } #content { - margin: auto; + margin: auto; } -select { - box-sizing: border-box; - border: 2px solid #ccc; - border-radius: 4px; - font-size: 1.25em; - color: #0A0F14; - width: 26%; - padding: 12px 20px 12px 40px; - background-color: #fff; +select { + box-sizing: border-box; + border: 2px solid #ccc; + border-radius: 4px; + font-size: 1.25em; + color: #0a0f14; + width: 26%; + padding: 12px 20px 12px 40px; + background-color: #fff; } table { - border-collapse: collapse; - margin : auto; - width: 100%; -} -th, td { - text-align: left; - padding: 0.5em; + border-collapse: collapse; + margin: auto; + width: 100%; } -tr:nth-child(even){ - background-color: #f2f2f2; +th, +td { + text-align: left; + padding: 0.5em; } -th { - background-color: #003366; - color: white; +tr:nth-child(even) { + background-color: #f2f2f2; +} +th { + background-color: #003366; + color: white; } -h4 { - margin: auto; +h4 { + margin: auto; + font-size: 0.75em; +} + +@media only screen and (max-width: 1000px) { + body { + font-size: 1.75em; + } + h1 { + font-size: 7em; + } + h1:hover { + text-shadow: none; + } + #wrapper { + width: 90%; + } + .szoveg { + width: 90%; + } + #numberof { + font-size: 0.6em; + } + img { + max-width: 400px; + } + select { + font-size: 0.8em; + width: 30%; + } + hr { + border-bottom-width: 4px; + width: 50%; + } + li { + font-size: 1.75em; + padding: 0.25em; + } + p { font-size: 0.75em; -} + } + p:first-of-type { + padding-top: 0.5em; + } + p:last-of-type { + padding-bottom: 0.5em; + } -@media only screen and (max-width: 1000px){ - body { - font-size: 1.75em; - } - h1 { - font-size: 7em; - } - h1:hover { - text-shadow: none; - } - #wrapper { - width: 90%; - } - .szoveg { - width: 90%; - } - #numberof { - font-size: 0.6em; - } - img { - max-width: 400px; - } - select { - font-size: 0.8em; - width: 30%; - } - hr { - border-bottom-width: 4px; - width: 50%; - } - li { - font-size: 1.75em; - padding: 0.25em; - } - p { - font-size: 0.75em; - } - p:first-of-type { - padding-top: 0.5em; - } - p:last-of-type { - padding-bottom: 0.5em; - } - - #tablazat { - font-size: 0.8em; - } - .mbcheck { - font-size: 0.75em; - } - #bal { - margin-left: 0; - } + #tablazat { + font-size: 0.8em; + } + .mbcheck { + font-size: 0.75em; + } + #bal { + margin-left: 0; + } } - \ No newline at end of file diff --git a/frontend/css/radio.css b/frontend/css/radio.css index ba3b62e..b5dd7c9 100644 --- a/frontend/css/radio.css +++ b/frontend/css/radio.css @@ -1,44 +1,44 @@ #preload { - display: none; + display: none; } -input[type=radio] { - cursor: pointer; +input[type="radio"] { + cursor: pointer; } -input[type=radio] { - width: 28px; - margin: 0; - padding: 0; - opacity: 0; +input[type="radio"] { + width: 28px; + margin: 0; + padding: 0; + opacity: 0; } -input[type=radio] + label { - display: inline; - font-family: "Open Sans", sans-serif; - font-weight: 300; - font-size: 1.3em; - margin-left: -28px; - padding-left: 28px; - background: url('../auxIMG/unchecked.svg') no-repeat 0 50%; - line-height: 35px; - background-size: 28px 28px; - margin-bottom: 6.25em; +input[type="radio"] + label { + display: inline; + font-family: "Open Sans", sans-serif; + font-weight: 300; + font-size: 1.3em; + margin-left: -28px; + padding-left: 28px; + background: url("../auxIMG/unchecked.svg") no-repeat 0 50%; + line-height: 35px; + background-size: 28px 28px; + margin-bottom: 6.25em; } -input[type=radio]:checked + label { - background: url('../auxIMG/checked.svg') no-repeat 0 50%; - background-size: 28px 28px; +input[type="radio"]:checked + label { + background: url("../auxIMG/checked.svg") no-repeat 0 50%; + background-size: 28px 28px; } -@media only screen and (max-width: 1000px){ - input[type=radio] { - width: 60px; - height: 60px; - } - input[type=radio] + label { - margin-left: -60px; - padding-left: 60px; - background-size: 60px 60px; - } - input[type=radio]:checked + label { - background-size: 60px 60px; - } -} \ No newline at end of file +@media only screen and (max-width: 1000px) { + input[type="radio"] { + width: 60px; + height: 60px; + } + input[type="radio"] + label { + margin-left: -60px; + padding-left: 60px; + background-size: 60px 60px; + } + input[type="radio"]:checked + label { + background-size: 60px 60px; + } +} diff --git a/frontend/index.html b/frontend/index.html index 31e0ee1..76356d1 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -1,4 +1,4 @@ - + @@ -92,10 +92,14 @@

A Tesztek fülre kattintva juthatsz el a gyakorló feladatlapokig, amiket a te beállításaid alapján állít össze az alkalmazás. Ezt - egy 659 kérdést tartalmazó adatbázisból viszi véghez, melyet az - előző több mint 10 év érettségijeinek feladatai alkotnak. Ebben - a menüpontban nem csak témakör, hanem év alapján is - rákereshetsz a feladatokra. + egy + 682 kérdést tartalmazó + adatbázisból + viszi véghez, melyet az előző több mint 10 év érettségijeinek + feladatai alkotnak. Ebben a menüpontban nem csak témakör, hanem év + alapján is rákereshetsz a feladatokra.

A teszteken elért pontjaidat, és azokkal kapcsolatos egyéb infókat, az diff --git a/frontend/js/fizika.js b/frontend/js/fizika.js index fc13a8c..b104137 100644 --- a/frontend/js/fizika.js +++ b/frontend/js/fizika.js @@ -29,10 +29,13 @@ async function ajaxLoad(type) { try { if (type == 1) { var source = - "^" + $("#evszam").val() + $("#honap").val() + $("#feladat").val() + "$"; + "^" + + $("#evszam").val() + + $("#honap").val() + + $("#feladat").val() + + "$"; for (var i = 0; i <= 3; i++) { source = source.replace("all", ".*"); - console.log(source); } result = await loadQuestions(true, undefined, source, 1000000); } else if (type == 2) { @@ -56,7 +59,7 @@ async function ajaxLoad(type) { "v", ], undefined, - 15 + 15, ); } else { var NOQ = $("#numberof").val() ? $("#numberof").val() : 15; @@ -109,7 +112,7 @@ async function ajaxLoad(type) { `); $("#state").html("Hiba a feladatok betöltésekor"); - console.error('Quiz loading error:', error); + console.error("Quiz loading error:", error); } } @@ -117,15 +120,15 @@ function showCorrect(id, correctAns) { teszt(id, correctAns); eval( "$('" + - "#label" + - id + - ".rad" + - correctAns + - "').css('background-color', '#C6FF8C');" + "#label" + + id + + ".rad" + + correctAns + + "').css('background-color', '#C6FF8C');", ); $("#state").html("Helyes válaszok bejelölve!"); $("#state2").html( - "(Ellenőrző mód, az itteni eredményeid nem kerülnek elmentésre, a módból való kilépéshez tölts be egy új tesztsort!)" + "(Ellenőrző mód, az itteni eredményeid nem kerülnek elmentésre, a módból való kilépéshez tölts be egy új tesztsort!)", ); } @@ -140,7 +143,6 @@ function teszt(id, correctAns) { } else { $(div).animate({ backgroundColor: "#FF808C" }, 1100); } - console.log(currentPoints, totalPoints, correctAnswersGiven); if (currentPoints >= totalPoints) { var percentage = (correctAnswersGiven / totalPoints) * 100; percentage = Math.round(percentage * 100) / 100; @@ -151,30 +153,34 @@ function teszt(id, correctAns) { var datum = new Date(); var ido = Math.round(timer / 60); eval( - "localStorage.teszt" + numberOfPreviousTests + " = '" + percentage + "'" + "localStorage.teszt" + + numberOfPreviousTests + + " = '" + + percentage + + "'", ); eval( "localStorage.teszt" + - numberOfPreviousTests + - "date = '" + - datum.toLocaleDateString() + - "'" + numberOfPreviousTests + + "date = '" + + datum.toLocaleDateString() + + "'", ); eval( - "localStorage.teszt" + numberOfPreviousTests + "time = '" + ido + "'" + "localStorage.teszt" + numberOfPreviousTests + "time = '" + ido + "'", ); eval( "localStorage.teszt" + - numberOfPreviousTests + - "total = '" + - totalPoints + - "'" + numberOfPreviousTests + + "total = '" + + totalPoints + + "'", ); startTimer = 0; timer = 0; $("#state2").show(); $("#state2").html( - "Eredményed mentésre került! Ellenőrző módba belépve az eredményeid nem kerülnek tárolásra. A módból való kilépéshez tölts be egy új tesztsort!" + "Eredményed mentésre került! Ellenőrző módba belépve az eredményeid nem kerülnek tárolásra. A módból való kilépéshez tölts be egy új tesztsort!", ); eredmeny(); reviewMode = 1; @@ -189,7 +195,7 @@ function scrollTo(where) { { scrollTop: $(where).offset().top - 100, }, - 1000 + 1000, ); } @@ -208,7 +214,7 @@ function eredmeny() { if (isLocal) { if (typeof localStorage.teszt1 !== "undefined") { $("#tablazat").html( - '
DátumIdőtartamEredményPontszám
' + '
DátumIdőtartamEredményPontszám
', ); for (var i = 1; i < numberOfPreviousTests; i++) { var localString = "localStorage.teszt" + i; @@ -218,21 +224,21 @@ function eredmeny() { var isGood = eval(localString); $("#ered tr:last").after( "" + - i + - "." + - eval(datumString) + - "" + - eval(timeString) + - " perc" + - " " + - eval(localString) + - "%" + - Math.round((eval(localString) * eval(totalString)) / 100) + - "/" + - eval(totalString) + - " pont" + i + + "." + + eval(datumString) + + "" + + eval(timeString) + + " perc" + + " " + + eval(localString) + + "%" + + Math.round((eval(localString) * eval(totalString)) / 100) + + "/" + + eval(totalString) + + " pont", ); } } else { @@ -240,7 +246,7 @@ function eredmeny() { } } else { $("#tablazat").html( - "

Sajnos a böngésződ nem támogatja ezt a funkciót, tölts le egy modernebbet vagy jelentkezz be!

" + "

Sajnos a böngésződ nem támogatja ezt a funkciót, tölts le egy modernebbet vagy jelentkezz be!

", ); } } @@ -259,17 +265,17 @@ setInterval(function () { $(document).ready(function () { eredmeny(); - + // Initialize year dropdown with dynamic years from question data - if (typeof initializeYearDropdown === 'function') { + if (typeof initializeYearDropdown === "function") { initializeYearDropdown().then(() => { // Initialize month dropdown for default "all" year selection - if (typeof initializeMonthDropdown === 'function') { - initializeMonthDropdown('all/'); + if (typeof initializeMonthDropdown === "function") { + initializeMonthDropdown("all/"); } }); } - + $(window).on("mousewheel", function () { $("body").stop(); }); @@ -328,9 +334,9 @@ $(document).ready(function () { }); $("#evszam").change(function () { const selectedYear = $("#evszam").val(); - + // Initialize month dropdown dynamically based on selected year - if (typeof initializeMonthDropdown === 'function') { + if (typeof initializeMonthDropdown === "function") { initializeMonthDropdown(selectedYear); } else { // Fallback to original logic if dynamic function not available @@ -356,7 +362,7 @@ $(document).ready(function () { $(".fnem17").show(); } } - + $("#honap").val("all"); }); @@ -390,7 +396,7 @@ $(document).ready(function () { { scrollTop: $("#teszt").offset().top, }, - 3000 + 3000, ); }); }); @@ -419,28 +425,28 @@ $(document).ready(function () { Math.max( Math.min( parseInt(g.pos * (g.end[0] - g.start[0]) + g.start[0]), - 255 + 255, ), - 0 + 0, ), Math.max( Math.min( parseInt(g.pos * (g.end[1] - g.start[1]) + g.start[1]), - 255 + 255, ), - 0 + 0, ), Math.max( Math.min( parseInt(g.pos * (g.end[2] - g.start[2]) + g.start[2]), - 255 + 255, ), - 0 + 0, ), ].join(",") + ")"; }; - } + }, ); function b(f) { var e; @@ -448,16 +454,18 @@ $(document).ready(function () { return f; } if ( - (e = /rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec( - f - )) + (e = + /rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec( + f, + )) ) { return [parseInt(e[1]), parseInt(e[2]), parseInt(e[3])]; } if ( - (e = /rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec( - f - )) + (e = + /rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec( + f, + )) ) { return [ parseFloat(e[1]) * 2.55,