From 7913371dae471dc13715a6bd000d70268cd03684 Mon Sep 17 00:00:00 2001 From: altercode Date: Mon, 26 Aug 2024 10:44:03 +0200 Subject: [PATCH 1/5] =?UTF-8?q?Wykonanie=20zadania=201.=20Znalezienie=20el?= =?UTF-8?q?ementu=20kt=C3=B3ry=20ma=20dwie=20klasy=20oraz=20znalezienie=20?= =?UTF-8?q?w=20nim=20wszystkich=20element=C3=B3w,=20kt=C3=B3re=20maj=C4=85?= =?UTF-8?q?=20atrybut=20data-info.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 01/app.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/01/app.js b/01/app.js index 1c9992ed..a25d0a80 100644 --- a/01/app.js +++ b/01/app.js @@ -1 +1,4 @@ -console.log('DOM'); \ No newline at end of file +console.log('DOM'); + +const element = document.querySelector('.comments__item.comments__item--newest'); +console.log(element.querySelectorAll('[data-info]').length); \ No newline at end of file From 637f8b64fc96492a50afc9f53ab8943b4cb5961d Mon Sep 17 00:00:00 2001 From: altercode Date: Mon, 26 Aug 2024 10:49:34 +0200 Subject: [PATCH 2/5] Wykonanie zadania 2 --- 02/app.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/02/app.js b/02/app.js index 1c9992ed..67de25de 100644 --- a/02/app.js +++ b/02/app.js @@ -1 +1,6 @@ -console.log('DOM'); \ No newline at end of file +console.log('DOM'); + +const linkElements = document.querySelectorAll('[data-url]') +linkElements.forEach(el => { + el.setAttribute('href', el.getAttribute('data-url')); +}); \ No newline at end of file From 5fd0f3cedd5b4a98bf2215b5fc69697d353246b6 Mon Sep 17 00:00:00 2001 From: altercode Date: Mon, 26 Aug 2024 11:08:48 +0200 Subject: [PATCH 3/5] Wykonanie zadania 3. --- 03/app.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/03/app.js b/03/app.js index c299ca32..dc9dd3be 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 parentForButtonElement = document.querySelector('.parent-for-button') +const buttonElement = document.createElement('button', buttonSettings) + +for (attr in buttonSettings.attr) { + buttonElement.setAttribute(attr, buttonSettings.attr[attr]) +} +for (style in buttonSettings.css) { + buttonElement.style[style] = buttonSettings.css[style]; +} +buttonElement.textContent = buttonSettings.text + +parentForButtonElement.appendChild(buttonElement); \ No newline at end of file From 9d07a7a3e1b8f9e024f680e3c4a178fb19082561 Mon Sep 17 00:00:00 2001 From: altercode Date: Mon, 26 Aug 2024 11:31:20 +0200 Subject: [PATCH 4/5] Wykonanie zadania 4. --- .DS_Store | Bin 0 -> 6148 bytes 04/app.js | 46 ++++++++++++++++++++++++++++++++++++++++++---- 2 files changed, 42 insertions(+), 4 deletions(-) create mode 100644 .DS_Store diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..9c388d4d5e0d99e273756f69e65d5e11360dc8da GIT binary patch literal 6148 zcmeHKQA@)x5Kgw~I)=~(1$_(nI&j^b3ci#&|9};JP?;?qTCB}jJNqyOeb+zaAMy8i zm!#ly&m!&)lJ72emoy(VmoUb-H;Wv`Y{r-c4Uwa=LU4Gct7d``InEI#G6elSoFuXF z{dK@^udyz3!Xle|{r)WPc0YKn-q_e|T1~5M-T9BQ@be&_WnM77LF-b=B&_rxyo$%g z$lgAaX&%Jsc&ZZOXbd5@*Kr!j!jrQ!%2cke9ahU~jqJVod~kHq5xqfw(Ghc}=Nxy$ zN&j%MXjwb^2d5XKr{p=6ubNE`WGmS+Siu`8YBMkXG)-js0Cp8y#Sjt$!~iis46Ho^ zrZiaXwP%6|AO?tm?+oDiAfO?-21||V=ztEd&**O;qJWNX2}EJgHCSo{4+z((fI5|% zCkEH)FfL4-Yp~R)(-~JQ!#rl?>hZ$W>M$-;IODEH>WKkjV3~osHf^l`=kUv{eB>{u zkVOm-1OJQx-Wd8r4>o0L>yPbWtrgJjp`l=0i3$klOP2sJ@EqAyPVE<{L!4`{)QGd- SxJn14i-018I%41#82ALUI!EIG literal 0 HcmV?d00001 diff --git a/04/app.js b/04/app.js index e6411e4e..0fed2f54 100644 --- a/04/app.js +++ b/04/app.js @@ -2,7 +2,45 @@ 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 navElement = document.querySelector('nav'); +const ulElement = document.createElement('ul'); +const ulElement2 = document.createElement('ul'); + +const link1 = document.createElement('a'); +link1.setAttribute('href', '/') +link1.textContent = 'start'; + +const link2 = document.createElement('a'); +link2.setAttribute('href', '/gallery'); +link2.textContent = 'galeria'; + +const link3 = document.createElement('a'); +link3.setAttribute('href', '/contact'); +link3.textContent = 'kontakt'; + +const li1 = document.createElement('li'); +const li2 = document.createElement('li'); +const li3 = document.createElement('li'); + +li1.appendChild(link1) +li2.appendChild(link2) +li3.appendChild(link3) + +ulElement.appendChild(li1); +ulElement.appendChild(li2); +ulElement.appendChild(li3); + +navElement.appendChild(ulElement); +navElement.appendChild(ulElement2); + +menuItems.forEach(menuItem => { + const li = document.createElement('li') + li.innerHTML = '' + menuItem.text + '' + ulElement2.append(li); +}) + From 38ff133d5b684e40533b4e117969f6890a2f5a15 Mon Sep 17 00:00:00 2001 From: altercode Date: Mon, 26 Aug 2024 12:00:19 +0200 Subject: [PATCH 5/5] Wykonanie zadania 5. --- 05/app.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/05/app.js b/05/app.js index 39abe5d5..5e32656e 100644 --- a/05/app.js +++ b/05/app.js @@ -1,3 +1,24 @@ console.log('DOM'); const curr = document.querySelector('.js-curr'); + +const deleteButton = document.createElement('button') +deleteButton.textContent = 'usuń z koszyka' +curr.insertAdjacentElement('afterend', deleteButton) + +curr.parentNode.childNodes.forEach(element => { + element.classList && ![...element.classList].includes('js-curr') && element.classList.add("siblings"); +}); + +curr.parentElement.nextElementSibling.setAttribute('title', 'nextElementSibling'); + +const newPElement = document.createElement('p') +newPElement.textContent = 'To jest nowy paragraf.' + +curr.parentElement.parentElement.lastElementChild.querySelector('.article__btn').insertAdjacentElement('beforebegin', newPElement); + +const newArticleElement = curr.parentElement.nextElementSibling.cloneNode(true); +newArticleElement.querySelector('.article__title').textContent = 'To jest nowy artykuł!' +newArticleElement.querySelector('.article__description').textContent = 'To jest treść nowego artykułu!' + +curr.parentElement.parentElement.prepend(newArticleElement);