Некодим логотипНекодим
МодификацииПубликацииНекодИИмЦены
Некодим логотипНекодим

© 2020-2026 Некодим

Готовые модификации для вашего сайта. Улучшайте функциональность и дизайн без программирования.

Компания

  • Контакты
  • Публичная оферта
  • Политика конфиденциальности
  • Согласие на обработку данных
  • Лицензионное соглашение
  • Реферальная программа

Полезное

  • Модификации
  • Публикации
  • Каталог блоков Tilda
  • MCP для агентов
  • Журнал изменений
  • Доска почёта

Личный кабинет

  • Вход
  • Регистрация
  • Цены
Журнал измененийИстория GitФайлыTilda MCP
Каталог файлов

tilda-members-store-other.js

Код файла
Версия от 04.12.2026, 04:03:53 МСК
Оригинал на CDNСнимок 56c3b845Полный текст
1001		// Всегда показываем первую страницу1002		paginationElement.appendChild(createPageButton(1));1003 1004		if (currentPage > 3) {1005			addEllipsis();1006		}1007 1008		// Определяем диапазон страниц для отображения1009		let startPage = Math.max(2, currentPage - 1);1010		let endPage = Math.min(totalPages - 1, currentPage + 1);1011 1012		// Корректируем диапазон, чтобы всегда показывать 3 страницы
История файла и сравнение версий
  • 04.12.2026, 04:03:53 · 56c3b845
1013 if (startPage === 2) {
1014 endPage = 4;
1015 } else if (endPage === totalPages - 1) {
1016 startPage = totalPages - 3;
1017 }
1018
1019 addPageButtons(startPage, endPage);
1020
1021 if (currentPage < totalPages - 2) {
1022 addEllipsis();
1023 }
1024
1025 // Всегда показываем последнюю страницу
1026 paginationElement.appendChild(createPageButton(totalPages));
1027 }
1028
1029 if (currentPage < totalPages) {
1030 const nextButton = createNavButtonElement('next', () => handlePageChange(currentPage + 1));
1031 nextButton.ariaLabel = tma__translate('{{pagination_next}}', 'store_dict');
1032 paginationElement.appendChild(nextButton);
1033 }
1034
1035 return paginationElement;
1036}
1037
1038// Страница ошибки
1039
1040/**
1041 * Создает элемент с сообщением об ошибке
1042 *
1043 * @param {string} error
1044 * @returns {HTMLElement} Элемент с сообщением
1045 */
1046function tmst__createErrorMessageElement(error) {
1047 const errorMessage = tma__translate(`{{${error}}}`, 'store_dict');
1048 const messageContainer = document.createElement('div');
1049 messageContainer.className = 'tmst-error-message';
1050
1051 const contentWrapper = document.createElement('div');
1052 contentWrapper.className = 'tmst-error-content';
1053
1054 const icon = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
1055 icon.setAttribute('viewBox', '0 0 100 100');
1056 icon.setAttribute('fill-rule', 'evenodd');
1057 icon.setAttribute('class', 'tmst-error-icon');
1058 icon.innerHTML = tmst__getErrorIconHtml(error);
1059
1060 const text = document.createElement('div');
1061 text.className = 'tmst-error-text';
1062
1063 // Если перевода по ключу нет, то выводим текст ключа
1064 if (errorMessage === `{{${error}}}`) {
1065 text.textContent = `${error}`;
1066 } else {
1067 text.textContent = errorMessage;
1068 }
1069
1070 contentWrapper.appendChild(icon);
1071 contentWrapper.appendChild(text);
1072
1073 if (
1074 ['connection_error', 'network_error', 'timeout_error', 'server_error', 'wrong_user_token'].includes(
1075 errorMessage
1076 )
1077 ) {
1078 contentWrapper.appendChild(tmst__createRefreshPageButton());
1079 }
1080
1081 messageContainer.appendChild(contentWrapper);
1082
1083 return messageContainer;
1084}
1085
1086/**
1087 * Создает кнопку "Обновить страницу"
1088 * @returns {HTMLElement} Элемент кнопки
1089 */
1090function tmst__createRefreshPageButton() {
1091 const buttonsWrapper = document.createElement('div');
1092 buttonsWrapper.className = 'tmst-error-buttons';
1093
1094 // Кнопка "Обновить страницу"
1095 const refreshButton = document.createElement('button');
1096 refreshButton.className = 'tmst-button tmst-error-button';
1097 refreshButton.textContent = tma__translate('{{refresh_button}}', 'store_dict');
1098 refreshButton.addEventListener('click', () => window.location.reload());
1099 buttonsWrapper.appendChild(refreshButton);
1100
Предыдущие 100 строкСледующие 100 строк