Move frontend

This commit is contained in:
Andras Schmelczer 2025-08-31 13:20:31 +01:00
parent 7d51206deb
commit 7ea082fecb
No known key found for this signature in database
GPG key ID: FC8F2C3D3D1A718C
37 changed files with 2993 additions and 3 deletions

BIN
frontend/auxIMG/bg.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

View file

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 96 96" style="enable-background:new 0 0 96 96;" xml:space="preserve">
<style type="text/css">
.st0{fill:#333333;}
</style>
<g id="XMLID_6_">
<path id="XMLID_11_" class="st0" d="M48,34c-7.7,0-14,6.3-14,14c0,7.7,6.3,14,14,14c7.7,0,14-6.3,14-14C62,40.3,55.7,34,48,34z
M48,20c-15.5,0-28,12.5-28,28s12.5,28,28,28s28-12.5,28-28S63.5,20,48,20z M48,70.4c-12.4,0-22.4-10-22.4-22.4s10-22.4,22.4-22.4
s22.4,10,22.4,22.4S60.4,70.4,48,70.4z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 725 B

BIN
frontend/auxIMG/load.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

View file

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 96 96" style="enable-background:new 0 0 96 96;" xml:space="preserve">
<style type="text/css">
.st0{fill:#333333;}
</style>
<g id="XMLID_5_">
<path id="XMLID_9_" class="st0" d="M48,20.5c-15.2,0-27.5,12.3-27.5,27.5S32.8,75.5,48,75.5S75.5,63.2,75.5,48S63.2,20.5,48,20.5z
M48,70c-12.2,0-22-9.8-22-22s9.8-22,22-22s22,9.8,22,22S60.2,70,48,70z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 632 B

31
frontend/css/button.css Normal file
View file

@ -0,0 +1,31 @@
.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;
}
@media only screen and (max-width: 1000px){
.button {
font-size: 1.45em;
padding: 0.3em;
margin: 0.15em;
}
}

44
frontend/css/card.css Normal file
View file

@ -0,0 +1,44 @@
.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;
}
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;
}
@media only screen and (max-width: 1000px){
h2 {
font-size: 1.6em;
}
pre {
font-size: 1em;
}
}

268
frontend/css/fizika.css Normal file
View file

@ -0,0 +1,268 @@
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;
}
::selection {
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;
}
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;
}
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;
}
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;
}
li:hover {
cursor: pointer;
text-shadow: 1px 1px 1px #0A0F14;
}
#wrapper {
width: 75%;
margin: auto;
padding-top: 0.5em;
}
#bfooldal {
font-weight: 700;
}
.szoveg, #buttonwrapper {
width: 80%;
margin: auto;
}
p:first-of-type {
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:last-of-type {
padding-bottom: 2em;
}
.buttonwrapper {
text-align: center;
}
#teszt, #eredmenyek, #kereses, #temakor {
display: none;
}
#temak {
width: 100%;
display: flex;
text-align: left;
}
.fele {
width: 40%;
display: block;
}
#bal {
float: left;
margin-left: 20%;
}
#jobb {
float: right;
}
.negyzet {
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;
}
#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;
}
#load, #loadingGif {
display: none;
}
#loading {
width: 100%;
text-align: center;
height: auto;
}
#loadingGif {
float: none;
margin: auto;
padding-bottom: 2em;
}
#megoldas {
display: none;
}
#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;
}
#content {
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;
}
table {
border-collapse: collapse;
margin : auto;
width: 100%;
}
th, td {
text-align: left;
padding: 0.5em;
}
tr:nth-child(even){
background-color: #f2f2f2;
}
th {
background-color: #003366;
color: white;
}
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: 500px;
}
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;
}
}

44
frontend/css/radio.css Normal file
View file

@ -0,0 +1,44 @@
#preload {
display: none;
}
input[type=radio] {
cursor: pointer;
}
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]: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;
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 997 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 361 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 590 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View file

@ -0,0 +1,19 @@
{
"name": "Fizika",
"icons": [
{
"src": "favicons/android-chrome-192x192.png",
"sizes": "192x192",
"type": "image/png"
},
{
"src": "favicons/android-chrome-384x384.png",
"sizes": "384x384",
"type": "image/png"
}
],
"theme_color": "#ffffff",
"background_color": "#ffffff",
"display": "standalone",
"orientation": "portrait"
}

