Skip to content

Commit

Permalink
опаньки
Browse files Browse the repository at this point in the history
  • Loading branch information
PavelUd committed Dec 14, 2023
1 parent 5736a46 commit f798263
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions js/form.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 символов'
};
Expand Down Expand Up @@ -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();
};
Expand Down
14 changes: 7 additions & 7 deletions js/image-effects.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const EFFECT = {
const Effect = {
'none': { name: 'none', filter: '', unit: '',
options: {range: {min: 0, max: 100}, step: 1, start: 100},
},
Expand All @@ -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
Expand All @@ -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})`;
});
}
};

0 comments on commit f798263

Please sign in to comment.