Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion js/comments.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export const initComments = (comments) => {
};

commentsLoader.addEventListener('click', () => {
let previousCommentsCount = currentCommentsCount;
const previousCommentsCount = currentCommentsCount;

currentCommentsCount = Math.min(currentListComments.length, currentCommentsCount + MAX_COMMENTS_VIEW);

Expand Down
13 changes: 0 additions & 13 deletions js/upload-form.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,3 @@ imageUploadCancel.addEventListener('click', () => {
closeUploadOverlay();
});

imageUploadForm.addEventListener('submit', (evt) => {
evt.preventDefault();

const isValid = pristineConfig.validate();

if (isValid) {
console.log('Форма полностью валидна! Можно отправлять на сервер.');
} else {
console.log('Форма не валидна!');
}
});


6 changes: 4 additions & 2 deletions js/validation.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,13 @@ const pristineConfig = new Pristine(imageUploadForm, {
const normalizeHashtags = (value) => value.trim().toLowerCase().split(/\s+/).filter(Boolean);

function validateHashtagFormat(value) {
if (!value) { return true };
if (!value) {
return true;
}

const hashtags = normalizeHashtags(value);

return hashtags.every(tag => VALID_HASHTAG_REGEXP.test(tag));
return hashtags.every((tag) => VALID_HASHTAG_REGEXP.test(tag));
}

function validateHashtagCount(value) {
Expand Down
Loading