diff --git a/assets/js/akordeon.js b/assets/js/akordeon.js index a007e5b..95f32c5 100644 --- a/assets/js/akordeon.js +++ b/assets/js/akordeon.js @@ -1,25 +1,29 @@ -document.addEventListener("DOMContentLoaded", () => { - const akordeony = document.getElementsByClassName("akordeon"); - for (const akordeon of akordeony) { - if (akordeon.children.length < 2) { - console.warn("Na stronie jest niepoprawnie skonfigurowany akordeon!") - continue; - } - const pierworodny = akordeon.children[0]; - const nowy = document.createElement("div") - nowy.className = "akordeon-header"; - - nowy.onclick = () => { - const otwarte = akordeon.classList.contains("open"); - akordeon.classList.remove(otwarte ? "open": "closed"); - akordeon.classList.add(otwarte ? "closed" : "open"); - for (const dziecko of akordeon.children) { - if (dziecko != nowy) { - dziecko.style.display = otwarte ? "" : "none"; - } - } - } - akordeon.replaceChild(nowy, pierworodny) - nowy.append(pierworodny) +class Akordeon extends HTMLElement { + constructor() { + super(); + this._internals = this.attachInternals(); } -}) \ No newline at end of file + + get collapsed() { + return this._internals.states.has("hidden"); + } + + set collapsed(flag) { + if (flag) { + // Existence of identifier corresponds to "true" + this._internals.states.add("hidden"); + } else { + // Absence of identifier corresponds to "false" + this._internals.states.delete("hidden"); + } + } + + connecterCallback() { + } + + attributeChangedCallback(atrybut, poprzednio, obecnie) { + + } +} + +customElements.define("akordeon", Akordeon); \ No newline at end of file diff --git a/assets/js/nawigacja.js b/assets/js/nawigacja.js new file mode 100644 index 0000000..46580d5 --- /dev/null +++ b/assets/js/nawigacja.js @@ -0,0 +1,64 @@ +const linki = [ + [ + { nazwa: "Strona główna", link: "/index.html" }, + { nazwa: "Moje hobby", link: "/hobby.html" }, + { nazwa: "Galeria", link: "/galeria.html" }, + { nazwa: "Kontakt", link: "https://nonamesoft.xyz/about" }, + ], + [ + { nazwa: "JS. Podstawowe Zad.", link: "/js-podstawy.html" }, + { nazwa: "JS. Warunkowe Zad.", link: "/js-warunkowe.html" }, + ] +]; + + +class Header extends HTMLElement { + constructor() { + super(); + } + + connectedCallback() { + this.innerHTML = ` +
+ +

MaszToZadanieDomowe.com

+ +
+ `; + } +}; +customElements.define("header-comp", Header); + +class Footer extends HTMLElement { + constructor() { + super(); + } + + connectedCallback() { + this.innerHTML = ` + + `; + } +}; +customElements.define("footer-comp", Footer); \ No newline at end of file diff --git a/index.html b/index.html index 28500ac..89804e2 100644 --- a/index.html +++ b/index.html @@ -6,20 +6,11 @@ MaszToZadanieDomowe.com - + + -
- -

MaszToZadanieDomowe.com

- -
+

Witam na mojej stronie


@@ -41,22 +32,6 @@ to będzie zdrowy pieesek
youpiter podsunął to
- + diff --git a/js-podstawy.html b/js-podstawy.html index 8b1a91a..e1cb304 100644 --- a/js-podstawy.html +++ b/js-podstawy.html @@ -12,16 +12,7 @@ -
- -

MaszToZadanieDomowe.com

- -
+

JavaScript Podstawowe Zadania


@@ -95,6 +86,9 @@
  • Akordeon

    + + +
    Tytuł akordeonu
    @@ -144,22 +138,6 @@
                     
  • - +