701var idUrl = recid + resultNumber + 'vk';702703var urlValueImg = 'https://vote.tildacdn.com/vote/2/share/index.php?text=' + text;704urlValueImg += '&result=' + count;705if ((dataForShare[2] || '').length > 0) {706urlValueImg += '&url=' + img;707}708urlValueImg += '&id=' + idUrl;709urlValueImg += '&social=vk' + '&name=' + ptitle;710711var timestamp = Date.now();712
var request = new XMLHttpRequest(); request.open('GET', urlValueImg, true); request.onload = function () { if (this.status >= 200 && this.status < 400) { var obj = JSON.parse(request.response); var urlImg = (obj.url || '').replace(/\?.*/, ''); var shareUrl = window.location.href.indexOf('#') != -1 ? purl.split('#')[0] : purl; var url = 'http://vkontakte.ru/share.php?url=' + shareUrl + '&title=' + ptitle + '&description=' + ptitle + '&image=' + urlImg + '&noparse=true'; t806__openPopup(url); } }; request.onerror = function () { var xhr = request.response; var ts_delta = Date.now() - timestamp; if (xhr.status == 0 && ts_delta < 100 && xhr.readyState !== 0) { alert('Request error (get posts). Please check internet connection...'); } }; request.send();}function t806_shareFB(recid, ptitle, purl) { var dataForShare = t806__showResult(recid); var text = dataForShare[0]; var count = dataForShare[1]; var slash = (dataForShare[2] || '').indexOf('/') == 0 ? '' : '/'; var urlPathname = window.location.pathname.length > 1 ? window.location.pathname : ''; var img = (dataForShare[2] || '').indexOf('://') != -1 ? dataForShare[2] : window.location.protocol + '//' + window.location.host + urlPathname + slash + dataForShare[2]; var resultNumber = dataForShare[3]; var idUrl = recid + resultNumber + 'fb'; var param = count.substring(0, count.indexOf('/')) + count.substring(count.indexOf('/') + 1); var urlValueImg = 'https://vote.tildacdn.com/vote/2/share/index.php?text=' + text; urlValueImg += '&result=' + count; if ((dataForShare[2] || '').length > 0) { urlValueImg += '&url=' + img; } urlValueImg += '&id=' + idUrl; urlValueImg += '&social=fb' + '&name=' + ptitle; var timestamp = Date.now(); var request = new XMLHttpRequest(); request.open('GET', urlValueImg, true); request.onload = function () { if (this.status >= 200 && this.status < 400) { var searchUrl = window.location.search; purl = (searchUrl !== '' ? t806_changeShareFBUrl(purl, searchUrl) : purl) + '?result=' + param; FB.ui({ method: 'share_open_graph', action_type: 'og.shares', action_properties: JSON.stringify({ object: { 'og:url': purl, }, }), }); } }; request.onerror = function () { var xhr = request.response; var ts_delta = Date.now() - timestamp; if (xhr.status == 0 && ts_delta < 100 && xhr.readyState !== 0) { alert('Request error (get posts). Please check internet connection...'); } }; request.send();}function t806_shareTwitter(recid, purl) { var rec = document.querySelector('#rec' + recid); var wrapper = rec.querySelector('.t806'); var dataForShare = t806__showResult(recid); var text = dataForShare[0]; var count = dataForShare[1]; var resultCount = count.substring(0, count.indexOf('/')); var allCount = count.substring(count.indexOf('/') + 1); var result; if (wrapper.classList.contains('t806__ru')) { result = 'Мой результат: ' + resultCount + ' из ' + allCount + '. ' + text;