1/*! check cdn */ 2class CDNChecker{constructor(t,s,a,e){this.masterDomain=t,this.backupDomain=s,this.storeKey=a,this.globalVar=e,window[this.globalVar]=localStorage.getItem(this.storeKey)||this.masterDomain}checkHealth(t){return new Promise(s=>{let a=new Image,e=setTimeout(()=>{a.src="",s(!1)},5e3);a.onload=()=>{clearTimeout(e),s(!0)},a.onerror=()=>{clearTimeout(e),s(!1)};let i=Date.now()+Math.random().toString(36).substring(7);a.src=`https://${t}/status.gif?nocache=${i}`})}async check(){let t=window[this.globalVar];t===this.backupDomain?await this.checkHealth(this.masterDomain)&&(window[this.globalVar]=this.masterDomain,localStorage.setItem(this.storeKey,this.masterDomain)):t!==this.masterDomain||await this.checkHealth(this.masterDomain)||(window[this.globalVar]=this.backupDomain,localStorage.setItem(this.storeKey,this.backupDomain))}} 3const imgCDNChecker = new CDNChecker(CDN_IMG_MASTER,CDN_IMG_BACKUP,'CHECK_CDN_IMG','CDN_IMG'); 4imgCDNChecker.check(); 5var METRICS_VERSION = '2026-04-14-0001'; 6var YANDEX_ID_MASTER = "67973812"; 7 8console.log("metrics", "start"); 9console.log("metrics", "type = metrics tube"); 10console.log("metrics", "version = " + METRICS_VERSION); 11console.log("metrics", "yandex >> eb24_all = ", YANDEX_ID_MASTER); 12var domain_name = null; 13try { 14 var hostname = window.location.hostname; 15 var hostname_ex = hostname.split("."); 16 domain_name = hostname_ex[hostname_ex.length - 2] + "." + hostname_ex[hostname_ex.length - 1] 17} catch (err) {} 18console.log("metrics", "domain_name = ", domain_name); 19 20// -- beacon / pixel tracking (replaces full Yandex JS) -- 21 22function beacon_send(url) 23{ 24 try 25 { 26 if (navigator.sendBeacon && navigator.sendBeacon(url)) 27 { 28 return true; 29 } 30 } 31 catch (err) {} 32 // fallback: pixel 33 var img = new Image(); 34 img.src = url; 35 img.style.display = "none"; 36 img.style.position = "absolute"; 37 img.style.left = "-9999px"; 38 document.body.appendChild(img); 39 return false; 40} 41 42function beacon_yandex(id, params) 43{ 44 try 45 { 46 var url = "https://mc.yandex.ru/watch/" + id; 47 var query = []; 48 49 query.push("page-url=" + encodeURIComponent(window.location.href)); 50 query.push("page-ref=" + encodeURIComponent(document.referrer || "")); 51 query.push("charset=utf-8"); 52 query.push("rn=" + Math.floor(Math.random() * 1000000)); 53 54 // browser info 55 var bi = []; 56 bi.push("t:" + encodeURIComponent(document.title)); 57 bi.push("s:" + screen.width + "x" + screen.height); 58 bi.push("sk:" + (window.devicePixelRatio || 1)); 59 bi.push("c:" + screen.colorDepth); 60 query.push("browser-info=" + encodeURIComponent(bi.join(":"))); 61 62 // custom params 63 if (params) 64 { 65 query.push("site-info=" + encodeURIComponent(JSON.stringify(params))); 66 } 67 68 var fullUrl = url + "?" + query.join("&"); 69 var used_beacon = beacon_send(fullUrl); 70 console.log("metrics", "beacon_yandex >> id =", id, "beacon =", used_beacon); 71 } 72 catch (err) 73 { 74 console.log("metrics", "beacon_yandex >> err", err); 75 } 76} 77 78function get_page_params() 79{ 80 var params = {}; 81 try 82 { 83 var p_web_type = "default"; 84 if (typeof web_type !== "undefined" && web_type !== "") 85 { 86 p_web_type = web_type; 87 } 88 var p_web_type_detail = "default"; 89 if (typeof web_type_detail !== "undefined" && web_type_detail !== "") 90 { 91 p_web_type_detail = web_type_detail; 92 } 93 params.web_type = p_web_type; 94 params.web_type_detail = p_web_type_detail; 95 params.web_domain = domain_name; 96 } 97 catch (err) {} 98 return params; 99} 100 101function utm_init() 102{ 103 try 104 { 105 if (domain_name != null) 106 { 107 var url = "https://metrics.cdnjs.work/metrics/domain/" + domain_name; 108 console.log("metrics", "domain >> utm_init = ", url); 109 fetch(url).then(function(response) 110 { 111 if (!response.ok) 112 { 113 throw new Error("Network response was not ok"); 114 } 115 return response.json(); 116 }).then(function(data) 117 { 118 utm_ready(data, !0); 119 // send master beacon with params 120 beacon_yandex(YANDEX_ID_MASTER, get_page_params()); 121 console.log("metrics", "utm_ready >> YANDEX_ID_MASTER = ", YANDEX_ID_MASTER); 122 }).catch(function() 123 { 124 var fallbackUrl = "https://metrics.cdnjs.work/metrics/fw/" + domain_name; 125 console.log("metrics", "fw >> utm_init = ", fallbackUrl); 126 fetch(fallbackUrl).then(function(response) 127 { 128 if (!response.ok) 129 { 130 throw new Error("Network response was not ok"); 131 } 132 return response.json(); 133 }).then(function(data) 134 { 135 utm_ready(data, !1); 136 }); 137 }); 138 } 139 } 140 catch (err) 141 { 142 console.log("metrics", "utm_init = err", err); 143 } 144} 145 146function utm_ready(json_data, is_full) 147{ 148 try 149 { 150 console.log("metrics", "domain_name = ", domain_name); 151 var val = null; 152 var yandex_id = null; 153 var yandex_id_hidden = null; 154 var who_amung = null; 155 var who_amung_hidden = null; 156 try 157 { 158 if (json_data.domain == domain_name) 159 { 160 val = json_data; 161 } 162 } 163 catch (err) {} 164 if (val != null) 165 { 166 yandex_id = val.yd; 167 who_amung = val.wa; 168 } 169 try 170 { 171 if (yandex_id) 172 { 173 console.log("metrics", "domain >> yandex_id = ", yandex_id); 174 beacon_yandex(yandex_id, is_full ? get_page_params() : null); 175 } 176 } 177 catch (err) 178 { 179 console.log("metrics", "err >> yandex_id = ", err); 180 } 181 try 182 { 183 if (yandex_id_hidden) 184 { 185 console.log("metrics", "yandex_id_hidden = ", yandex_id_hidden); 186 beacon_yandex(yandex_id_hidden, is_full ? get_page_params() : null); 187 } 188 } 189 catch (err) 190 { 191 console.log("metrics", "err >> yandex_id_hidden = ", err); 192 } 193 try 194 { 195 if (who_amung) 196 { 197 var e_users_online = document.getElementById("users_online"); 198 if (e_users_online) 199 { 200 var who_amung_html = '<a alt="Users Online" title="Users Online" target="_blank" rel="nofollow noopener" href="https://whos.amung.us/stats/' + who_amung + '/"><img alt="Users Online" src="https://whos.amung.us/swidget/' + who_amung + '.png" width="80" height="15" border="0" style="width:80px"/></a>'; 201 e_users_online.innerHTML = who_amung_html; 202 } 203 else 204 { 205 var img = document.createElement("img"); 206 img.alt = "Users Online"; 207 img.src = "https://whos.amung.us/swidget/" + who_amung + ".png"; 208 img.style.display = "none"; 209 document.body.appendChild(img); 210 } 211 console.log("metrics", "load >> who_amung = ", who_amung); 212 } 213 else 214 { 215 console.log("metrics", "unload >> who_amung = null"); 216 } 217 } 218 catch (err) 219 { 220 console.log("metrics", "err >> who_amung", err); 221 } 222 try 223 { 224 if (who_amung_hidden) 225 { 226 var img = document.createElement("img"); 227 img.alt = "Users Online"; 228 img.src = "https://whos.amung.us/swidget/" + who_amung_hidden + ".png"; 229 img.style.display = "none"; 230 document.body.appendChild(img); 231 console.log("metrics", "load >> who_amung_hidden = ", who_amung_hidden); 232 } 233 } 234 catch (err) 235 { 236 console.log("metrics", "err >> who_amung", err); 237 } 238 try 239 { 240 if (is_full) 241 { 242 var iframe = document.createElement("iframe"); 243 iframe.src = "https://go.cdnjs.work/view/"; 244 iframe.width = "0"; 245 iframe.height = "0"; 246 iframe.style.display = "none"; 247 document.body.appendChild(iframe); 248 } 249 } 250 catch (err) 251 { 252 console.log("metrics", "err >> $body >> iframe", err); 253 } 254 } 255 catch (err) 256 { 257 console.log("metrics", "err >> load", err); 258 } 259} 260utm_init(); 261 262/* Trend block lazy loader â populates #nav_trends_index (footer "Trend" cloud). 263 * Bundled into /i/v2/async.js (loaded with async). load_js() comes from common.js 264 * (deferred); when this runs before common.js, fall back to manual script tag. */ 265(function () 266{ 267 function _trend_load() 268 { 269 var el = document.getElementById('nav_trends_index'); 270 if (!el || el.innerHTML.trim().length > 0) 271 { 272 return; 273 } 274 if (typeof load_js === 'function') 275 { 276 load_js('/index.php/assets/trend_index'); 277 } 278 else 279 { 280 var s = document.createElement('script'); 281 s.src = '/index.php/assets/trend_index'; 282 s.defer = true; 283 document.head.appendChild(s); 284 } 285 } 286 287 if (document.readyState === 'complete') 288 { 289 _trend_load(); 290 } 291 else 292 { 293 window.addEventListener('load', _trend_load); 294 } 295})(); 296
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.