7910
frontend/fizika.json Normal file

File diff suppressed because it is too large Load diff

344
frontend/index.html Normal file
View file

@ -0,0 +1,344 @@
<!DOCTYPE html>
<html lang="hu-HU">
<head>
<meta charset="UTF-8" />
<title>Fizika érettségire felkészítő alkalmazás - EMELT szint -</title>
<meta
name="description"
content="Itt mindent megtalálsz, ami az emelt szintű fizika írásbeli érettségi teszt részének gyakorlásához szükséges. Gyakorló alkalmazás, eredmények visszatekintése. Ha bármiben elakadtál, nyugodtan írhatsz, és megoldjuk a problémádat."
/>
<meta
name="keywords"
content="fizika, érettségi, emelt, alkalmazás, gyakorlás, schmelczer, andrás, babits, pte, gyakorló, 2017, 2016, teszt, egyedi, egyéni, eredmények, megoldások, letöltés, ingyenes, erettsegi, alkalmazas, gyakorlas, gyakorlo, elmult, elmúlt, évek, evek, új, uj, andras, ofi"
/>
<meta name="author" content="Schmelczer András" />
<meta name="revisit-after" content="7 days" />
<link rel="manifest" href="/manifest.json" />
<meta name="theme-color" content="#003366" />
<link
href="https://fonts.googleapis.com/css?family=Open+Sans:300,400|Roboto:300,400&amp;subset=latin-ext"
rel="stylesheet"
/>
<link
href="https://fonts.googleapis.com/css?family=Poiret+One&subset=latin-ext"
rel="stylesheet"
/>
<link
rel="apple-touch-icon"
sizes="180x180"
href="favicons/apple-touch-icon.png"
/>
<link
rel="icon"
type="image/png"
sizes="32x32"
href="favicons/favicon-32x32.png"
/>
<link
rel="icon"
type="image/png"
sizes="16x16"
href="favicons/favicon-16x16.png"
/>
<link rel="manifest" href="favicons/manifest.json" />
<link rel="shortcut icon" href="favicons/favicon.ico" />
<link rel="stylesheet" type="text/css" href="css/fizika.css" />
<link rel="stylesheet" type="text/css" href="css/radio.css" />
<link rel="stylesheet" type="text/css" href="css/button.css" />
<link rel="stylesheet" type="text/css" href="css/card.css" />
<script src="js/jquery.min.js"></script>
<script src="js/load.js"></script>
<script src="js/fizika.js"></script>
<script
defer
data-domain="fizika.schmelczer.dev"
data-api="https://stats.schmelczer.dev/status"
src="https://stats.schmelczer.dev/js/script.file-downloads.hash.outbound-links.js"
></script>
<script>
window.plausible =
window.plausible ||
function () {
(window.plausible.q = window.plausible.q || []).push(arguments);
};
</script>
</head>
<body onresize="aspect()">
<div id="titlebox">
<h1 id="cim">Fizika</h1>
</div>
<hr />
<div class="menu">
<ul>
<li id="bfooldal">Információk</li>
<li id="bteszt">Tesztek</li>
<li id="beredmenyek">Eredmények</li>
</ul>
</div>
<hr />
<div id="wrapper">
<div class="szoveg" id="fooldal">
<p>
Itt mindent megtalálsz, ami az <b>emelt szintű fizika</b> írásbeli
érettségi teszt részének gyakorlásához szükséges.
</p>
<p>
A Tesztek fülre kattintva juthatsz el a gyakorló feladatlapokig,
amiket <b>a te beállításaid alapján</b> állít össze az alkalmazás. Ezt
egy <b>659 kérdést tartalmazó adatbázisból</b> viszi véghez, melyet az
előző <b>több mint 10 év</b> érettségijeinek feladatai alkotnak. Ebben
a menüpontban nem csak témakör, hanem év alapján is
<b>rákereshetsz a feladatokra</b>.
</p>
<p>
A teszteken elért pontjaidat, és azokkal kapcsolatos egyéb infókat, az
Eredményekben találhatsz.
</p>
<p>
Ha hibát találtál, vagy javaslatod lenne az oldallal kapcsolatban,
<b>keress nyugodtan</b>
<a href="mailto:schmelczerandras@gmail.com">e-mail</a>.
</p>
<p style="margin-top: 0.5em"><i>Sikeres felkészülést!</i></p>
</div>
<div id="teszt">
<div class="szoveg">
<p>
Először válaszd ki, hogy <b>témakör</b> szerint szeretnél
feladatokat megoldani, vagy az <b>előző évek feladatsorai</b> közt
szeretnél keresni. Ezután értelemszerűen add meg a szükséges
paramétereket.
</p>
<p>
Az <b>érettségi</b> gombra kattintva véletlenszerűen választ az
előző évek feladatai közül a rendszer.
</p>
<p>
Az itt elért eredményeid az <b>eredmények</b> fül alatt lesznek
láthatóak.
</p>
</div>
<div class="buttonwrapper">
<button class="button" id="btemakor">Témakörök</button>
<button class="button" id="bkereses">Régi feladatsorok</button>
<button class="button" id="berettsegi">Érettségi</button>
</div>
<div id="temakor">
<div class="szoveg">
<p>
Egyszerre több témakört is kiválaszthatsz. A témakörök
csoportosítva vannak, a csoport nevét kiválasztva, a csoport
összes tagját kijelölöd.
</p>
</div>
<div id="temak">
<div class="fele" id="bal">
<div class="negyzet main">
<input type="checkbox" id="mec" />
<label class="mbcheck">Mechanika</label>
</div>
<br />
<div class="negyzet">
<input type="checkbox" id="mk" />
<label class="mbcheck">Kinematika</label>
</div>
<br />
<div class="negyzet">
<input type="checkbox" id="md" />
<label class="mbcheck">Dinamika</label>
</div>
<br />
<div class="negyzet">
<input type="checkbox" id="me" />
<label class="mbcheck">Munka és energia</label>
</div>
<br />
<div class="negyzet">
<input type="checkbox" id="mf" />
<label class="mbcheck">Folyadékok és gázok mechanikája</label>
</div>
<br />
<div class="negyzet">
<input type="checkbox" id="mr" />
<label class="mbcheck">Rezgések és hullámok</label>
</div>
<br />
<div class="negyzet main">
<input type="checkbox" id="h" />
<label class="mbcheck">Hőtan</label>
</div>
<br />
<div class="negyzet main">
<input type="checkbox" id="ele" />
<label class="mbcheck">Elektromosság</label>
</div>
<br />
<div class="negyzet">
<input type="checkbox" id="es" />
<label class="mbcheck">Elektrosztatika</label>
</div>
<br />
<div class="negyzet">
<input type="checkbox" id="ee" />
<label class="mbcheck">Egyenáram</label>
</div>
<br />
<div class="negyzet">
<input type="checkbox" id="ev" />
<label class="mbcheck">Váltakozó áram</label>
</div>
<br />
</div>
<div class="fele" id="jobb">
<div class="negyzet main">
<input type="checkbox" id="m" />
<label class="mbcheck">Mágnesesség</label>
</div>
<br />
<div class="negyzet main">
<input type="checkbox" id="o" />
<label class="mbcheck">Fénytan</label>
</div>
<br />
<div class="negyzet main">
<input type="checkbox" id="atm" />
<label class="mbcheck">Atomfizika</label>
</div>
<br />
<div class="negyzet">
<input type="checkbox" id="ah" />
<label class="mbcheck">Atomhéj</label>
</div>
<br />
<div class="negyzet">
<input type="checkbox" id="am" />
<label class="mbcheck">Atommag</label>
</div>
<br />
<div class="negyzet main">
<input type="checkbox" id="cs" />
<label class="mbcheck">Égi mechanika, csillagászat</label>
</div>
<br />
<div class="negyzet main">
<input type="checkbox" id="v" />
<label class="mbcheck">Vegyes</label>
</div>
<br />
<div class="negyzet">
<input
type="number"
id="numberof"
placeholder="Feladatok mennyisége: "
min="1"
max="435"
/>
</div>
</div>
</div>
</div>
<div id="kereses">
<div class="szoveg">
<p>
Válaszd ki, melyik feladatsort/feladatot szeretnéd betölteni. Ha
valamelyik opciót <b>összes</b> álláson hagyod, akkor
értelemszerűen úgy veszi a rendszer, mintha az adott listából az
összes elemet kiválasztottad volna. Egyes évekhez több, mint 2
féle feladatlap is tartozhat, ezeket az aktuális éveket
kiválasztva könnyű megtalálni.
</p>
</div>
<div class="buttonwrapper">
<select id="evszam">
<option value="all/">Összes év</option>
<option value="2024/">2024</option>
<option value="2023/">2023</option>
<option value="2022/">2022</option>
<option value="2021/">2021</option>
<option value="2020/">2020</option>
<option value="2019/">2019</option>
<option value="2018/">2018</option>
<option value="2017/">2017</option>
<option value="2016/">2016</option>
<option value="2015/">2015</option>
<option value="2014/">2014</option>
<option value="2013/">2013</option>
<option value="2012/">2012</option>
<option value="2011/">2011</option>
<option value="2010/">2010</option>
<option value="2009/">2009</option>
<option value="2008/">2008</option>
<option value="2007/">2007</option>
<option value="2006/">2006</option>
<option value="2005/">2005</option>
</select>
<select id="honap">
<option value="all">Összes feladatsora</option>
<option value="1" class="f">Május-Június</option>
<option value="2" class="f">Október-November</option>
<option value="1" class="f2006">Február-Március</option>
<option value="2" class="f2006">Május-Június</option>
<option value="3" class="f2006">Október-November</option>
<option value="m1" class="f2016">1. Mintafeladatsor</option>
<option value="m2" class="f2016">2. Mintafeladatsor</option>
<option value="m3" class="f2016">3. Mintafeladatsor</option>
</select>
<select id="feladat">
<option value="/all">Összes feladat</option>
<option value="/1">1. feladat</option>
<option value="/2">2. feladat</option>
<option value="/3">3. feladat</option>
<option value="/4">4. feladat</option>
<option value="/5">5. feladat</option>
<option value="/6">6. feladat</option>
<option value="/7">7. feladat</option>
<option value="/8">8. feladat</option>
<option value="/9">9. feladat</option>
<option value="/10">10. feladat</option>
<option value="/11">11. feladat</option>
<option value="/12">12. feladat</option>
<option value="/13">13. feladat</option>
<option value="/14">14. feladat</option>
<option value="/15">15. feladat</option>
</select>
</div>
</div>
<div class="buttonwrapper">
<button class="button" id="load">Keresés</button>
</div>
<div id="state"></div>
<div id="state2"></div>
<div id="loading">
<img id="loadingGif" src="auxIMG/load.gif" height="45" width="45" />
</div>
<div id="percentage"></div>
<div id="content"></div>
<div class="buttonwrapper" id="megoldas">
<button class="button scroll" id="ans">Kiértékelés</button>
<button class="button scroll" id="cAns">Helyes megoldások</button>
</div>
</div>
<div id="eredmenyek" class="szoveg">
<p>
Itt az eredményeidet tudod megnézni <b>visszamenőleg</b>. Ezek az
adatok az eszközödön kerülnek tárolásra, azokat kizárólag innen tudod
elérni. Az adataid biztonságban vannak, azokat az interneten keresztül
sehova se küldjük el.
</p>
<p id="info"></p>
<div id="tablazat"></div>
</div>
<div id="preload">
<img src="auxIMG/checked.svg" height="0" width="0" />
<img src="auxIMG/unchecked.svg" height="0" width="0" />
</div>
</div>
</body>
</html>

