/* SAN AVELIO - PROFILE PATCH v7 Fixes dossier avatar sharpness and restores native links inside copied profile data. Independent of 12993/70119. */ (function(){ 'use strict'; if(!/\/profile\.php$/i.test(location.pathname)) return; function plainView(){ var p=new URLSearchParams(location.search); return !p.has('section')&&!p.has('action')&&!p.has('edit')&&!p.has('p')&&!p.has('page')&&!p.has('mode')&&!p.has('form'); } function css(){ if(document.getElementById('sa-profile-v7-fixes'))return; var s=document.createElement('style');s.id='sa-profile-v7-fixes'; s.textContent=` /* Keep the official 180x250 avatar at its native size: never enlarge it. */ #sa-dossier-clean .portrait img, #sa-dossier-clean .sa-portrait img, #sa-dossier-clean .avatar img{ width:180px!important;height:250px!important; min-width:180px!important;min-height:250px!important; max-width:180px!important;max-height:250px!important; object-fit:cover!important; image-rendering:auto!important; filter:none!important; transform:none!important; } /* Links copied from the hidden native profile must stay visibly clickable. */ #sa-dossier-clean a.sa-native-copy-link{ pointer-events:auto!important;cursor:pointer!important; color:inherit!important;text-decoration:none!important; position:relative!important;z-index:20!important; } #sa-dossier-clean a.sa-native-copy-link:hover{text-decoration:underline!important} `; document.head.appendChild(s); } function normalizeText(s){return (s||'').replace(/\s+/g,' ').trim().toLowerCase()} function nativeRoot(){ var main=document.getElementById('pun-main'); if(!main)return null; /* 70119 hides the original Rusff profile but leaves it in DOM. */ var candidates=main.querySelectorAll('a[href]'); return candidates.length?main:null; } function findNativeLink(label){ var root=nativeRoot();if(!root)return ''; var want=normalizeText(label); var as=root.querySelectorAll('a[href]'); for(var i=0;i=0) return as[i].href; } return ''; } function repairCopiedLinks(){ if(!plainView())return; var d=document.getElementById('sa-dossier-clean');if(!d)return; css(); /* Repair text fragments that 70119 copied as plain text. */ var map=[ ['\u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u0432\u0441\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f','\u041f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u0432\u0441\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f'], ['\u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u0432\u0441\u0435 \u0442\u0435\u043c\u044b','\u041f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u0432\u0441\u0435 \u0442\u0435\u043c\u044b'] ]; var walker=document.createTreeWalker(d,NodeFilter.SHOW_TEXT); var nodes=[],n;while(n=walker.nextNode())nodes.push(n); map.forEach(function(pair){ var href=findNativeLink(pair[1]);if(!href)return; nodes.forEach(function(node){ if(node.parentElement&&node.parentElement.closest('a'))return; var raw=node.nodeValue||'', low=raw.toLowerCase(), needle=pair[0]; var idx=low.indexOf(needle);if(idx<0)return; var frag=document.createDocumentFragment(); frag.appendChild(document.createTextNode(raw.slice(0,idx))); var a=document.createElement('a');a.className='sa-native-copy-link';a.href=href; a.textContent=raw.slice(idx,idx+needle.length);frag.appendChild(a); frag.appendChild(document.createTextNode(raw.slice(idx+needle.length))); node.parentNode.replaceChild(frag,node); }); }); } function sharpenAvatar(){ if(!plainView())return; var d=document.getElementById('sa-dossier-clean');if(!d)return; css(); /* Prefer the real native avatar URL rather than any enlarged/cached decorative copy. */ var root=nativeRoot(), nativeImg=null; if(root){ var imgs=root.querySelectorAll('img'); for(var i=0;i