-
Notifications
You must be signed in to change notification settings - Fork 7
Hadidreem17 w1 browsers #31
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: main
Are you sure you want to change the base?
Changes from all commits
e4adf09
48281ca
05ef4e8
2c49c2f
345cd8e
535e66e
b47bfe5
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 |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| ## Test Summary | ||
|
|
||
| **Mentors**: For more information on how to review homework assignments, please refer to the [Review Guide](https://github.com/HackYourFuture/mentors/blob/main/assignment-support/review-guide.md). | ||
|
|
||
| ### 2-Browsers - Week1 | ||
|
|
||
| | Exercise | Passed | Failed | ESLint | | ||
| |--------------|--------|--------|--------| | ||
| | ex1-bookList | 6 | - | ✓ | |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,37 @@ | ||
| /* Write your style here */ | ||
| body { | ||
| font-family: Arial, sans-serif; | ||
| background-color: #f4f4f4; | ||
| margin: 0; | ||
| padding: 20px; | ||
| } | ||
| h1 { | ||
| text-align: center; | ||
| color: #333; | ||
| } | ||
| ul { | ||
| list-style-type: none; | ||
| padding: 0; | ||
| display : grid ; | ||
| grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); | ||
| gap : 16px; | ||
|
|
||
| } | ||
| li { | ||
| background: #fff; | ||
| margin: 10px 0; | ||
| padding: 15px; | ||
| border-radius: 5px; | ||
| box-shadow: 0 2px 4px rgba(0,0,0,0.1); | ||
| } | ||
| img { | ||
| width: 100% ; | ||
| height: auto ; | ||
| border -radius: 5px ; | ||
| display : block ; | ||
|
|
||
| } | ||
| p { | ||
| margin: 0; | ||
| padding: 0; | ||
| } | ||
|
Comment on lines
+2
to
+37
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 |
|---|---|---|
|
|
@@ -8,4 +8,16 @@ Full description at: https://github.com/HackYourFuture/Assignments/tree/main/2-B | |
| 3. Look in the css file! | ||
| ------------------------------------------------------------------------------*/ | ||
|
|
||
| // TODO add your JavaScript code here. | ||
| function aboutMe() { | ||
| const nickname = document.querySelector ('#nickname'); | ||
| nickname.textContent = 'Rim'; | ||
| const favFood = document.querySelector ('#fav-food'); | ||
| favFood.textContent = 'Sushi'; | ||
| const hometown = document.querySelector ('#hometown'); | ||
| hometown.textContent = 'Tokyo'; | ||
| const listItems = document.querySelectorAll ('li'); | ||
| listItems.forEach(item => { | ||
| item.classList.add('list-item'); | ||
| }); | ||
| } | ||
| aboutMe(); | ||
|
Comment on lines
+11
to
+23
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. Great! |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,11 @@ | ||
| /* 3. Add a css rule for .list-item to make the color red. */ | ||
|
|
||
| body { | ||
|
|
||
| font-family: Arial, sans-serif; | ||
| margin: auto; | ||
| padding: 20px; | ||
| } | ||
|
|
||
| .list-item { | ||
| color: red ; | ||
| } | ||
|
Comment on lines
+1
to
+11
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 |
|---|---|---|
|
|
@@ -7,7 +7,10 @@ Full description at: https://github.com/HackYourFuture/Assignments/tree/main/2-B | |
| HackYourFuture logo instead. | ||
| ------------------------------------------------------------------------------*/ | ||
| function hijackGoogleLogo() { | ||
| // TODO your code goes in here | ||
| const logo = document.querySelector('img[alt="Google"]') ; | ||
| logo.src = 'https://www.hackyourfuture.be/static/logo.png'; | ||
| logo.srcset = 'https://www.hackyourfuture.be/static/logo.png'; | ||
|
|
||
|
Comment on lines
+10
to
+13
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. Good! |
||
| } | ||
|
|
||
| hijackGoogleLogo(); | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,7 +7,8 @@ Full description at: https://github.com/HackYourFuture/Assignments/tree/main/2-B | |
| 2. Have the function execute when it's loading in the browser. | ||
| ------------------------------------------------------------------------------*/ | ||
| function addCurrentTime() { | ||
| // TODO complete this function | ||
| } | ||
| document.querySelector('time').textContent= new Date().toLocaleTimeString() ; | ||
| setInterval(addCurrentTime, 1000) ; | ||
|
Comment on lines
+10
to
+11
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. TODO: Almost there, but not quite. |
||
|
|
||
| // TODO execute `addCurrentTime` when the browser has completed loading the page | ||
| } | ||
| window.onload = addCurrentTime; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,9 +19,43 @@ Full description at: https://github.com/HackYourFuture/Assignments/tree/main/2-B | |
| Dancing cat URL: | ||
|
|
||
| https://media1.tenor.com/images/2de63e950fb254920054f9bd081e8157/tenor.gif | ||
| -----------------------------------------------------------------------------*/ | ||
| function catWalk() { | ||
| // TODO complete this function | ||
| } | ||
| -----------------------------------------------------------------------------*/ | ||
| window.addEventListener('load', function () { | ||
| const cat = document.querySelector('img'); | ||
| const originalSrc = cat.src || 'http://www.anniemation.com/clip_art/images/cat-walk.gif'; | ||
| const danceSrc = 'https://media1.tenor.com/images/2de63e950fb254920054f9bd081e8157/tenor.gif'; | ||
|
|
||
| cat.style.position = 'absolute'; | ||
| cat.style.left = '0px'; | ||
|
|
||
| let hasDanced = false; | ||
| let walkTimer = null; | ||
|
|
||
| function catWalk() { | ||
| const x = parseInt(cat.style.left, 10) || 0; | ||
| const rightEdge = window.innerWidth - cat.width; | ||
| const mid = rightEdge / 2; | ||
|
|
||
| if (x >= rightEdge) { | ||
| cat.style.left = '0px'; | ||
| hasDanced = false; | ||
| return; | ||
| } | ||
|
|
||
| if (!hasDanced && x >= mid) { | ||
| hasDanced = true; | ||
| clearInterval(walkTimer); | ||
| cat.src = danceSrc; | ||
| setTimeout(function () { | ||
| cat.src = originalSrc; | ||
| walkTimer = setInterval(catWalk, 50); | ||
| }, 5000); | ||
| return; | ||
| } | ||
|
|
||
| cat.style.left = (x + 10) + 'px'; | ||
| } | ||
|
|
||
| walkTimer = setInterval(catWalk, 50); | ||
| }); | ||
|
Comment on lines
+23
to
+60
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. TODO: Good effort but not quite there yet. I see the cat walking in place. It doesn't meet the requirements of walking across the screen from left to right and doing a dance for 50ms in the middle of the screen. |
||
|
|
||
| // TODO execute `catWalk` when the browser has completed loading the page | ||
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.
Nice work!