453
frontend/js/fizika.js Normal file
View file

@ -0,0 +1,453 @@
var isSearch = false;
var totalPoints = 0;
var currentPoints = 0;
var correctAnswersGiven = 0;
var timer = 0;
var startTimer = 0;
var reviewMode = 0;
function aspect() {
if ($(window).width() > $(window).height()) {
$("#cim").html("Fizika gyakorlás");
} else {
$("#cim").html("Fizika");
}
}
async function ajaxLoad(type) {
reviewMode = 0;
totalPoints = 0;
currentPoints = 0;
$("#state").html("");
$("#state2").html("");
$("#percentage").html("");
$("#megoldas").hide();
$("#loadingGif").show();
let result = "";
if (type == 1) {
var source =
"^" + $("#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) {
result = await loadQuestions(
false,
[
"mk",
"md",
"me",
"mf",
"mr",
"h",
"es",
"ee",
"ev",
"m",
"o",
"ah",
"am",
"cs",
"v",
],
undefined,
15
);
} else {
var NOQ = $("#numberof").val() ? $("#numberof").val() : 15;
categories = [
$("#mk").prop("checked") ? "mk" : "",
$("#md").prop("checked") ? "md" : "",
$("#me").prop("checked") ? "me" : "",
$("#mf").prop("checked") ? "mf" : "",
$("#mr").prop("checked") ? "mr" : "",
$("#h").prop("checked") ? "h" : "",
$("#es").prop("checked") ? "es" : "",
$("#ee").prop("checked") ? "ee" : "",
$("#ev").prop("checked") ? "ev" : "",
$("#m").prop("checked") ? "m" : "",
$("#o").prop("checked") ? "o" : "",
$("#ah").prop("checked") ? "ah" : "",
$("#am").prop("checked") ? "am" : "",
$("#cs").prop("checked") ? "cs" : "",
$("#v").prop("checked") ? "v" : "",
];
result = await loadQuestions(false, categories, undefined, NOQ);
}
$("#loadingGif").hide();
$("#content").html(result);
$("#state2").hide();
if (
result !=
'<div class="buttonwrapper"><b style="font-size: 2rem;">Nem található a keresésnek megfelelő feladat!</b></div>'
) {
$("#megoldas").show();
$("#state").html("Feladatok sikeresen letöltve!");
}
}
function showCorrect(id, correctAns) {
teszt(id, correctAns);
eval(
"$('" +
"#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!)"
);
}
function teszt(id, correctAns) {
var div = "#feladat" + id;
var correct = "#form" + id + " #rad" + correctAns;
var isCorrect = $(correct).is(":checked");
currentPoints++;
if (isCorrect) {
$(div).animate({ backgroundColor: "#C6FF8C" }, 1100);
correctAnswersGiven++;
} 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;
percentage = percentage.toFixed(2);
$("#percentage").html("Eredmény: " + percentage + "%");
$("#state").html("Válaszok leellenőrizve!");
if (isLocal && !reviewMode) {
var datum = new Date();
var ido = Math.round(timer / 60);
eval(
"localStorage.teszt" + numberOfPreviousTests + " = '" + percentage + "'"
);
eval(
"localStorage.teszt" +
numberOfPreviousTests +
"date = '" +
datum.toLocaleDateString() +
"'"
);
eval(
"localStorage.teszt" + numberOfPreviousTests + "time = '" + ido + "'"
);
eval(
"localStorage.teszt" +
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!"
);
eredmeny();
reviewMode = 1;
}
currentPoints = 0;
correctAnswersGiven = 0;
}
}
function scrollTo(where) {
$("html, body").animate(
{
scrollTop: $(where).offset().top - 100,
},
1000
);
}
function howMany() {
var localString = "localStorage.teszt";
numberOfPreviousTests = 1; //number of previous tests+1
localString += numberOfPreviousTests;
while (typeof eval(localString) !== "undefined") {
numberOfPreviousTests++;
localString = "localStorage.teszt" + numberOfPreviousTests;
}
}
function eredmeny() {
howMany();
if (isLocal) {
if (typeof localStorage.teszt1 !== "undefined") {
$("#tablazat").html(
'<table id="ered"><tr><th></th><th>Dátum</th><th>Időtartam</th><th>Eredmény</th><th>Pontszám</th></tr></table>'
);
for (var i = 1; i < numberOfPreviousTests; i++) {
var localString = "localStorage.teszt" + i;
var datumString = localString + "date";
var timeString = localString + "time";
var totalString = localString + "total";
var isGood = eval(localString);
$("#ered tr:last").after(
"<tr><td>" +
i +
".</td><td>" +
eval(datumString) +
"</td><td>" +
eval(timeString) +
" perc</td>" +
"<td style='color: hsl(" +
isGood +
",100%,50%);''> <b>" +
eval(localString) +
"%</b></td><td>" +
Math.round((eval(localString) * eval(totalString)) / 100) +
"/" +
eval(totalString) +
" pont</td></tr>"
);
}
} else {
$("#info").html("Még nincsenek elmentett eredményeid.");
}
} else {
$("#tablazat").html(
"<h2>Sajnos a böngésződ nem támogatja ezt a funkciót, tölts le egy modernebbet vagy jelentkezz be!</h2>"
);
}
}
//starting up
if (typeof Storage !== "undefined") {
var isLocal = 1;
howMany();
} else {
var isLocal = 0;
}
setInterval(function () {
if (startTimer) timer++;
}, 1000);
$(document).ready(function () {
eredmeny();
$(window).on("mousewheel", function () {
$("body").stop();
});
$(document).ajaxError(function (event, jqxhr, settings) {
if (!settings.secondExec) {
settings.secondExec = true;
setTimeout(function () {
$.ajax(settings);
}, 500);
}
});
aspect();
$("#bfooldal").click(function () {
$("#bfooldal").css("font-weight", "700");
$("#bteszt").css("font-weight", "400");
$("#beredmenyek").css("font-weight", "400");
$("#eredmenyek").hide();
$("#teszt").hide();
$("#fooldal").show();
});
$("#bteszt").click(function () {
$("#bfooldal").css("font-weight", "400");
$("#bteszt").css("font-weight", "700");
$("#beredmenyek").css("font-weight", "400");
$("#eredmenyek").hide();
$("#teszt").show();
$("#fooldal").hide();
});
$("#beredmenyek").click(function () {
//eredmeny();
$("#bfooldal").css("font-weight", "400");
$("#bteszt").css("font-weight", "400");
$("#beredmenyek").css("font-weight", "700");
$("#eredmenyek").show();
$("#teszt").hide();
$("#fooldal").hide();
});
$("#bkereses").click(function () {
$("#kereses").show();
$("#temakor").hide();
$("#load").show();
isSearch = true;
});
$("#btemakor").click(function () {
$("#kereses").hide();
$("#temakor").show();
$("#load").show();
isSearch = false;
});
$("#berettsegi").click(function () {
$("#kereses").hide();
$("#temakor").hide();
$("#load").hide();
isSearch = false;
});
$("#evszam").change(function () {
if ($("#evszam").val() == "2006/") {
$(".f2006").show();
$(".f2016").hide();
$(".f").hide();
$(".fnem17").hide();
} else if ($("#evszam").val() == "2016/") {
$(".f2006").hide();
$(".f2016").show();
$(".f").show();
$(".fnem17").show();
} else if ($("#evszam").val() == "2017/") {
$(".f2006").hide();
$(".f2016").hide();
$(".f").show();
$(".fnem17").hide();
} else {
$(".f2006").hide();
$(".f2016").hide();
$(".f").show();
$(".fnem17").show();
}
$("#honap").val("all");
});
$("#mec").change(function () {
var isChecked = this.checked;
$("#mk").prop("checked", isChecked);
$("#md").prop("checked", isChecked);
$("#me").prop("checked", isChecked);
$("#mf").prop("checked", isChecked);
$("#mr").prop("checked", isChecked);
});
$("#ele").change(function () {
var isChecked = this.checked;
$("#es").prop("checked", isChecked);
$("#ee").prop("checked", isChecked);
$("#ev").prop("checked", isChecked);
});
$("#atm").change(function () {
var isChecked = this.checked;
$("#ah").prop("checked", isChecked);
$("#am").prop("checked", isChecked);
});
$("#berettsegi").click(function (event) {
ajaxLoad(2);
});
$("#load").click(function (event) {
ajaxLoad(isSearch ? 1 : 3);
});
$(".scroll").click(function () {
$("body").animate(
{
scrollTop: $("#teszt").offset().top,
},
3000
);
});
});
(function (d) {
d.each(
[
"backgroundColor",
"borderBottomColor",
"borderLeftColor",
"borderRightColor",
"borderTopColor",
"color",
"outlineColor",
],
function (f, e) {
d.fx.step[e] = function (g) {
if (!g.colorInit) {
g.start = c(g.elem, e);
g.end = b(g.end);
g.colorInit = true;
}
g.elem.style[e] =
"rgb(" +
[
Math.max(
Math.min(
parseInt(g.pos * (g.end[0] - g.start[0]) + g.start[0]),
255
),
0
),
Math.max(
Math.min(
parseInt(g.pos * (g.end[1] - g.start[1]) + g.start[1]),
255
),
0
),
Math.max(
Math.min(
parseInt(g.pos * (g.end[2] - g.start[2]) + g.start[2]),
255
),
0
),
].join(",") +
")";
};
}
);
function b(f) {
var e;
if (f && f.constructor == Array && f.length == 3) {
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
))
) {
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
))
) {
return [
parseFloat(e[1]) * 2.55,
parseFloat(e[2]) * 2.55,
parseFloat(e[3]) * 2.55,
];
}
if ((e = /#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(f))) {
return [parseInt(e[1], 16), parseInt(e[2], 16), parseInt(e[3], 16)];
}
if ((e = /#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(f))) {
return [
parseInt(e[1] + e[1], 16),
parseInt(e[2] + e[2], 16),
parseInt(e[3] + e[3], 16),
];
}
if ((e = /rgba\(0, 0, 0, 0\)/.exec(f))) {
return a.transparent;
}
return a[d.trim(f).toLowerCase()];
}
function c(g, e) {
var f;
do {
f = d.css(g, e);
if ((f != "" && f != "transparent") || d.nodeName(g, "body")) {
break;
}
e = "backgroundColor";
} while ((g = g.parentNode));
return b(f);
}
var a = {};
})(jQuery);

