Skip to content
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

Merged

Conversation

PavelUd
Copy link
Contributor

@PavelUd PavelUd commented Dec 6, 2023

@keksobot keksobot changed the title Module9 task1 Правда или действие Dec 6, 2023
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>

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;

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 === '';

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);

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 = () => {

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);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

не соответствует критериям

js/form.js Outdated
Comment on lines 74 to 75
comments.onkeydown = (evt) => onFocusPreventClose(evt);
hashtags.onkeydown = (evt) => onFocusPreventClose(evt);

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'];

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));

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}$/;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

константа

Comment on lines +72 to +73
'Уникальные хештеги, каждый не более 20 символов, должны быть разделены пробелом');
pristine.addValidator(comments, isCorrectComment, 'Комментарий не более 140 символов');

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

тексты ошибок желательно в перечисление собрать

@keksobot keksobot merged commit 60c99ff into htmlacademy-univer-javascript-1:master Dec 11, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants