1document.addEventListener('DOMContentLoaded', function () { 2 (function(document){ 3 var __yaCounterID = '79988056', // YandexCounter ID / ÐденÑиÑикаÑÐ¾Ñ ÑÐ½Ð´ÐµÐºÑ ÑÑеÑÑика 4 __googleID = '', 5 __debug = true, 6 __init = true; // Console log debug 7 8 /* Example set goal / ÐÑÐ¸Ð¼ÐµÑ ÑÑÑановки Ñели 9 __setGoal('button', 'click', 'buttonClick'); 10 */ 11 function __EventGoals() { 12 if(!__init) __init = true; else return false; 13 if(__debug) { 14 var __text = __yaCounterID && __googleID == '' ? 'YandexCounter' : (__yaCounterID == '' && __googleID ? 'GoogleCounter' : 'Yandex and Google') 15 console.log("(" + __text + ": " + __yaCounterID + " " + __googleID + ") - inited"); 16 } 17 /* Goals / Цели */ 18 __setGoal('form#contactForm', 'submit', 'contactformsubmit', '', {ya: true}); 19 __setGoal('form#contactForm', 'submit', 'contactformbutton', '', {ya: true}); 20 __setGoal('[data-zapis-na-priyom]', 'click', 'data-zapis-na-priyom', '', {ya: true}); 21 __setGoal('#enable_letsee', 'click', 'enable_letsee', '', {ya: true}); 22 __setGoal('form#questionForm', 'submit', 'questionformsubmit', '', {ya: true}); 23 __setGoal('form#questionForm button', 'click', 'questionformbutton', '', {ya: true}); 24 25 //__setGoal('#order form input[type=submit]', 'submit', 'form-call', '', {google: true, action: 'click-button'}); 26 27 /* End goals / ÐÐ¾Ð½ÐµÑ Ñели */ 28 } 29 30 /* Do not edit / Ðе ÑедакÑиÑоваÑÑ */ 31 32 var __EventCounterInited = "yacounter" + __yaCounterID + "inited", 33 __Counter = "yaCounter" + __yaCounterID, 34 __nameSetGoal = "__setGoal" + __yaCounterID, 35 __functionName = "gaInit_" + __googleID, 36 __ajaxSearch = []; 37 38 function __CheckCounter() { 39 if(__yaCounterID && typeof window[__Counter] !== 'undefined' && __googleID == '') { 40 __EventGoals(); 41 } 42 if(__googleID && typeof window['ga'] !== 'undefined' && __yaCounterID == '') { 43 __EventGoals(); 44 } 45 if(__googleID && __yaCounterID && typeof window[__Counter] !== 'undefined' && typeof window['ga'] !== 'undefined') { 46 __EventGoals(); 47 } 48 } 49 50 if(typeof window[__Counter] == 'undefined') { 51 document.addEventListener(__EventCounterInited, __CheckCounter, false); 52 } else { 53 __CheckCounter(); 54 } 55 56 var __functionGoogle = function () { 57 __CheckCounter(); 58 } 59 60 if (!Element.prototype.matches) { 61 Element.prototype.matches = Element.prototype.matchesSelector || Element.prototype.webkitMatchesSelector || Element.prototype.mozMatchesSelector || Element.prototype.msMatchesSelector; 62 } 63 64 if(typeof XMLHttpRequest !== 'undefined') { 65 var requestOpen = XMLHttpRequest.prototype.open; 66 XMLHttpRequest.prototype.open = function() { 67 this.addEventListener('load', function(ProgressEvent) { 68 var _json = '', _text = '', _count = __ajaxSearch.length; 69 if(_count) { 70 try { 71 _json = JSON.parse(this.responseText); 72 } catch (e) {} 73 if(typeof _json == 'object') { 74 _text = JSON.stringify(_json); 75 } else { 76 _text = this.responseText; 77 } 78 var div = document.createElement("div"); 79 div.innerHTML = _text; 80 _text = div.textContent || div.innerText || ""; 81 for(i = 0; i < _count; i++) { 82 if(__Contains(__ajaxSearch[i].selector, __ajaxSearch[i].search).length && _text.indexOf(__ajaxSearch[i].search) !== -1) { 83 if(__yaCounterID && (__ajaxSearch[i].params.google && __ajaxSearch[i].params.google != true)) { 84 try { 85 window[__Counter].reachGoal(__ajaxSearch[i].goal, __ajaxSearch[i].params, __ajaxSearch[i].callback); 86 } catch (e) { 87 console.log("(Yandex Counter: " + __yaCounterID + ") Error reachGoal: " + e.message); 88 } 89 if(__debug) { 90 console.log("(Yandex Counter: " + __yaCounterID + ") AjaxGoal: goal: " + __ajaxSearch[i].goal +", selector: " + __ajaxSearch[i].selector + ", search: " + __ajaxSearch[i].search); 91 } 92 } 93 if(__googleID && (__ajaxSearch[i].params.ya && __ajaxSearch[i].params.ya != true)) { 94 try { 95 if('action' in __ajaxSearch[i].params) { 96 window['ga']('send', 'event', __ajaxSearch[i].goal, __ajaxSearch[i].params.action); 97 } else { 98 console.log("(Google counter: " + __googleID + ") Error reachGoal: Empty action"); 99 } 100 } catch (e) { 101 console.log("(Google counter: " + __googleID + ") Error reachGoal: " + e.message); 102 } 103 if(__debug) { 104 console.log("(Google Counter: " + __googleID + ") AjaxGoal: goal: " + __ajaxSearch[i].goal +", selector: " + __ajaxSearch[i].selector + ", search: " + __ajaxSearch[i].search); 105 } 106 } 107 } 108 } 109 } 110 }); 111 requestOpen.apply(this, arguments); 112 }; 113 } 114 115 function __Contains(selector, text) { 116 var elements = document.querySelectorAll(selector); 117 return Array.prototype.filter.call(elements, function(element){ 118 return RegExp(text).test(element.textContent); 119 }); 120 } 121 122 /** 123 * Sets the goal of the YandexCounter / УÑÑÐ°Ð½Ð°Ð²Ð»Ð¸Ð²Ð°ÐµÑ ÑÐµÐ»Ñ Ð¯Ð½Ð´ÐµÐºÑÐеÑÑики 124 * @param {String} selector - DOM query selector 125 * @param {String} event - Event for the DOM elements 126 * @param {String} goal - YandexCounter goal 127 * @param {Object} params - Params for goal, more details by reference https://yandex.ru/support/metrika/data/visit-params.html 128 * @param {Function} callback - callback for goal 129 * @return {undefined} 130 */ 131 function __setGoal(selector, event, goal, ajaxSearch, params, callback) { 132 params = params ? params : {}; 133 callback = callback ? callback : null; 134 ajaxSearch = ajaxSearch ? ajaxSearch : null; 135 136 if(ajaxSearch) { 137 __ajaxSearch.push({selector:selector, search: ajaxSearch, goal: goal, params: params, callback: callback}); 138 } 139 140 /*var element = document.querySelectorAll(selector), 141 onevent = 'on' + event; 142 for(var i = 0; i < element.length; i++) { 143 144 var _eventtext = "", 145 _attr = element[i].getAttribute(onevent); 146 _attr = _attr ? _attr : ""; 147 148 if(__yaCounterID && (!params.google || (params.google && params.google != true))) { 149 _eventtext = __Counter + ".reachGoal('" + goal + "');"; 150 } 151 if(__googleID && (!params.ya || (params.ya && params.ya != true))) { 152 _eventtext = "ga('send', 'event', '" + goal + "', '" + params.action + "');"; 153 } 154 element[i].setAttribute(onevent, _eventtext + _attr); 155 156 }*/ 157 158 document.addEventListener(event, function(e) { 159 for (var target=e.target; target && target!=this; target=target.parentNode) { 160 if (target.matches(selector)) { 161 if(__yaCounterID && (!params.google || (params.google && params.google != true))) { 162 try { 163 window[__Counter].reachGoal(goal, params, callback); 164 } catch (e) { 165 console.log("(Yandex Counter: " + __yaCounterID + ") Error reachGoal: " + e.message); 166 } 167 if(__debug) { 168 console.log("(Yandex Counter: " + __yaCounterID + ") Event: " + event + ", goal: " + goal +", selector: " + selector); 169 } 170 } 171 if(__googleID && (!params.ya || (params.ya && params.ya != true))) { 172 try { 173 if('action' in params) { 174 window['ga']('send', 'event', goal, params.action); 175 } else { 176 console.log("(Google counter: " + __googleID + ") Error reachGoal: Empty action"); 177 } 178 } catch (e) { 179 console.log("(Google counter: " + __googleID + ") Error reachGoal: " + e.message); 180 } 181 if(__debug) { 182 console.log("(Google Counter: " + __googleID + ") Event: " + event + ", goal: " + goal +", selector: " + selector); 183 } 184 } 185 } 186 } 187 }, true); 188 } 189 190 window[__nameSetGoal] = __setGoal; 191 window[__functionName] = __functionGoogle; 192 }(document, window)); 193});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.