From ae0b2d6a006b15479c77620d36647f3d147315e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Wodniczak?= Date: Mon, 23 Sep 2024 18:25:51 +0200 Subject: [PATCH 1/6] added solution to 1 task --- 01/app.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/01/app.js b/01/app.js index 1c9992ed..e27f60d4 100644 --- a/01/app.js +++ b/01/app.js @@ -1 +1,8 @@ -console.log('DOM'); \ No newline at end of file +console.log('DOM'); +const commentsItem = document.querySelector(".comments__item"); +const newWest = document.querySelector(".comments__item--newest"); + +if (commentsItem && newWest) { + const dataInfo = document.querySelectorAll("[data-info]") + console.log(`Znaleziono ${dataInfo.length}`) +}; From fdb44ce1aff2b8bf0a19add0abf0cc0a3b9e00f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Wodniczak?= Date: Mon, 23 Sep 2024 18:33:35 +0200 Subject: [PATCH 2/6] added solution to 2 task --- 02/app.js | 8 +++++++- 02/index.html | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/02/app.js b/02/app.js index 1c9992ed..42351838 100644 --- a/02/app.js +++ b/02/app.js @@ -1 +1,7 @@ -console.log('DOM'); \ No newline at end of file +console.log('DOM'); + +const links = document.querySelectorAll("[data-url]"); +links.forEach(link => { + const url = link.getAttribute("data-url"); + link.href = url; +}); \ No newline at end of file diff --git a/02/index.html b/02/index.html index 89a53f6d..a397da7c 100644 --- a/02/index.html +++ b/02/index.html @@ -11,7 +11,7 @@

Moje ulubione strony:

From 43426aaed36a6616a38b9f12f03381182c2ef6e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Wodniczak?= Date: Mon, 23 Sep 2024 18:42:07 +0200 Subject: [PATCH 3/6] added Solution to 3 task --- 03/app.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/03/app.js b/03/app.js index c299ca32..de81dcac 100644 --- a/03/app.js +++ b/03/app.js @@ -11,4 +11,17 @@ const buttonSettings = { color: '#444' }, text: 'Click me!', -} \ No newline at end of file +}; + +const button = document.createElement("button"); +for (const key in buttonSettings) { + button.setAttribute(key, buttonSettings.attr[key]); +}; + +for (const style in buttonSettings.css) { + button.style[style] = buttonSettings[style]; +}; + +button.textContent = buttonSettings.text; +const parentElement = document.querySelector(".parent-for-button"); +parentElement.appendChild(button); \ No newline at end of file From a68e2809017045cc9faa92c6312b75e2cc77b0ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Wodniczak?= Date: Tue, 24 Sep 2024 16:31:57 +0200 Subject: [PATCH 4/6] added solution to 4 task --- 04/app.js | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 50 insertions(+), 4 deletions(-) diff --git a/04/app.js b/04/app.js index e6411e4e..3353f610 100644 --- a/04/app.js +++ b/04/app.js @@ -2,7 +2,53 @@ console.log('DOM'); // struktura do wykorzystania w pętli const menuItems = [ - {text: 'start', url: '/'}, - {text: 'galeria', url: '/gallery'}, - {text: 'kontakt', url: '/contact'}, -]; \ No newline at end of file + { text: 'start', url: '/' }, + { text: 'galeria', url: '/gallery' }, + { text: 'kontakt', url: '/contact' }, +]; + +const nav = document.querySelector("nav"); +const ul = document.querySelector("ul"); + +nav.innerHTML = ` + +` +menuItems.forEach(link => { + const ul = document.querySelector("ul"); + const li = document.createElement("li"); + const a = document.createElement("a"); + a.href = link.url; + a.textContent = link.text; + li.appendChild(a); + ul.appendChild(li); +}); + +nav.appendChild(ul); + +// Utwórz poniższą strukturę menu za pomocą JS: + +// ``` +// +// ``` + +// Całość wstaw do elementu `