-
Notifications
You must be signed in to change notification settings - Fork 0
homework-18 #39
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
Open
horidon
wants to merge
3
commits into
master
Choose a base branch
from
homework-18
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
homework-18 #39
Changes from 2 commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| <!DOCTYPE html> | ||
| <html lang="en"> | ||
|
|
||
| <head> | ||
| <meta charset="UTF-8"> | ||
| <title>Document</title> | ||
| <style> | ||
| section { | ||
| display: flex; | ||
| width: 100%; | ||
| height: 350px; | ||
| flex: 1; | ||
| } | ||
| div { | ||
| flex: 1; | ||
| flex-direction: column; | ||
| display: flex; | ||
| align-items: flex-end; | ||
| } | ||
| .one { | ||
| background-color: coral; | ||
| } | ||
| .two { | ||
| background-color: slateblue; | ||
| } | ||
| .three { | ||
| background-color: fuchsia; | ||
| } | ||
| .resize { | ||
| width: 25px; | ||
| height: 100%; | ||
| background: black; | ||
| transition: 0.3s ease; | ||
| } | ||
| </style> | ||
| </head> | ||
|
|
||
| <body> | ||
| <section> | ||
| <div class="one"> | ||
| <div class="resize"></div> | ||
| </div> | ||
| <div class="two"> | ||
| <div class="resize"></div> | ||
| </div> | ||
| <div class="three"> | ||
| <div class="resize"></div> | ||
| </div> | ||
| </section> | ||
| <script src="events.js"></script> | ||
| </body> | ||
|
|
||
| </html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| // @SUPER-FrontEnd | ||
| /* | ||
| У вас есть 3 блока смотри events.html | ||
| при mousedown и движении мышки нужно сделать | ||
| ресайз одного блока. | ||
| Подсказка - событие необходимо повесить на доп. элемент .resize | ||
| */ | ||
|
|
||
| const resizeBlocks = document.querySelectorAll('.resize'); | ||
|
|
||
| [...resizeBlocks].forEach(block => { | ||
| console.log(block) | ||
| block.addEventListener('click', (e) => { | ||
| console.log(e.target.parentElement) | ||
| }); | ||
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| <!DOCTYPE html> | ||
| <html lang="en"> | ||
| <head> | ||
| <meta charset="UTF-8"> | ||
| <title>Home work 18</title> | ||
| <style> | ||
| body{ | ||
| display: flex; | ||
| justify-content: center; | ||
| } | ||
| .active{ | ||
| background-color: brown; | ||
| } | ||
| td{ | ||
| width: 50px; | ||
| height: 50px; | ||
| border: 2px solid black; | ||
| } | ||
| </style> | ||
| </head> | ||
| <body> | ||
| <table> | ||
| <tr id="first"> | ||
| <td></td> | ||
| <td></td> | ||
| <td></td> | ||
| <td></td> | ||
| <td></td> | ||
| </tr> | ||
| <tr id="second"> | ||
| <td></td> | ||
| <td></td> | ||
| <td></td> | ||
| <td></td> | ||
| <td></td> | ||
| </tr> | ||
| <tr id="third"> | ||
| <td></td> | ||
| <td></td> | ||
| <td></td> | ||
| <td></td> | ||
| <td></td> | ||
| </tr> | ||
| <tr id="fourth"> | ||
| <td></td> | ||
| <td></td> | ||
| <td></td> | ||
| <td></td> | ||
| <td></td> | ||
| </tr> | ||
| <tr id="fifth"> | ||
| <td></td> | ||
| <td></td> | ||
| <td></td> | ||
| <td></td> | ||
| <td></td> | ||
| </tr> | ||
| </table> | ||
| <script src="src/main.js"></script> | ||
| </body> | ||
| </html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,98 @@ | ||
| /* EASY | ||
| Алгоритмы ! | ||
| TASK 0 | ||
| Вам дано предложение, верните массив из слов, | ||
| которые длинее чем средняя длина всех слов. | ||
| Слова разделены пробелами, если в предложении запятые,они должны быть пропущены | ||
| solution(["This is a sample string"]) expected ["This" "sample" "string"] | ||
| solution(["Some another sample"]) expected ["another" "sample"] | ||
| solution(["Do, do, do, do... do it!"]) expected [] | ||
| */ | ||
|
|
||
| const solution = sentence => { | ||
| let arrWithWords = sentence.join('').split(' '); | ||
| arrWithWords = arrWithWords.reduce((clearWords, word) => { | ||
| const clearWord = word.replace(/\W/gmi, ''); | ||
| clearWords.push(clearWord); | ||
| return clearWords; | ||
| }, []); | ||
| const middleLengthOfString = arrWithWords.reduce((acc, word) => acc + word.length, 0) / arrWithWords.length; | ||
|
|
||
| return arrWithWords.reduce((output, word) => { | ||
| if(word.length > middleLengthOfString) { | ||
| output.push(word); | ||
| } | ||
| return output; | ||
| }, []); | ||
| } | ||
|
|
||
| console.log(solution(["This is a sample string"])); | ||
| console.log(solution(["Some another sample"])); | ||
| console.log(solution(["Do, do, do, do... do it!"])); | ||
|
|
||
| /* | ||
| Подготовка к занятию в пятницу. | ||
| Windows: | ||
| Установите все node.js скачать отсюда -> https://nodejs.org/en/ | ||
| Скачайте последнюю 10.x.x версию | ||
| Для проверки установки в консоле введите "node -v" (без кавычек) отобразит версию node.js | ||
| Linux: | ||
| sudo apt install npm // установить менеджер пакетов npm | ||
| npm i -g n // установить пакет для установки node.js | ||
| sudo n latest // установить последнюю версию node.js | ||
| */ | ||
|
|
||
|
|
||
| /* TASK 1 | ||
| Сделайте таблицу 5x5 | ||
| При клике на элемент, изменяйте цвет у элемента на красный. | ||
| Но цвет у элемента должен изменяться пропорционально в другой половине квадрата | ||
| Пример 3х3: | ||
| []|[]|[] | ||
| []|[]|[] | ||
| []|[]|[] | ||
| кликаем сюда -> []|[]|[] | ||
| []|[]|[] | ||
| []|[]|[x] <- загорается тут | ||
| []|[]|[] | ||
| кликаем сюда -> []|[]|[x] <- загорается тут | ||
| []|[]|[x] | ||
| */ | ||
| const table = document.querySelector('tbody'); | ||
| const reversedRows = [...table.rows].reverse(); | ||
| const reversedTable = reversedRows.reduce((output, tr) => { | ||
| output.push([...tr.cells].reverse()); | ||
| return output; | ||
| }, []); | ||
|
|
||
| table.addEventListener('click', (e) => { | ||
| const toggleFunc = rowNumber => { | ||
| const index = e.target.cellIndex; | ||
| const cell = reversedTable[rowNumber][index]; | ||
| cell.classList.toggle('active'); | ||
| } | ||
|
|
||
| if(e.target.tagName === 'TD' && e.target.parentElement.id ==='first') { | ||
|
||
| toggleFunc(0) | ||
| } | ||
| if(e.target.tagName === 'TD' && e.target.parentElement.id ==='second') { | ||
| toggleFunc(1) | ||
| } | ||
| if(e.target.tagName === 'TD' && e.target.parentElement.id ==='third') { | ||
| toggleFunc(2) | ||
| } | ||
| if(e.target.tagName === 'TD' && e.target.parentElement.id ==='fourth') { | ||
| toggleFunc(3) | ||
| } | ||
| if(e.target.tagName === 'TD' && e.target.parentElement.id ==='fifth') { | ||
| toggleFunc(4) | ||
| } | ||
| }) | ||
|
|
||
| // @SUPER-FrontEnd | ||
| /* | ||
| У вас есть 3 блока смотри events.html | ||
| при mousedown и движении мышки нужно сделать | ||
| ресайз одного блока. | ||
| Подсказка - событие необходимо повесить на доп. элемент .resize | ||
| */ | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.