From ae6541146e40fc6609d89f986c55ad083cff9659 Mon Sep 17 00:00:00 2001 From: Sandra Date: Thu, 21 Aug 2025 15:18:36 +0200 Subject: [PATCH 1/7] complete task 01 --- 01/app.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/01/app.js b/01/app.js index 1c9992ed..fdf72e63 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 elementList = document.querySelector('.comments__item.comments__item--newest'); + +const elementWithAttribute = elementList.querySelectorAll('[data-info]'); + +console.log("Liczba pasujących elementów:", elementWithAttribute.length); + From 7f32e51497e634b18589985e17fc179ba1968dbe Mon Sep 17 00:00:00 2001 From: Sandra Date: Thu, 21 Aug 2025 15:37:21 +0200 Subject: [PATCH 2/7] complete task 02 --- 02/app.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/02/app.js b/02/app.js index 1c9992ed..ca02c90b 100644 --- a/02/app.js +++ b/02/app.js @@ -1 +1,9 @@ -console.log('DOM'); \ No newline at end of file +console.log('DOM'); + +const linkList = document.querySelectorAll('[data-url]'); + +linkList.forEach(link => { + const url = link.getAttribute('data-url'); + link.href = url; + console.log("Gotowe url:", link.href); +}); \ No newline at end of file From 3d4369b2e8d85d7d5a914e40b2dbc964fe26923a Mon Sep 17 00:00:00 2001 From: Sandra Date: Thu, 21 Aug 2025 15:51:31 +0200 Subject: [PATCH 3/7] add check if there is an element in task 01 --- 01/app.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/01/app.js b/01/app.js index fdf72e63..b57d1f8f 100644 --- a/01/app.js +++ b/01/app.js @@ -2,7 +2,7 @@ console.log('DOM'); const elementList = document.querySelector('.comments__item.comments__item--newest'); -const elementWithAttribute = elementList.querySelectorAll('[data-info]'); - -console.log("Liczba pasujących elementów:", elementWithAttribute.length); - +if(elementList !== null) { + const elementWithAttribute = elementList.querySelectorAll('[data-info]'); + console.log("Liczba pasujących elementów:", elementWithAttribute.length); +}; From 63c8ee7519a5e6b7c67b054ac26f0a99f50b69fc Mon Sep 17 00:00:00 2001 From: Sandra Date: Thu, 21 Aug 2025 15:53:02 +0200 Subject: [PATCH 4/7] add check if there is an element in task 02 --- 02/app.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/02/app.js b/02/app.js index ca02c90b..cf1ab7db 100644 --- a/02/app.js +++ b/02/app.js @@ -2,8 +2,10 @@ console.log('DOM'); const linkList = document.querySelectorAll('[data-url]'); -linkList.forEach(link => { - const url = link.getAttribute('data-url'); - link.href = url; - console.log("Gotowe url:", link.href); -}); \ No newline at end of file +if(linkList !== null) { + linkList.forEach(link => { + const url = link.getAttribute('data-url'); + link.href = url; + console.log("Gotowe url:", link.href); + }); +}; \ No newline at end of file From 89c02b2f94f5386e043dc2d2d561293a1e7d651e Mon Sep 17 00:00:00 2001 From: Sandra Date: Thu, 21 Aug 2025 17:42:14 +0200 Subject: [PATCH 5/7] complete task 03 --- 03/app.js | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/03/app.js b/03/app.js index c299ca32..c08e5745 100644 --- a/03/app.js +++ b/03/app.js @@ -11,4 +11,21 @@ const buttonSettings = { color: '#444' }, text: 'Click me!', -} \ No newline at end of file +} + + +const btn = document.createElement('button'); +btn.innerText = buttonSettings.text; + +for(let key in buttonSettings.attr) { + btn[key] = buttonSettings.attr[key] +} + +for(let key in buttonSettings.css) { + btn.style[key] = buttonSettings.css[key]; +} + +console.log(btn); + +const buttonParent = document.querySelector('.parent-for-button'); +buttonParent.appendChild(btn); \ No newline at end of file From 1cad8c16d1190208aa9c3caa4839c14c9142faa0 Mon Sep 17 00:00:00 2001 From: Sandra Date: Thu, 21 Aug 2025 18:28:25 +0200 Subject: [PATCH 6/7] complete task 04 --- 04/app.js | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 52 insertions(+), 1 deletion(-) diff --git a/04/app.js b/04/app.js index e6411e4e..476df3a1 100644 --- a/04/app.js +++ b/04/app.js @@ -1,3 +1,4 @@ + console.log('DOM'); // struktura do wykorzystania w pętli @@ -5,4 +6,54 @@ const menuItems = [ {text: 'start', url: '/'}, {text: 'galeria', url: '/gallery'}, {text: 'kontakt', url: '/contact'}, -]; \ No newline at end of file +]; + +/* +const ul = document.createElement('ul'); + +const liStart = document.createElement('li'); +ul.appendChild(liStart); + +const startA = document.createElement('a'); +startA.innerText = "Start"; +startA.href = "/"; +liStart.appendChild(startA); + + +const liGallery = document.createElement('li'); +ul.appendChild(liGallery); + +const galleryA = document.createElement('a'); +galleryA.innerText = "Galeria"; +galleryA.href = "/gallery"; +liGallery.appendChild(galleryA); + + +const liContact = document.createElement('li'); +ul.appendChild(liContact); + +const contactA = document.createElement('a'); +contactA.innerText = "Kontakt"; +contactA.href = "/contact"; +liContact.appendChild(contactA); +console.log(ul); + +const nav = document.querySelector('nav'); +nav.appendChild(ul); +*/ + + +const ul = document.createElement('ul'); + +for(let menu of menuItems) { + const li = document.createElement('li'); + const a = document.createElement('a'); + a.innerText = menu.text; + a.href = menu.url; + li.appendChild(a); + ul.appendChild(li); +} + +const nav = document.querySelector('nav'); +nav.appendChild(ul); +console.log(ul); From f4536d9b2a6770d6dbf37c97546c902f4e19162c Mon Sep 17 00:00:00 2001 From: Sandra Date: Thu, 21 Aug 2025 19:09:21 +0200 Subject: [PATCH 7/7] complete task 05/ complete all tasks --- 05/app.js | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/05/app.js b/05/app.js index 39abe5d5..f09dc4f4 100644 --- a/05/app.js +++ b/05/app.js @@ -1,3 +1,30 @@ console.log('DOM'); const curr = document.querySelector('.js-curr'); + +const newBtn = document.createElement('button'); +newBtn.innerText = 'Usuń z koszyka'; +curr.after(newBtn); + +const parent = curr.parentElement; + +for(let child of parent.children) { + if( child !== curr) { + child.classList.add('siblings'); + } +} + +const nextArticle = parent.nextElementSibling; +nextArticle.setAttribute('title', 'nextElementSibling'); + +const lastArticle = nextArticle.nextElementSibling; +const nextP = document.createElement('p'); +lastArticle.insertBefore(nextP, lastArticle.lastElementChild); + + +const cloneArticle = parent.cloneNode(true); +const section = parent.parentElement; +section.insertBefore(cloneArticle, section.firstElementChild); + +console.log(section); +