diff --git a/js/form.js b/js/form.js index c747a0d..3217598 100644 --- a/js/form.js +++ b/js/form.js @@ -7,7 +7,7 @@ const MAX_COMMENT_LENGTH = 140; const MAX_HASHTAG_COUNT = 5; const VALID_IMAGE_TYPES = ['image/gif', 'image/jpeg', 'image/png']; const HASHTAG_RULE = /^#[А-яа-яA-za-zёЁ]{1,19}$/; -const formErorrorsMessages = { +const ErrorMessage = { hashTag: 'Уникальные хештеги, каждый не более 20 символов, должны быть разделены пробелом', comment: 'Комментарий не более 140 символов' }; @@ -78,8 +78,8 @@ const validateForm = () => { errorTextClass: 'img-upload__field-wrapper__error' }); pristine.addValidator(hashtags, isCorrectHashtags, - formErorrorsMessages.hashTag); - pristine.addValidator(comments, isCorrectComment, formErorrorsMessages.comment); + ErrorMessage.hashTag); + pristine.addValidator(comments, isCorrectComment, ErrorMessage.comment); return pristine.validate(); }; diff --git a/js/image-effects.js b/js/image-effects.js index 5615367..f279289 100644 --- a/js/image-effects.js +++ b/js/image-effects.js @@ -1,4 +1,4 @@ -const EFFECT = { +const Effect = { 'none': { name: 'none', filter: '', unit: '', options: {range: {min: 0, max: 100}, step: 1, start: 100}, }, @@ -18,7 +18,7 @@ const EFFECT = { options: {range: {min: 1, max: 4}, step: 0.1, start: 4}, } }; -const DefaultSliderParams = { +const DefaultSliderParam = { range: {min: 0, max: 100}, start: 100, step: 0.1 @@ -32,27 +32,27 @@ const slider = document.querySelector('.effect-level__slider'); export const createEffectSlider = () =>{ sliderWrapper.classList.add('hidden'); - noUiSlider.create(slider, DefaultSliderParams); + noUiSlider.create(slider, DefaultSliderParam); }; export const resetFilters = () => { - image.style.filter = EFFECT['none'].name; + image.style.filter = Effect['none'].name; sliderWrapper.classList.add('hidden'); }; export const onEffectsFilterChange = (evt) =>{ const effect = evt.target.value; - if(effect === EFFECT['none'].name){ + if(effect === Effect['none'].name){ resetFilters(); } else{ sliderWrapper.classList.remove('hidden'); image.removeAttribute('class'); image.classList.add(`effects__preview--${effect}`); - slider.noUiSlider.updateOptions(EFFECT[effect].options); + slider.noUiSlider.updateOptions(Effect[effect].options); slider.noUiSlider.on('update', () => { sliderValue.value = slider.noUiSlider.get(); - image.style.filter = `${EFFECT[effect].filter}(${sliderValue.value}${EFFECT[effect].unit})`; + image.style.filter = `${Effect[effect].filter}(${sliderValue.value}${Effect[effect].unit})`; }); } };