Skip to content
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

исправляю ошибки #5

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
66 changes: 41 additions & 25 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
<!DOCTYPE html>
<html lang="ru">

<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<link rel="stylesheet" href="css/normalize.css">
<link rel="stylesheet" href="css/style.css">
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
<script src="/js/functions.js"></script>
<script src="/js/main.js"></script>
<title>Кекстаграм</title>
</head>

Expand All @@ -18,7 +17,8 @@
<section class="img-filters img-filters--inactive container">
<h2 class="img-filters__title visually-hidden">Фильтр фотографий</h2>
<form class="img-filters__form" action="index.html" method="get" autocomplete="off">
<button type=button class="img-filters__button img-filters__button--active" id="filter-default">По умолчанию</button>
<button type=button class="img-filters__button img-filters__button--active" id="filter-default">По
умолчанию</button>
<button type=button class="img-filters__button" id="filter-random">Случайные</button>
<button type=button class="img-filters__button" id="filter-discussed">Обсуждаемые</button>
</form>
Expand Down Expand Up @@ -48,7 +48,8 @@ <h2 class="img-upload__title visually-hidden">Загрузка фотограф
<!-- Изменение размера изображения -->
<fieldset class="img-upload__scale scale">
<button type="button" class="scale__control scale__control--smaller">Уменьшить</button>
<input type="text" class="scale__control scale__control--value" value="100%" title="Image Scale" name="scale" readonly>
<input type="text" class="scale__control scale__control--value" value="100%" title="Image Scale"
name="scale" readonly>
<button type="button" class="scale__control scale__control--bigger">Увеличить</button>
</fieldset>

Expand All @@ -71,42 +72,48 @@ <h2 class="img-upload__title visually-hidden">Загрузка фотограф
<fieldset class="img-upload__effects effects">
<ul class="effects__list">
<li class="effects__item">
<input type="radio" class="effects__radio visually-hidden" name="effect" id="effect-none" value="none" checked>
<input type="radio" class="effects__radio visually-hidden" name="effect" id="effect-none"
value="none" checked>
<label for="effect-none" class="effects__label">
<span class="effects__preview effects__preview--none">Превью фото без эффекта</span>
Оригинал
</label>
</li>
<li class="effects__item">
<input type="radio" class="effects__radio visually-hidden" name="effect" id="effect-chrome" value="chrome">
<input type="radio" class="effects__radio visually-hidden" name="effect" id="effect-chrome"
value="chrome">
<label for="effect-chrome" class="effects__label">
<span class="effects__preview effects__preview--chrome">Превью эффекта Хром</span>
Хром
</label>
</li>
<li class="effects__item">
<input type="radio" class="effects__radio visually-hidden" name="effect" id="effect-sepia" value="sepia">
<input type="radio" class="effects__radio visually-hidden" name="effect" id="effect-sepia"
value="sepia">
<label for="effect-sepia" class="effects__label">
<span class="effects__preview effects__preview--sepia">Превью эффекта Сепия</span>
Сепия
</label>
</li>
<li class="effects__item">
<input type="radio" class="effects__radio visually-hidden" name="effect" id="effect-marvin" value="marvin">
<input type="radio" class="effects__radio visually-hidden" name="effect" id="effect-marvin"
value="marvin">
<label for="effect-marvin" class="effects__label">
<span class="effects__preview effects__preview--marvin">Превью эффекта Марвин</span>
Марвин
</label>
</li>
<li class="effects__item">
<input type="radio" class="effects__radio visually-hidden" name="effect" id="effect-phobos" value="phobos">
<input type="radio" class="effects__radio visually-hidden" name="effect" id="effect-phobos"
value="phobos">
<label for="effect-phobos" class="effects__label">
<span class="effects__preview effects__preview--phobos">Превью эффекта Фобос</span>
Фобос
</label>
</li>
<li class="effects__item">
<input type="radio" class="effects__radio visually-hidden" name="effect" id="effect-heat" value="heat">
<input type="radio" class="effects__radio visually-hidden" name="effect" id="effect-heat"
value="heat">
<label for="effect-heat" class="effects__label">
<span class="effects__preview effects__preview--heat">Превью эффекта Зной</span>
Зной
Expand Down Expand Up @@ -156,15 +163,18 @@ <h2 class="big-picture__title visually-hidden">Просмотр фотогра
</div>

