From df731f9210266aedc5c61d86f72a92291947ee0e Mon Sep 17 00:00:00 2001 From: Artur Date: Thu, 2 Oct 2025 09:54:14 +0200 Subject: [PATCH 1/5] Task 01 completed --- 01/app.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/01/app.js b/01/app.js index 1c9992ed..448fdd14 100644 --- a/01/app.js +++ b/01/app.js @@ -1 +1,9 @@ -console.log('DOM'); \ No newline at end of file +console.log('DOM'); + +const commentsItem = document.querySelector( + '.comments__item.comments__item--newest' +); + +const dataInfo = commentsItem.querySelectorAll('[data-info]'); + +console.log(dataInfo.length); From bec02fce6bb5afe77018dede4b9e32d7dcc12017 Mon Sep 17 00:00:00 2001 From: Artur Date: Thu, 2 Oct 2025 10:00:37 +0200 Subject: [PATCH 2/5] Task 02 completed --- 02/app.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/02/app.js b/02/app.js index 1c9992ed..a1eab561 100644 --- a/02/app.js +++ b/02/app.js @@ -1 +1,8 @@ -console.log('DOM'); \ No newline at end of file +console.log('DOM'); + +const links = document.querySelectorAll('a[data-url]'); + +links.forEach((element) => { + const dataUrl = element.getAttribute('data-url'); + element.setAttribute('href', dataUrl); +}); From dcb6e50bb68b49efeaff9dd6ecc6b95d29a22f14 Mon Sep 17 00:00:00 2001 From: Artur Date: Thu, 2 Oct 2025 10:30:37 +0200 Subject: [PATCH 3/5] Task 03 completed --- 03/app.js | 38 +++++++++++++++++++++++++++----------- 1 file changed, 27 insertions(+), 11 deletions(-) diff --git a/03/app.js b/03/app.js index c299ca32..2011b0bb 100644 --- a/03/app.js +++ b/03/app.js @@ -1,14 +1,30 @@ 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 button = document.createElement('button'); +const buttonParent = document.querySelector('.parent-for-button'); + +for (const prop in buttonSettings.attr) { + button.setAttribute(prop, buttonSettings.attr[prop]); +} + +for (const prop in buttonSettings.css) { + console.log(buttonSettings.css[prop]); + button.style[prop] = buttonSettings.css[prop]; +} + +button.innerText = buttonSettings.text; + +buttonParent.appendChild(button); From 5aea45508e4c9ca547ea6d30891598d78aae65dd Mon Sep 17 00:00:00 2001 From: Artur Date: Thu, 2 Oct 2025 10:43:33 +0200 Subject: [PATCH 4/5] Task 04 completed --- 04/app.js | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/04/app.js b/04/app.js index e6411e4e..3fd62a27 100644 --- a/04/app.js +++ b/04/app.js @@ -2,7 +2,27 @@ 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 menu = document.createElement('ul'); + +//bez foreach +menu.innerHTML = ` +
  • start
  • +
  • galeria
  • +
  • kontakt
  • `; + +//z foreach +menuItems.forEach((el) => { + const li = document.createElement('li'); + const a = document.createElement('a'); + a.innerText = el.text; + a.setAttribute('href', el.url); + li.appendChild(a); + menu.appendChild(li); +}); + +document.querySelector('nav').appendChild(menu); From f53aa67d7ffa4289d3f90d91240f3f7affbc1f5d Mon Sep 17 00:00:00 2001 From: Artur Date: Thu, 2 Oct 2025 11:30:42 +0200 Subject: [PATCH 5/5] Task 05 completed --- 05/app.js | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/05/app.js b/05/app.js index 39abe5d5..695249f3 100644 --- a/05/app.js +++ b/05/app.js @@ -1,3 +1,33 @@ console.log('DOM'); const curr = document.querySelector('.js-curr'); + +// 1 +const btn = document.createElement('button'); +btn.innerText = 'Usuń z koszyka'; +curr.after(btn); + +// 2 +const siblings = curr.parentElement.children; +const siblingsArr = Array.from(siblings); + +siblingsArr.forEach((element) => { + element !== curr ? element.classList.add('siblings') : ''; +}); + +// 3 +const nextArticle = curr.parentElement.nextElementSibling.setAttribute( + 'title', + 'nextElementSibling' +); + +// 4 +const p = document.createElement('p'); +p.innerText = 'THIS IS A NEW PARAGRAPH'; +const lastArticle = curr.parentElement.parentElement.lastElementChild; +lastArticle.insertBefore(p, lastArticle.lastElementChild); + +// 5 +const section = curr.parentElement.parentElement; +const clone = curr.parentElement.nextElementSibling.cloneNode(true); +section.prepend(clone);