Каталог файловtilda-t806-quiz-1.0.js
601 });602 603 var buttonsVote = rec.querySelectorAll('.t806__answer .t-vote__btn-res');604 Array.prototype.forEach.call(buttonsVote, function (buttonVote) {605 buttonVote.classList.remove('t806__answer-vote_show');606 });607 608 var counter = rec.querySelector('.t806__counter');609 counter.setAttribute('data-count', 0);610 611 var numbers = rec.querySelectorAll('.t806__number');612
История файла и сравнение версий
Array.prototype.forEach.call(numbers, function (number) {
613 number.textContent = 1 + '/' + questions.length; 616 t806_fixcontentheight(recid); 618 event.preventDefault(); 624function t806_scrollToTop(rec) { 625 var blockContainer = rec.querySelector('.t806'); 626 var topCoordinate = rec.getBoundingClientRect().top + window.pageYOffset; 627 if (topCoordinate >= window.scrollY || blockContainer.classList.contains('t806_scroll-disabled')) return; 629 window.scrollTo(0, topCoordinate); 633function t806__clearFormOnBackClick(rec) { 634 window.addEventListener('pagehide', function () { 635 var inputs = rec.querySelectorAll('.t806__input'); 636 Array.prototype.forEach.call(inputs, function (input) { 637 input.checked = false; 643function t806_fixcontentheight(recid) { 644 /* correct cover height if content more when cover height */ 645 var rec = document.querySelector('#rec' + recid); 646 var cover = rec.querySelector('.t-cover'); 648 var coverFilter = rec.querySelector('.t-cover__filter'); 649 var coverCarrier = rec.querySelector('.t-cover__carrier'); 650 var coverWrapper = rec.querySelector('.t-cover__wrapper'); 651 var content = rec.querySelector('div[data-hook-content]'); 652 if (!content) return; 653 var coverHeight = parseFloat(getComputedStyle(cover, null).height.replace('px', '')); 654 var contentHeight = content.offsetHeight; 655 if (contentHeight > 300 && coverHeight < contentHeight) { 656 contentHeight = contentHeight + 120; 657 if (contentHeight > 1000) { 658 contentHeight += 100; 660 cover.style.height = contentHeight + 'px'; 661 coverFilter.style.height = contentHeight + 'px'; 662 coverCarrier.style.height = contentHeight + 'px'; 663 coverWrapper.style.height = contentHeight + 'px'; 664 if (!/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) { 665 setTimeout(function () { 666 var video = coverCarrier; 667 var videoIframe = video.querySelector('iframe'); 668 if (videoIframe.length > 0) { 669 setWidthAndHeightVideo(video, contentHeight + 'px', 'youtube'); 677function t806_changeShareFBUrl(siteLocation, searchUrl) { 678 var url = siteLocation.split('?')[0] + '?'; 679 var searchParameters = decodeURIComponent(searchUrl.substring(1)); 680 var parameters = searchParameters.split('&'); 682 parameters.forEach(function (parameter) { 683 if (parameter.indexOf('fb_action_ids') == -1 && parameter.indexOf('fb_action_types') == -1 && parameter.indexOf('result') == -1) { 684 url = url + parameter + '&'; 688 url = url.substring(0, url.length - 1); 693function t806_shareVK(recid, ptitle, purl) { 694 var dataForShare = t806__showResult(recid); 695 var text = dataForShare[0]; 696 var count = dataForShare[1]; 697 var slash = (dataForShare[2] || '').indexOf('/') == 0 ? '' : '/'; 698 var urlPathname = window.location.pathname.length > 1 ? window.location.pathname : ''; 699 var img = (dataForShare[2] || '').indexOf('://') != -1 ? dataForShare[2] : window.location.protocol + '//' + window.location.host + urlPathname + slash + dataForShare[2]; 700 var resultNumber = dataForShare[3];