<!-- Комментарии к изображению -->
<div class="social__comment-count"><span class="social__comment-shown-count">5</span> из <span class="social__comment-total-count">125</span> комментариев</div>
<div class="social__comment-count"><span class="social__comment-shown-count">5</span> из <span
class="social__comment-total-count">125</span> комментариев</div>
<ul class="social__comments">
<li class="social__comment">
<img class="social__picture" src="img/avatar-4.svg" alt="Аватар комментатора фотографии" width="35" height="35">
<img class="social__picture" src="img/avatar-4.svg" alt="Аватар комментатора фотографии" width="35"
height="35">
<p class="social__text">Мега фото! Просто обалдеть. Как вам так удалось?</p>
</li>
<li class="social__comment">
<img class="social__picture" src="img/avatar-3.svg" alt="Аватар комментатора фотографии" width="35" height="35">
<p class="social__text">Да это фоташоп!!!!!!!!</p>
<img class="social__picture" src="img/avatar-3.svg" alt="Аватар комментатора фотографии" width="35"
height="35">
<p class="social__text">Да это фоташоп!!!!!!!!</p>
</li>
</ul>

Expand All @@ -173,7 +183,8 @@ <h2 class="big-picture__title visually-hidden">Просмотр фотогра

<!-- Форма для отправки комментария -->
<div class="social__footer">
<img class="social__picture" src="img/avatar-6.svg" alt="Аватар комментатора фотографии" width="35" height="35">
<img class="social__picture" src="img/avatar-6.svg" alt="Аватар комментатора фотографии" width="35"
height="35">
<input type="text" class="social__footer-text" placeholder="Ваш комментарий...">
<button type="button" class="social__footer-btn" name="button">Отправить</button>
</div>
Expand All @@ -188,11 +199,14 @@ <h2 class="big-picture__title visually-hidden">Просмотр фотогра
<footer class="page-footer container">
<div class="page-footer__wrapper">
<div class="page-footer__copyright copyright">
<a class="copyright__link copyright__link--image" href="https://htmlacademy.ru/intensive/javascript"><img src="img/htmla-logo.svg" width="130" height="45" alt="HTML Academy"></a>
<p>Сделано в <a class="copyright__link copyright__link--text" href="https://htmlacademy.ru/intensive/javascript">HTML Academy</a></p>
<a class="copyright__link copyright__link--image" href="https://htmlacademy.ru/intensive/javascript"><img
src="img/htmla-logo.svg" width="130" height="45" alt="HTML Academy"></a>
<p>Сделано в <a class="copyright__link copyright__link--text"
href="https://htmlacademy.ru/intensive/javascript">HTML Academy</a></p>
</div>
<ul class="page-footer__contacts contacts">
<li><a href="https://twitter.com/htmlacademy_ru" class="contacts__link contacts__link--twitter">Twitter</a></li>
<li><a href="https://twitter.com/htmlacademy_ru" class="contacts__link contacts__link--twitter">Twitter</a>
</li>
<li><a href="https://vk.com/htmlacademy" class="contacts__link contacts__link--vk">VK</a></li>
</ul>
</div>
Expand Down Expand Up @@ -229,12 +243,14 @@ <h2 class="success__title">Изображение успешно загруже
</section>
</template>

<!-- Сообщение с ошибкой загрузки изображений от других пользователей -->
<template id="data-error">
<section class="data-error">
<h2 class="data-error__title">Не удалось загрузить данные</h2>
</section>
</template>

<!-- Сообщение с ошибкой загрузки изображений от других пользователей -->
<template id="data-error">
<section class="data-error">
<h2 class="data-error__title">Не удалось загрузить данные</h2>
</section>
</template>
<script src="/js/functions.js"></script>
<script src="/js/main.js"></script>
</body>

</html>
18 changes: 0 additions & 18 deletions js/functions.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@

function checkLengthString(string = '', length = 1) {

Check warning on line 2 in js/functions.js

View workflow job for this annotation

GitHub Actions / Check

'checkLengthString' is defined but never used
return (string <= length);
}

console.log(checkLengthString('тестовая строка', 5));


