-
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
Правда или действие #10
base: master
Are you sure you want to change the base?
Правда или действие #10
Conversation
♻️ Я собрал ваш пулреквест. Посмотреть можно здесь. |
♻️ Я собрал ваш пулреквест. Посмотреть можно здесь. |
js/modules/upload-form.js
Outdated
imageUploadCancle.addEventListener('click', closeUploadWindow); | ||
|
||
const getHashtagsArray = (element) => { | ||
const hashtagsArray = element.toLowerCase().split(/\s+/).filter((item) => item !== ''); |
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.
const hashtagsArray = element.toLowerCase().split(/\s+/).filter(Boolean);
js/modules/upload-form.js
Outdated
if(regexp.test(hashtag) === true) { | ||
newArray.push(hashtag); | ||
} | ||
}); |
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.
if(regexp.test(hashtag)) {
const HASHTAGS_COUNT = 5; | ||
const COMMENT_LENGTH = 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.
должны быть сразу после import
js/modules/upload-form.js
Outdated
const hashtagsName = getHashtagsArray(element); | ||
const newArray = []; | ||
|
||
hashtagsName.forEach((hashtag) => { |
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/modules/upload-form.js
Outdated
uploadComment.removeEventListener('focus', onCancleKeyDown); | ||
} | ||
|
||
imageUploadInput.addEventListener('change', openUploadWindow); |
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/modules/upload-form.js
Outdated
|
||
imageUploadInput.addEventListener('change', openUploadWindow); | ||
|
||
imageUploadCancle.addEventListener('click', closeUploadWindow); |
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/modules/upload-form.js
Outdated
const getHashtagsDuplicate = (element) => { | ||
const hashtagsArray = getHashtagsArray(element); | ||
const newArray = []; | ||
for (let i = 0; i < hashtagsArray.length; i++) { | ||
if(!newArray.includes(hashtagsArray[i])){ | ||
newArray.push(hashtagsArray[i]); | ||
} | ||
} | ||
if(newArray.length === hashtagsArray.length) { | ||
return newArray; | ||
} | ||
}; | ||
|
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.
new Set(hashtagsArray ).size === hashtagsArray .length
https://developer.mozilla.org/ru/docs/Web/JavaScript/Reference/Global_Objects/Set
js/modules/upload-form.js
Outdated
pristine.addValidator(uploadHashtag, getHashtagsName, 'введён невалидный хэштег'); | ||
pristine.addValidator(uploadHashtag, getHashtagsCount, 'превышено количество хэштегов'); | ||
pristine.addValidator(uploadHashtag, getHashtagsDuplicate, 'хэштеги повторяются'); | ||
pristine.addValidator(uploadComment, getCommentLength, 'длина комментария больше 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.
ошибки в константы
const ErrorMessage = { }
♻️ Я собрал ваш пулреквест. Посмотреть можно здесь. |
🎓 Правда или действие
💥 https://htmlacademy-javascript.github.io/2506775-kekstagram-2/10/