From 9ac42f40aadcac825edf6fc7206dd091cde82280 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82?= Date: Thu, 20 Feb 2025 00:04:14 +0100 Subject: [PATCH 1/5] task 01 finished --- .vscode/settings.json | 3 +++ 01/app.js | 9 ++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 00000000..f673a71b --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "liveServer.settings.port": 5502 +} \ No newline at end of file diff --git a/01/app.js b/01/app.js index 1c9992ed..7b310b02 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 commentsElements = document.querySelector('.comments__item.comments__item--newest'); +if(commentsElements) { + const dataInfoEl = commentsElements.querySelectorAll('[data-info]'); + console.log(dataInfoEl.length); +} + From fd1d7fc14c7b2079487907040af845c5b9456752 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82?= Date: Thu, 20 Feb 2025 00:21:31 +0100 Subject: [PATCH 2/5] task 02 finished --- 02/app.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/02/app.js b/02/app.js index 1c9992ed..440e9c1a 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 linksEl = document.querySelectorAll('a[data-url]'); +linksEl.forEach(function(link, index) { + const dataUrl = link.getAttribute('data-url'); + link.setAttribute('href', dataUrl) +}) \ No newline at end of file From b13ef45c293bfcc3b760c3d32878196989f8e4ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82?= Date: Thu, 20 Feb 2025 01:27:00 +0100 Subject: [PATCH 3/5] task 03 finished --- 03/app.js | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/03/app.js b/03/app.js index c299ca32..8e08eff9 100644 --- a/03/app.js +++ b/03/app.js @@ -11,4 +11,36 @@ const buttonSettings = { color: '#444' }, text: 'Click me!', -} \ No newline at end of file +} + + +const buttonSection = document.querySelector('.parent-for-button') + + +// if(buttonSection) { +// const button = document.createElement('button'); + +// button.classList.add(buttonSettings.attr.className); +// button.title = buttonSettings.attr.title; +// button.style.border = buttonSettings.css.border; +// button.style.padding = buttonSettings.css.padding; +// button.style.color = buttonSettings.css.color; +// button.textContent = buttonSettings.text; + +// buttonSection.appendChild(button) +// } + + +const button = document.createElement('button'); + +for(let key in buttonSettings.attr) { + button.setAttribute(key, buttonSettings.attr[key]) +} +for(let key in buttonSettings.css) { + button.setAttribute(key, buttonSettings.css[key]) +} + +button.textContent = buttonSettings.text; + +buttonSection.appendChild(button) + From fd7d012fa58b5f4b04cab79af3f998c1ff083982 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82?= Date: Thu, 20 Feb 2025 23:42:56 +0100 Subject: [PATCH 4/5] task 04 finished --- 04/app.js | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/04/app.js b/04/app.js index e6411e4e..610f48fc 100644 --- a/04/app.js +++ b/04/app.js @@ -5,4 +5,35 @@ const menuItems = [ {text: 'start', url: '/'}, {text: 'galeria', url: '/gallery'}, {text: 'kontakt', url: '/contact'}, -]; \ No newline at end of file +]; + + +const navElement = document.querySelector('nav'); +if(navElement) { + const ulElement = document.createElement('ul'); +if(ulElement) { + menuItems.forEach( function(item) { + const liElement = document.createElement('li') + const linkElement = document.createElement('a') + linkElement.setAttribute('href', item.url) + linkElement.innerText = item.text + liElement.appendChild(linkElement) + ulElement.appendChild(liElement) + + } ) + + + // for(let key in menuItems) { + // const liElement = document.createElement('li') + // const linkElement = document.createElement('a') + // linkElement.setAttribute('href', menuItems[key].url) + // linkElement.innerText = menuItems[key].text + // liElement.appendChild(linkElement) + // ulElement.appendChild(liElement) + + // } +} + + navElement.appendChild(ulElement) +} + From a98d4f36e1ba1cb2ee7de2b190a43b77bd07eb90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82?= Date: Fri, 21 Feb 2025 01:44:56 +0100 Subject: [PATCH 5/5] task 05 finished --- 05/app.js | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/05/app.js b/05/app.js index 39abe5d5..a36e7dd9 100644 --- a/05/app.js +++ b/05/app.js @@ -1,3 +1,36 @@ console.log('DOM'); const curr = document.querySelector('.js-curr'); +if(curr) { + const buttonsParent = curr.parentElement + const nextButton = document.createElement('button'); + + nextButton.innerText = 'UsuĊ„ z koszyka' + + buttonsParent.appendChild(nextButton); + + for(let i = 0; i < buttonsParent.children.length; i++) { + if(buttonsParent.children[i] !== curr) { + buttonsParent.children[i].classList.add('.siblings') + } + } + + buttonsParent.nextElementSibling.setAttribute('title', 'nextElementSibling') + + const buttonsParentParent = buttonsParent.parentElement + const lastArticle = buttonsParentParent.lastElementChild + const lastButton = lastArticle.querySelector('button') + const pEl = document.createElement('p') + + pEl.innerText = 'Paragraf przed buttonem' + lastArticle.insertBefore(pEl, lastButton) + + + const article = buttonsParentParent.querySelector('article') + const newArticle = article.cloneNode(true) + + buttonsParentParent.insertBefore(newArticle, buttonsParentParent.firstElementChild) + + + +}