function findPolydrome(string = '') {

Check warning on line 7 in js/functions.js

View workflow job for this annotation

GitHub Actions / Check

'findPolydrome' is defined but never used
string = string.replaceAll(' ', '').toLowerCase();

let reversedLength = '';
Expand All @@ -17,16 +15,7 @@
return string === reversedLength;
}

console.log('\n--- Тесты для findPolydrome ---');
console.log(`Строка является палиндромом: ${findPolydrome('топот') === true}`);
console.log(`Строка является палиндромом с разным регистром: ${findPolydrome('ДовОд') === true}`);
console.log(`Строка не является палиндромом: ${findPolydrome('Кекс') === false}`);
console.log(`Строка является палиндромом: ${findPolydrome('Лёша на полке клопа нашёл ') === true}`);

// Функция принимает строку,
// извлекает содержащиеся в ней цифры от 0 до 9 и возвращает их в виде целого положительного числа. Если в строке нет ни одной цифры, функция должна вернуть NaN:

function extractsNumbers(string = '') {

Check warning on line 18 in js/functions.js

View workflow job for this annotation

GitHub Actions / Check

'extractsNumbers' is defined but never used

let result = '';
string = string.toString();
Expand All @@ -44,10 +33,3 @@
}

}

console.log(extractsNumbers('2023 год'));
console.log(extractsNumbers('ECMAScript 2022'));
console.log(extractsNumbers('1 кефир, 0.5 батона'));
console.log(extractsNumbers('агент 007'));
console.log(extractsNumbers('а я томат'));
console.log(extractsNumbers(-1));
25 changes: 12 additions & 13 deletions js/main.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@

const ID_PHOTO_RANGE = {
const IdPhotoRange = {

Check warning on line 2 in js/main.js

View workflow job for this annotation

GitHub Actions / Check

'IdPhotoRange' is assigned a value but never used
MIN: 1,
MAX: 25
};

const ID_URL_RANGE = {
const IdUrlRange = {

Check warning on line 7 in js/main.js

View workflow job for this annotation

GitHub Actions / Check

'IdUrlRange' is assigned a value but never used
MIN: 1,
MAX: 25
};

const LIKES_RANGE = {
const LikesRange = {
MIN: 15,
MAX: 200
};

const COMMENTS_RANGE = {
const CommentsRange = {
MIN: 0,
MAX: 30
};

const ID_MESSAGER_RANGE = {
const IdMessagerRange = {

Check warning on line 22 in js/main.js

View workflow job for this annotation

GitHub Actions / Check

'IdMessagerRange' is assigned a value but never used
MIN: 1,
MAX: 1111
};
Expand All @@ -33,7 +33,7 @@
'img/avatar-6.svg',
];

const MESSAGER_RANGE = {
const MessagerRange = {

Check warning on line 36 in js/main.js

View workflow job for this annotation

GitHub Actions / Check

'MessagerRange' is assigned a value but never used
MIN: 1,
MAX: 2
};
Expand Down Expand Up @@ -96,30 +96,29 @@
return increasesId;
}

let funcPhoto = getId();
let generatePhoto = getId();

let funcComment = getId();
let generateComment = getId();

const createComment = () => (
{
id: funcComment(),
id: generateComment(),
avatar: AVATAR_RANGE[getRandomInt(0, AVATAR_RANGE.length -1)],
message: MESSAGE[getRandomInt(0, MESSAGE.length -1)],
name: NAME[getRandomInt(0, NAME.length -1)],
}
);

const createPhoto = () => {
let id = funcPhoto();
let id = generatePhoto();
return {
id: id,
url: `photos/${id}.jpg`,
description: DESCRIPTION[getRandomInt(0, DESCRIPTION.length -1)],
likes: getRandomInt(LIKES_RANGE.MIN, LIKES_RANGE.MAX),
comment: Array.from({length: getRandomInt(COMMENTS_RANGE.MIN, COMMENTS_RANGE.MAX)}, () => createComment()),
likes: getRandomInt(LikesRange.MIN, LikesRange.MAX),
comment: Array.from({length: getRandomInt(CommentsRange.MIN, CommentsRange.MAX)}, () => createComment()),
}
}

const array = Array.from({length: 25}, () => createPhoto())

Check warning on line 123 in js/main.js

View workflow job for this annotation

GitHub Actions / Check

'array' is assigned a value but never used

console.log(array);
Loading