Skip to content

Commit

Permalink
Исправления ошибок после проверки
Browse files Browse the repository at this point in the history
  • Loading branch information
MaksimRozov committed Apr 5, 2024
1 parent e0fc6a7 commit bfc74af
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 13 deletions.
2 changes: 1 addition & 1 deletion js/api/get-data-variables.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ export const dataErrorTemplate = document.querySelector('#data-error').content.q
export const sendErrorTemplate = document.querySelector('#error').content.querySelector('.error');
export const sendFormErrorTemplate = document.querySelector('#success').content.querySelector('.success');
export const SHOW_ERROR_TIME = 5000;
export const BASE_URL = 'https://31.javascript.htmlacademy.pro/kekstagram';
export const BASE_URL = 'https://31.javascript.htmlacademy.pro/kekstagra';
export const Route = {
GET_DATA: '/data',
SEND_DATA: '/',
Expand Down
10 changes: 6 additions & 4 deletions js/api/secondary-functions.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import {onCloseChangePhotoEsc} from '../upload-photo';
import {dataErrorTemplate, sendErrorTemplate, sendFormErrorTemplate, SHOW_ERROR_TIME, submitButtonText} from './get-data-variables';
import {isEscapeKey} from '../util';

const submitButton = document.querySelector('.img-upload__submit');

function onSendSuccessClose() {
const successMessage = document.querySelector('.success');
successMessage.remove();
document.removeEventListener('click', onClickOutModalSuccess);
document.removeEventListener('keydown', onSendSuccessMessageCloseEsc);
}

const onSendErrorMessageClose = () => {
Expand All @@ -31,14 +33,14 @@ function onClickOutModalError (evt) {
onSendErrorMessageClose();
}

function onSendErrorMessageCloseEsc (evt) {
if (evt.key === 'Escape') {
function onSendErrorMessageCloseEsc () {
if (isEscapeKey) {
onSendErrorMessageClose();
}
}

function onSendSuccessMessageCloseEsc (evt) {
if (evt.key === 'Escape') {
function onSendSuccessMessageCloseEsc () {
if (isEscapeKey) {
onSendSuccessClose();
}
}
Expand Down
4 changes: 2 additions & 2 deletions js/filters/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const showFilterPanel = () => {

const debounceRender = debounce(addPhotoThumbnailsUsers);

const setActiveFilter = (evt) => {
const onSetActiveFilter = (evt) => {
const target = evt.target;
const activeButton = document.querySelector('.img-filters__button--active');

Expand Down Expand Up @@ -44,7 +44,7 @@ function filterChange () {
}

const listenerButtonsFilter = (photos) => {
filtersControlPanel.addEventListener('click', setActiveFilter);
filtersControlPanel.addEventListener('click', onSetActiveFilter);
showFilterPanel();
puctures = photos;
};
Expand Down
2 changes: 1 addition & 1 deletion js/show-large-picture/elementVariables.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export const bigPictureBlock = document.querySelector('.big-picture');
export const bigPictureCancel = document.querySelector('.big-picture__cancel');
export const bigPictureCancel = bigPictureBlock.querySelector('.big-picture__cancel');
export const bigPictureImg = bigPictureBlock.querySelector('.big-picture__img img');
export const likesCount = bigPictureBlock.querySelector('.likes-count');
export const commentTotalCount = bigPictureBlock.querySelector('.social__comment-total-count');
Expand Down
4 changes: 2 additions & 2 deletions js/show-large-picture/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { bigPictureBlock, bigPictureCancel, bigPictureImg, likesCount, commentTotalCount, socialCaption, socialCommentsList, buttonShowMore} from './elementVariables';
import {renderComments, onShowMoreComments} from './createComments';
import {toggleClass} from '../util';
import {toggleClass, isEscapeKey} from '../util';

const onCloseBigPicture = () => {
toggleClass(bigPictureBlock, false);
Expand Down Expand Up @@ -28,7 +28,7 @@ const onOpenBigPicture = (element) => {
};

function onCloseBigPictureEsc(evt){
if(evt.key === 'Escape'){
if(isEscapeKey){
evt.preventDefault();
onCloseBigPicture();
}
Expand Down
4 changes: 2 additions & 2 deletions js/upload-photo/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {toggleClass} from '../util';
import {toggleClass, isEscapeKey} from '../util';
import {pristine} from '../validation-form';
import {imgUploadInput, imgUpoadOverlay, imgUploadancel, effectsPreview, effectLevelSliderParrent, uploadPreviewImage, FILE_TYPES} from './uploadPhotoVariables';
import {inputTextHashtag, commentForm, imgUploadForm} from '../validation-form';
Expand All @@ -15,7 +15,7 @@ const onCloseChangePhoto = () => {
};

function onCloseChangePhotoEsc(evt){
if (evt.key === 'Escape' && !(document.activeElement === inputTextHashtag || document.activeElement === commentForm)) {
if (isEscapeKey && !(document.activeElement === inputTextHashtag || document.activeElement === commentForm)) {
onCloseChangePhoto();
} else {
evt.stopPropagation();
Expand Down
4 changes: 3 additions & 1 deletion js/util/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,6 @@ const debounce = (callback, timeoutDelay = TIMEOUT_DELAY_DEBOUNCE) => {
};
};

export {getRandomInteger, createId, getRandomArrayElement, toggleClass, debounce};
const isEscapeKey = (evt) => evt.key === 'Escape';

export {getRandomInteger, createId, getRandomArrayElement, toggleClass, debounce, isEscapeKey};

0 comments on commit bfc74af

Please sign in to comment.