1let loyaltyEventsGenerator = function ($loyaltyDOMNodes) { 2 3 const eventsList = { 4 authentication: ["idUser"], 5 addedTopic: ["idTopic", "idUser"], 6 addedMessage: ["idTopic", "idUser"], 7 visitedTopicPage: ["idTopic", "idUser"] 8 }; 9 10 $loyaltyDOMNodes.each(function (index, element) { 11 const eventType = element.dataset.eventType; 12 13 if (eventsList[eventType] === undefined) { 14 return; 15 } 16 17 const event = new Event(eventType); 18 19 for (let attribute in element.dataset) { 20 if (eventsList[eventType].includes(attribute)) { 21 event[attribute] = element.dataset[attribute]; 22 } 23 } 24 25 document.dispatchEvent(event); 26 }); 27} 28 29let loyaltyDelayedEventsPrepare = function (cookieGroupName) { 30 $J.each( 31 [...document.cookie.matchAll( 32 new RegExp("(^| )(?<cookieName>" + cookieGroupName + "\\[\\d+?\\])=(?<payload>[^;]+)", "g")) 33 ], 34 function (index, cookieMatch) { 35 const divElement = document.createElement("div"); 36 $J.each( 37 $J.parseJSON(decodeURIComponent(cookieMatch.groups.payload)), 38 function (index, value) { 39 divElement.dataset[index] = value; 40 divElement.className = "js-loyalty" 41 } 42 ); 43 $J('body').append(divElement); 44 const domainMatch = location.host.match(new RegExp("^(www|m)(?<domain>\.\\w+\.ru(.*)?)$")); 45 document.cookie = cookieMatch.groups.cookieName + '=; Max-Age=-1; path=/; domain=' + domainMatch.groups.domain; 46 } 47 ); 48} 49 50window.addEventListener("DOMContentLoaded", (event) => { 51 loyaltyDelayedEventsPrepare("loyaltyEvents"); 52 loyaltyEventsGenerator($J(".js-loyalty")); 53 54 window.addEventListener("load", function () { 55 if (typeof window["ym"] !== "undefined") { 56 (async () => { 57 ym( 58 6874273, 59 "reachGoal", 60 "ForumAuthorization", 61 { 62 "Ôîðóì": { 63 "Authorized": isAuthorized, 64 "forum_creator": await getRole(), 65 "User Loyalty": await getLoyalty() 66 } 67 } 68 ); 69 })(); 70 } 71 }); 72}, true);
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.