From 474e07f6c520eded7a564e4e2ef79b326263afd1 Mon Sep 17 00:00:00 2001 From: DcruBro Date: Tue, 21 Apr 2026 16:11:26 +0200 Subject: [PATCH] =?UTF-8?q?ve=C4=8D=20pagov,=20search,=20flashing=20fix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- TODO.txt | 1 - about.html | 1 + contact.html | 22 +++++++++++++++++ extras.html | 22 +++++++++++++++++ index.html | 10 ++++++-- scripts/index.js | 61 ++++++++++++++++++++++++++++++++++++++++++++++++ styles/main.css | 31 +++++++++++++++++++++++- 7 files changed, 144 insertions(+), 4 deletions(-) create mode 100644 contact.html create mode 100644 extras.html diff --git a/TODO.txt b/TODO.txt index 96bf7b1..e69de29 100644 --- a/TODO.txt +++ b/TODO.txt @@ -1 +0,0 @@ -Flashanje popravi za temo \ No newline at end of file diff --git a/about.html b/about.html index c556381..1d20106 100644 --- a/about.html +++ b/about.html @@ -19,6 +19,7 @@ Zato se je ustvaril SSNJ, Slovar Slovenskega Novega Jezika. To je prosti direktorij neologizmov in frazemov v moderni slovenščini, h kateremu lahko prispeva vsak. Lahko brskate po vnosih, dodajate nove vnose, ali pa ocenjujete obstoječe vnose, da pomagamo skupnosti razumeti, kateri vnosi so najbolj uporabni in relevantni.

+

Glavna stran

diff --git a/contact.html b/contact.html new file mode 100644 index 0000000..eb18e7c --- /dev/null +++ b/contact.html @@ -0,0 +1,22 @@ + + + + + + Kontakt + + + + + + +
+

Kontakt

+
+
+ + + + + + \ No newline at end of file diff --git a/extras.html b/extras.html new file mode 100644 index 0000000..31f1a28 --- /dev/null +++ b/extras.html @@ -0,0 +1,22 @@ + + + + + + Dodatki + + + + + + +
+

Dodatki

+
+
+ + + + + + \ No newline at end of file diff --git a/index.html b/index.html index 551c85d..5132eb3 100644 --- a/index.html +++ b/index.html @@ -11,8 +11,14 @@
-

Zadnji vnosi

- +
+

Zadnji vnosi

+
+ + +
+
+
diff --git a/scripts/index.js b/scripts/index.js index 1d7f156..238d492 100644 --- a/scripts/index.js +++ b/scripts/index.js @@ -35,4 +35,65 @@ function getLast() { }); } +function search() { + const field = document.getElementById("search-input"); + const val = field.value; + if (!val || val === "" || val === "*") { return; } + + const url = `http://localhost:3000/vnosi`; + fetch(url, { + method: 'POST', + headers: { + 'Content-Type': 'application/json' + }, + body: JSON.stringify({ + query: `*${val}*`, // Potencialno mora biti tukaj en "*" wildcard + limit: -1 + }) + }) + .then(response => response.json()) + .then(data => { + if (!data.success) { + console.error('API Error:', data.message); + return; + } + + console.log(data.data); + let len = data.data.length; + document.getElementById("page-title").innerText = `Rezultati iskanja (${len}):`; + document.getElementById("entry-container").innerHTML = ""; + + if (len <= 0) { + document.getElementById("entry-container").innerHTML = ` +

Ni bilo najednih zadetkov za poizvedbo "${val}".

+ `; + return; + } + + for (let entry of data.data) { + let build = ` +
+

${entry.kljuc}

+

${entry.tip}

+ ${entry.vsebina} +

${entry.primer}

+
+ `; + + document.getElementById("entry-container").innerHTML += build; + } + }) + .catch((error) => { + console.error('Error:', error); + }); +} + +document.getElementById("search-input").addEventListener("keydown", (event) => { + if (event.key === "Enter") { + event.preventDefault(); + search(); + } +}); + +// DELAJ DELAJ getLast(); \ No newline at end of file diff --git a/styles/main.css b/styles/main.css index e4eb7af..491a6cd 100644 --- a/styles/main.css +++ b/styles/main.css @@ -143,6 +143,34 @@ nav { transition: background-color 0.25s ease, color 0.25s ease; } +.page-title-container { + display: flex; + align-items: center; + justify-content: space-between; + gap: 16px; + width: 100%; +} + +.page-search-container { + display: flex; + align-items: center; + gap: 8px; + margin-right: 23px; +} + +.page-input { + padding: 8px 10px; + border: 1px solid var(--nav-btn-border); + border-radius: 4px; + background: var(--nav-btn-bg); + color: var(--text-color); + font-size: 0.92rem; + font-family: inherit; + + /* Smooth Theme Transition */ + transition: background-color 0.25s ease, border-color 0.25s ease, color 0.25s ease; +} + .nav-left, .nav-right { display: flex; @@ -169,7 +197,7 @@ nav { justify-content: flex-end; } -.nav-btn { +.nav-btn, .page-btn { display: inline-flex; align-items: center; justify-content: center; @@ -183,6 +211,7 @@ nav { font-size: 0.92rem; font-weight: 500; line-height: 1.1; + font-family: inherit; /* Smooth Theme Transition */ transition: background-color 0.25s ease, border-color 0.25s ease, color 0.25s ease;