1(function () { 2 'use strict'; 3 function safeUrl(value) { 4 try { var url = new URL(String(value || ''), location.origin); return /^https?:$/.test(url.protocol) ? url.href : ''; } catch (_) { return ''; } 5 } 6 function anchor(item, imageField, className) { 7 var href = safeUrl(item.url), src = safeUrl(item[imageField]); 8 if (!href || !src || !item[imageField]) return null; 9 var a = document.createElement('a'); 10 a.href = href; a.target = '_blank'; a.rel = 'noopener noreferrer'; a.className = className; 11 a.title = String(item.title || ''); 12 var image = document.createElement('img'); 13 image.src = src; image.alt = a.title; image.loading = 'lazy'; 14 a.appendChild(image); 15 return a; 16 } 17 function banners(id, items) { 18 var root = document.getElementById(id); 19 if (!root) return; 20 root.replaceChildren(); 21 (Array.isArray(items) ? items : []).forEach(function (item) { 22 var a = anchor(item, 'logo', 'site-banner-link'); 23 if (a) root.appendChild(a); 24 }); 25 root.hidden = !root.childElementCount; 26 } 27 window.renderSiteSections = function (data) { 28 if (!data) return; 29 var root = document.getElementById('ads-tubiao'); 30 if (root) { 31 root.replaceChildren(); 32 var grid = document.createElement('div'); grid.className = 'site-icon-grid'; 33 (Array.isArray(data.tubiao) ? data.tubiao.slice() : []).sort(function (a, b) { return (Number(b.sort) || 0) - (Number(a.sort) || 0); }).forEach(function (item) { 34 var a = anchor(item, 'logo', 'site-icon-link ad-link'); 35 if (!a) return; 36 var label = document.createElement('span'); label.textContent = String(item.title || ''); 37 a.appendChild(label); grid.appendChild(a); 38 }); 39 if (grid.childElementCount) root.appendChild(grid); 40 root.hidden = !grid.childElementCount; 41 var telegram = String(data.telegram || '').replace(/^https?:\/\/t\.me\//i, '').replace(/^@/, ''); 42 if (grid.childElementCount && /^[a-zA-Z0-9_]+$/.test(telegram)) { 43 var contact = document.createElement('a'); contact.className = 'site-ad-contact'; 44 contact.href = 'https://t.me/' + telegram; contact.target = '_blank'; contact.rel = 'noopener noreferrer'; 45 contact.textContent = 'Telegram: @' + telegram; root.appendChild(contact); 46 } 47 } 48 banners('site-banner-top', data.banner_top); 49 banners('site-banner-bottom', data.banner_foot); 50 }; 51})();
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.