xhr.open('POST', opts.url + 'delete/', true);
614 xhr.onload = function() { 615 if (xhr.status >= 200 && xhr.status < 400) { 616 var data = xhr.responseText; 619 opts.voteEl.classList.remove('js-vote-sending'); 620 opts.voteEl.classList.remove('t-vote_loading'); 622 var objData = JSON.parse(data); 624 if (typeof objData === 'object') { 625 if (!objData['error']) { 626 opts.voteEl.classList.remove('js-vote-sended'); 627 opts.voteEl.classList.remove('t-vote_sended'); 628 t_vote__removeSendCookie(objData, opts); 630 t_vote__changeVoteCondition(opts, 'add'); 631 opts.voteEl.classList.add('t-vote_sended'); 632 t_vote__handleServerError(objData, opts); 635 t_vote__showError(opts.voteID, ''); 638 t_vote__showError(opts.voteID, ''); 641 t_vote__showError(opts.voteID, ''); 645 xhr.onerror = function() { 647 console.log('Fatal error: ' + xhr); 648 t_vote__showError(opts.voteID, ''); 657 * @param {object} data - request result 658 * @param {object} opts - data params vote 660function t_vote__removeSendCookie(data, opts) { 661 if (data['message'] === 'ok') { 666 t_vote__setCookie('vote' + data['voteid'], opts.voteHash, options); 667 t_vote__setCookie('voteresult' + data['voteid'], '', options); 668 t_vote__setCookie('vote_candelete' + data['voteid'], '', options); 673 * Add loading class in vote block 675 * @param {Node} voteBlock - vote block 677function t_vote__addLoadingStyle(voteBlock) { 678 setTimeout(function () { 679 if (voteBlock.classList.contains('js-vote-sending')) { 680 voteBlock.classList.add('t-vote_loading'); 686 * Text assignment depending on the error code 688 * @param {object} data - request result 689 * @param {object} opts - data params vote 690 * @returns {undefined} - exit function 692function t_vote__handleServerError(data, opts) { 693 if (data['error'] == 6) { 694 window.tvote_opts = opts; 700 if (window.t_vote__browserLang === 'RU') {