From c8de9bc7d633e937f249a0264bc4169a5633e8bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magdalena=20Ko=C5=82tuniak?= Date: Sat, 21 Feb 2026 16:37:39 +0100 Subject: [PATCH 1/6] add task 1 --- 01/app.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/01/app.js b/01/app.js index 1c9992ed..56928832 100644 --- a/01/app.js +++ b/01/app.js @@ -1 +1,11 @@ -console.log('DOM'); \ No newline at end of file +const el = document.querySelector('.comments__item.comments__item--newest'); + +if (el) { + const items = el.querySelectorAll('[data-info]'); + + console.log(`Liczba elementów z data-info: ${items.length}`); + + items.forEach(el => { + console.log(el.dataset.info); + }); +} From 5b7bbf28bdcf03ce2a7e3a3552abf6a3f41bb299 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magdalena=20Ko=C5=82tuniak?= Date: Sat, 21 Feb 2026 17:00:26 +0100 Subject: [PATCH 2/6] add task 2 --- 02/app.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/02/app.js b/02/app.js index 1c9992ed..e648b44c 100644 --- a/02/app.js +++ b/02/app.js @@ -1 +1,11 @@ -console.log('DOM'); \ No newline at end of file +console.log('DOM'); +const links = document.querySelectorAll('[data-url]'); +console.log(links); + +links.forEach(link => { + const url = link.dataset.url; + + if (url) { + link.href = url; + } +}); From 4b9396f079f6870442f5d5dc50c43799494b9bb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magdalena=20Ko=C5=82tuniak?= Date: Sun, 22 Feb 2026 18:18:12 +0100 Subject: [PATCH 3/6] add task 3 --- 03/app.js | 45 +++++++++++++++++++++++++++++++++------------ 1 file changed, 33 insertions(+), 12 deletions(-) diff --git a/03/app.js b/03/app.js index c299ca32..b6897d3a 100644 --- a/03/app.js +++ b/03/app.js @@ -1,14 +1,35 @@ -console.log('DOM'); +// console.log('DOM'); const buttonSettings = { - attr: { - className: 'btn', - title: 'super button' - }, - css: { - border: '1px solid #336699', - padding: '5px 20px', - color: '#444' - }, - text: 'Click me!', -} \ No newline at end of file + attr: { + className: 'btn', + title: 'super button', + }, + css: { + border: '1px solid #336699', + padding: '5px 20px', + color: '#444', + }, + text: 'Click me!', +}; + +const btnParent = document.querySelector('.parent-for-button'); +if (btnParent) { + const button = document.createElement('button'); + + for (const key in buttonSettings) { + if (key === 'attr') { + for (const attrName in buttonSettings.attr) { + button[attrName] = buttonSettings.attr[attrName]; + } + } else if (key === 'css') { + for (const styleName in buttonSettings.css) { + button.style[styleName] = buttonSettings.css[styleName]; + } + } else if (key === 'text') { + button.textContent = buttonSettings.text; + } + } + + btnParent.appendChild(button); +} From 6d8f2d3fc4e622b0e8b188430338c3ac4bbb5d92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magdalena=20Ko=C5=82tuniak?= Date: Sun, 22 Feb 2026 20:33:25 +0100 Subject: [PATCH 4/6] add task 4 --- 04/app.js | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 52 insertions(+), 5 deletions(-) diff --git a/04/app.js b/04/app.js index e6411e4e..04bc384c 100644 --- a/04/app.js +++ b/04/app.js @@ -1,8 +1,55 @@ -console.log('DOM'); +// 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'); + +if (nav) { + const menu = document.createElement('ul'); + + const li1 = document.createElement('li'); + const a1 = document.createElement('a'); + a1.href = '/'; + a1.textContent = 'start'; + li1.appendChild(a1); + + const li2 = document.createElement('li'); + const a2 = document.createElement('a'); + a2.href = '/gallery'; + a2.textContent = 'galeria'; + li2.appendChild(a2); + + const li3 = document.createElement('li'); + const a3 = document.createElement('a'); + a3.href = '/contact'; + a3.textContent = 'kontakt'; + li3.appendChild(a3); + + menu.appendChild(li1); + menu.appendChild(li2); + menu.appendChild(li3); + + nav.appendChild(menu); +} + +if (nav) { + const menu = document.createElement('ul'); + + menuItems.forEach(item => { + const li = document.createElement('li'); + const a = document.createElement('a'); + + a.textContent = item.text; + a.href = item.url; + + li.appendChild(a); + menu.appendChild(li); + }); + + nav.appendChild(menu); +} From 413d05f6281c0cf9b7a41947320cfadfae0f8776 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magdalena=20Ko=C5=82tuniak?= Date: Mon, 23 Feb 2026 15:52:05 +0100 Subject: [PATCH 5/6] add task 5 --- 05/app.js | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/05/app.js b/05/app.js index 39abe5d5..4d4f127d 100644 --- a/05/app.js +++ b/05/app.js @@ -1,3 +1,27 @@ -console.log('DOM'); +// console.log('DOM'); const curr = document.querySelector('.js-curr'); + +if (curr) { + const parent = curr.parentElement; + + const deleteBtn = document.createElement('button'); + deleteBtn.textContent = 'usuń z koszyka'; + parent.appendChild(deleteBtn); + + [...parent.children].forEach(el => { + if (el !== curr) el.classList.add('siblings'); + }); + + parent.nextElementSibling.setAttribute('title', 'nextElementSibling'); + + const lastArticle = parent.parentElement.lastElementChild; + const p = document.createElement('p'); + p.textContent = 'Dodatkowy paragraf'; + lastArticle.insertBefore(p, lastArticle.querySelector('button')); + + const newArticle = parent.cloneNode(true); + const newCurrBtn = newArticle.querySelector('.js-curr'); + if (newCurrBtn) newCurrBtn.classList.remove('js-curr'); + parent.parentElement.insertBefore(newArticle, parent); +} From 10c8aab639fc075877170cdadb6878b47874d1dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magdalena=20Ko=C5=82tuniak?= Date: Tue, 3 Mar 2026 09:33:45 +0100 Subject: [PATCH 6/6] refactor: delete outer loop --- 03/app.js | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/03/app.js b/03/app.js index b6897d3a..3c84aeaa 100644 --- a/03/app.js +++ b/03/app.js @@ -14,22 +14,19 @@ const buttonSettings = { }; const btnParent = document.querySelector('.parent-for-button'); + if (btnParent) { const button = document.createElement('button'); - - for (const key in buttonSettings) { - if (key === 'attr') { - for (const attrName in buttonSettings.attr) { - button[attrName] = buttonSettings.attr[attrName]; - } - } else if (key === 'css') { - for (const styleName in buttonSettings.css) { - button.style[styleName] = buttonSettings.css[styleName]; - } - } else if (key === 'text') { - button.textContent = buttonSettings.text; - } + + for (const key in buttonSettings.attr) { + button[key] = buttonSettings.attr[key]; } + for (const key in buttonSettings.css) { + button.style[key] = buttonSettings.css[key]; + } + + button.textContent = buttonSettings.text; + btnParent.appendChild(button); }