5
frontend/js/jquery.min.js vendored Normal file

File diff suppressed because one or more lines are too long

95
frontend/js/load.js Normal file
View file

@ -0,0 +1,95 @@
let questions = null;
const API_BASE = window.location.hostname === 'localhost' ? 'http://localhost:3001' : 'https://your-backend-domain.com';
const loadQuestions = async (
isSearch,
categories,
sourceScheme,
questionCount
) => {
if (questions === null) {
try {
questions = await (await fetch(`${API_BASE}/api/fizika`)).json();
} catch (error) {
console.error('Failed to load questions from API, falling back to local file:', error);
questions = await (await fetch("fizika.json")).json();
}
}
let currentQuestions = questions.slice();
if (isSearch) {
currentQuestions = currentQuestions.filter((q) =>
q.source.match(sourceScheme)
);
} else {
shuffleArray(currentQuestions);
currentQuestions = currentQuestions.filter((q) =>
categories.includes(q.type)
);
}
resultHtml = "";
currentQuestions = currentQuestions.slice(0, questionCount);
currentQuestions.forEach(
({ id, source, description, a, b, c, d, correct, image }, i) => {
resultHtml += `
<div class="feladat card" id="feladat${id}">
<h2 style="float: left;">${i + 1}.</h2><h2>${source}</h2>
<pre>${description}</pre>
${image ? `<img src="${API_BASE}/api/pics/${image}"><br>` : ""}
<form id="form${id}"">
<input type="radio" id="rad1" name="group">
<label id="label${id}" class="rad1">${a}</label>
<br>
<input type="radio" id="rad2" name="group">
<label id="label${id}" class="rad2">${b}</label>
<br>
<input type="radio" id="rad3" name="group">
<label id="label${id}" class="rad3">${c}</label>
<br>
${
d
? `
<input type="radio" id="rad4" name="group">
<label id="label${id}" class="rad4">${d}</label>
<br>`
: ""
}
</form>
<script type="text/javascript">
$(document).ready(function(){
totalPoints++;
$("#ans").click(function(event){
event.preventDefault();
teszt(${id}, ${correct});
});
$("#cAns").click(function(event){
event.preventDefault();
showCorrect(${id}, ${correct});
});
});
</script>
</div>
`;
}
);
resultHtml +=
currentQuestions.length === 0
? '<div class="buttonwrapper"><b style="font-size: 2rem;">Nem található a keresésnek megfelelő feladat!</b></div>'
: `<script type="text/javascript">
startTimer = 1;
timer = 0;
</script>`;
return resultHtml;
};
function shuffleArray(array) {
for (let i = array.length - 1; i > 0; i--) {
const j = Math.floor(Math.random() * (i + 1));
[array[i], array[j]] = [array[j], array[i]];
}
}