-
Notifications
You must be signed in to change notification settings - Fork 172
Complete all tasks. #158
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Complete all tasks. #158
Changes from all commits
ae65411
7f32e51
3d4369b
63c8ee7
89c02b2
1cad8c1
f4536d9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,8 @@ | ||
| console.log('DOM'); | ||
| console.log('DOM'); | ||
|
|
||
| const elementList = document.querySelector('.comments__item.comments__item--newest'); | ||
|
|
||
| if(elementList !== null) { | ||
| const elementWithAttribute = elementList.querySelectorAll('[data-info]'); | ||
| console.log("Liczba pasujących elementów:", elementWithAttribute.length); | ||
| }; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,11 @@ | ||
| console.log('DOM'); | ||
| console.log('DOM'); | ||
|
|
||
| const linkList = document.querySelectorAll('[data-url]'); | ||
|
|
||
| if(linkList !== null) { | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. TUtaj to nie zadziała, |
||
| linkList.forEach(link => { | ||
| const url = link.getAttribute('data-url'); | ||
| link.href = url; | ||
| console.log("Gotowe url:", link.href); | ||
| }); | ||
| }; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,4 +11,21 @@ const buttonSettings = { | |
| color: '#444' | ||
| }, | ||
| text: 'Click me!', | ||
| } | ||
| } | ||
|
|
||
|
|
||
| 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); | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,59 @@ | ||
|
|
||
| console.log('DOM'); | ||
|
|
||
| // struktura do wykorzystania w pętli | ||
| const menuItems = [ | ||
| {text: 'start', url: '/'}, | ||
| {text: 'galeria', url: '/gallery'}, | ||
| {text: 'kontakt', url: '/contact'}, | ||
| ]; | ||
| ]; | ||
|
|
||
| /* | ||
| 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); | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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); | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