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

© 2020-2026 Некодим

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

Компания

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

Полезное

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

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

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

tilda-vote-1.1.js

Код файла
Версия от 18.08.2026, 07:00:17 МСК
Оригинал на CDNСнимок 56c3b845Полный текст
701        errorText = 'Что-то пошло не так и голосование не может корректно работать. Пожалуйста, попробуйте другой браузер, отключите режим инкогнито или обратитесь к владельцу сайта.';702    } else {703        errorText = "Something went wrong and vote doesn't work correctly. Please, try another browser, unlock private mode or write to website owner.";704    }705    if (data['error'] == 1) {706        if (window.t_vote__browserLang === 'RU') {707            errorText = 'С этого IP недавно голосовали. Пожалуйста, подождите 10 минут и попробуйте еще раз.';708        } else {709            errorText = 'Somebody has recently voted from this IP. Please wait 10 minutes and try again.';710        }711
История файла и сравнение версий
  • 18.08.2026, 07:00:17 · 56c3b845
}
712 if (data['error'] == 2) {
713 if (window.t_vote__browserLang === 'RU') {
714 errorText = 'С вашего IP адреса приходит слишком много запросов к серверу. Сервер временно не может принимать голоса с этого IP. Пожалуйста, попробуйте еще раз позже.';
715 } else {
716 errorText = "There are too many votes from your IP. Server temporarily can't get votes from this IP. Please, try again later.";
717 }
718 }
719 if (data['error'] == 4) {
720 if (window.t_vote__browserLang === 'RU') {
721 errorText = 'Извините, но голос удалить уже нельзя. Удалить голос можно только в течение 30 минут после активации.';
722 } else {
723 errorText = "Sorry, but you can't delete vote now. You can delete votes just during 30 minutes after activation.";
724 }
725 }
726 if (data['error'] == 5) {
727 if (window.t_vote__browserLang === 'RU') {
728 errorText = 'С вашего IP запросы приходят слишком часто. Пожалуйста, подождите 7 секунд прежде чем выбирать ответы в слудующих голосованиях на странице.';
729 } else {
730 errorText = 'Votes are sended too often from your IP. Please wait 7 seconds between choosing answers in different votes.';
731 }
732 }
733 t_vote__showError(opts.voteID, errorText);
734}
735
736/**
737 * Add in document captcha
738 */
739function addTildaCaptcha() {
740 var voteCaptchaBox = document.querySelector('#tildavotecaptchabox');
741
742 if (voteCaptchaBox) t_removeEl(voteCaptchaBox);
743
744 document.body.insertAdjacentHTML('beforebegin', '<div id="tildavotecaptchabox" style="z-index: 100000;position:fixed; text-align: center; vertical-align: middle; top: 0px; left:0px; bottom: 0px; right: 0px; background: rgba(255,255,255,0.97);"><iframe id="captchaIframeBox" src="https://vote.tildaapi.' + t_vote__getRootZone() + '/vote/1/send/showcaptcha.php" frameborder="0" width="100%" height="100%"></iframe></div>');
745
746 window.removeEventListener('message', checkVerifyTildaVoteCaptcha);
747 window.addEventListener('message', checkVerifyTildaVoteCaptcha);
748}
749
750/**
751 * Checks captcha verification
752 *
753 * @param {MouseEvent} event - event
754 * @returns {undefined} - exit function
755 */
756function checkVerifyTildaVoteCaptcha(event) {
757 var voteCaptchaBox = document.querySelector('#tildavotecaptchabox');
758
759 if (event.origin.indexOf('vote.tildaapi.' + t_vote__getRootZone()) !== -1) {
760 if (voteCaptchaBox) t_removeEl(voteCaptchaBox);
761
762 if (event.data === 'closeiframe') return;
763
764 t_vote__itemSend_continue(window.tvote_opts, event.data);
765 }
766}
767
768/**
769 * Show block with a text error
770 *
771 * @param {string} voteID - id group vote
772 * @param {string} errorText - error text
773 */
774function t_vote__showError(voteID, errorText) {
775 if (!errorText) {
776 if (window.t_vote__browserLang === 'RU') {
777 errorText = 'Что-то пошло не так и голосование может работать некорректно. Пожалуйста, проверьте соединение с интернетом или обратитесь к владельцу сайта.';
778 } else {
779 errorText = "Something went wrong and vote doesn't work correctly. Please, check your internet connection or write to website owner.";
780 }
781 }
782
783 var vote = document.querySelector('[data-vote-id="' + voteID + '"]');
784 var type = vote.getAttribute('data-vote-type');
785
786 if (!type || type === 'single') {
787 var errorEl = "<div class='t-vote__errorbox'><div class='t-vote__errorbox-text t-text t-text_xs t-align_center' style='background-color:#333;color:#fff;padding:20px;margin-top:30px;'>" + errorText + '</div></div>';
788 vote.insertAdjacentHTML('afterend', errorEl);
789 vote.style.display = 'none';
790 }
791
792 if (type === 'multi') {
793 var existingErrorEl = vote.querySelector('.t-vote__errorbox');
794
795 if (existingErrorEl) t_removeEl(existingErrorEl);
796
797 var errorEl = "<div class='t-vote__errorbox'><div class='t-vote__errorbox-text t-text t-text_xs t-align_center' style='background-color:#F95D51;color:#fff;padding:20px;margin:30px 0px;'>" + errorText + '</div></div>';
798 var btnsSendVote = vote.querySelectorAll('.js-sendvote-btn');
799
800 btnsSendVote[btnsSendVote.length - 1].insertAdjacentHTML('beforebegin', errorEl);
Предыдущие 100 строкСледующие 100 строк