-
Notifications
You must be signed in to change notification settings - Fork 1
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
Правда или действие #9
Правда или действие #9
Conversation
index.html
Outdated
@@ -235,6 +235,8 @@ <h2 class="success__title">Изображение успешно загруже | |||
<script type="module" src="js/main.js"></script> | |||
<script type="module" src="js/thumbnails.js"></script> | |||
<script type="module" src="js/data.js"></script> | |||
<script type="module" src="js/form.js"></script> | |||
<script src="pristine/Pristine-master/dist/pristine.min.js"></script> |
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.
подключается перед модулями
js/form.js
Outdated
const comments = document.querySelector('.text__description'); | ||
const rightHashtag = /^#[А-яа-яA-za-zёЁ]{1,19}$/; | ||
|
||
const MAX_HASHTAG_LENGTH = 20; |
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.
идет перед основным кодом
js/form.js
Outdated
}); | ||
const uniqueTags = new Set(hashtagsArray); | ||
|
||
return (isСorrectTag && uniqueTags.size === hashtagsArray.length && hashtagsArray.length <= 5) || hashtags.value === ''; |
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.
магическое число
js/form.js
Outdated
const MAX_HASHTAG_LENGTH = 20; | ||
|
||
|
||
const isCorrectComment = (comment) => isRightString(comment, 140); |
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.
магическое число
js/form.js
Outdated
} | ||
}; | ||
|
||
const onClickCancelButton = () => { |
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.
не соответствует критерию
js/form.js
Outdated
}; | ||
|
||
export const renderUploadForm = () => { | ||
uploadButton.addEventListener('change', openOverlay); |
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.
не соответствует критериям
js/form.js
Outdated
comments.onkeydown = (evt) => onFocusPreventClose(evt); | ||
hashtags.onkeydown = (evt) => onFocusPreventClose(evt); |
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.
мы не добавляем обработчики такими образом
js/form.js
Outdated
const MAX_HASHTAG_LENGTH = 20; | ||
const MAX_COMMENT_LENGTH = 140; | ||
const MAX_HASHTAG_COUNT = 5; | ||
const validImageTypes = ['gif', 'jpeg', 'png']; |
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.
это константа
js/form.js
Outdated
const isPicture = () => { | ||
const path = uploadButton.value.toLowerCase(); | ||
|
||
return validImageTypes.some((type) => path.endsWith(type)); |
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.
вообще мы смотрим file.type и работаем с. ним, а не с путем до файла. Но можно не переделывать
const cancelButton = document.querySelector('#upload-cancel'); | ||
const hashtags = document.querySelector('.text__hashtags'); | ||
const comments = document.querySelector('.text__description'); | ||
const rightHashtag = /^#[А-яа-яA-za-zёЁ]{1,19}$/; |
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.
константа
'Уникальные хештеги, каждый не более 20 символов, должны быть разделены пробелом'); | ||
pristine.addValidator(comments, isCorrectComment, 'Комментарий не более 140 символов'); |
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.
тексты ошибок желательно в перечисление собрать
60c99ff
into
htmlacademy-univer-javascript-1:master
🎓 Правда или действие