701errorText = 'Что-то пошло не так и голосование не может корректно работать. Пожалуйста, попробуйте другой браузер, отключите режим инкогнито или обратитесь к владельцу сайта.';702} else {703errorText = "Something went wrong and vote doesn't work correctly. Please, try another browser, unlock private mode or write to website owner.";704}705if (data['error'] == 1) {706if (window.t_vote__browserLang === 'RU') {707errorText = 'С этого IP недавно голосовали. Пожалуйста, подождите 10 минут и попробуйте еще раз.';708} else {709errorText = 'Somebody has recently voted from this IP. Please wait 10 minutes and try again.';710}711
} if (data['error'] == 2) { if (window.t_vote__browserLang === 'RU') { errorText = 'С вашего IP адреса приходит слишком много запросов к серверу. Сервер временно не может принимать голоса с этого IP. Пожалуйста, попробуйте еще раз позже.'; } else { errorText = "There are too many votes from your IP. Server temporarily can't get votes from this IP. Please, try again later."; } } if (data['error'] == 4) { if (window.t_vote__browserLang === 'RU') { errorText = 'Извините, но голос удалить уже нельзя. Удалить голос можно только в течение 30 минут после активации.'; } else { errorText = "Sorry, but you can't delete vote now. You can delete votes just during 30 minutes after activation."; } } if (data['error'] == 5) { if (window.t_vote__browserLang === 'RU') { errorText = 'С вашего IP запросы приходят слишком часто. Пожалуйста, подождите 7 секунд прежде чем выбирать ответы в слудующих голосованиях на странице.'; } else { errorText = 'Votes are sended too often from your IP. Please wait 7 seconds between choosing answers in different votes.'; } } t_vote__showError(opts.voteID, errorText);}/** * Add in document captcha */function addTildaCaptcha() { var voteCaptchaBox = document.querySelector('#tildavotecaptchabox'); if (voteCaptchaBox) t_removeEl(voteCaptchaBox); 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>'); window.removeEventListener('message', checkVerifyTildaVoteCaptcha); window.addEventListener('message', checkVerifyTildaVoteCaptcha);}/** * Checks captcha verification * * @param {MouseEvent} event - event * @returns {undefined} - exit function */function checkVerifyTildaVoteCaptcha(event) { var voteCaptchaBox = document.querySelector('#tildavotecaptchabox'); if (event.origin.indexOf('vote.tildaapi.' + t_vote__getRootZone()) !== -1) { if (voteCaptchaBox) t_removeEl(voteCaptchaBox); if (event.data === 'closeiframe') return; t_vote__itemSend_continue(window.tvote_opts, event.data); }}/** * Show block with a text error * * @param {string} voteID - id group vote * @param {string} errorText - error text */function t_vote__showError(voteID, errorText) { if (!errorText) { if (window.t_vote__browserLang === 'RU') { errorText = 'Что-то пошло не так и голосование может работать некорректно. Пожалуйста, проверьте соединение с интернетом или обратитесь к владельцу сайта.'; } else { errorText = "Something went wrong and vote doesn't work correctly. Please, check your internet connection or write to website owner."; } } var vote = document.querySelector('[data-vote-id="' + voteID + '"]'); var type = vote.getAttribute('data-vote-type'); if (!type || type === 'single') { 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>'; vote.insertAdjacentHTML('afterend', errorEl); vote.style.display = 'none'; } if (type === 'multi') { var existingErrorEl = vote.querySelector('.t-vote__errorbox'); if (existingErrorEl) t_removeEl(existingErrorEl); 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>'; var btnsSendVote = vote.querySelectorAll('.js-sendvote-btn'); btnsSendVote[btnsSendVote.length - 1].insertAdjacentHTML('beforebegin', errorEl);