/* SAN AVELIO REPUTAZIONE v5 — one native reputation row, no duplicate panel. */ (function () { 'use strict'; if (window.SAReputazioneV5) return; window.SAReputazioneV5 = true; var css = ` /* Style the EXISTING Rusff reputation row. No new panel is inserted. */ body .post-author .pa-respect, body .post .pa-respect, body li.pa-respect { display:flex!important; position:relative!important; box-sizing:border-box!important; align-items:center!important; justify-content:center!important; flex-wrap:wrap!important; gap:4px 7px!important; width:100%!important; max-width:100%!important; min-height:36px!important; margin:3px 0!important; padding:7px 5px!important; border:1px solid rgba(193,151,84,.38)!important; border-radius:3px!important; background:linear-gradient(110deg,rgba(21,64,55,.58),rgba(5,28,26,.68))!important; box-shadow:inset 0 1px 0 rgba(255,230,180,.08)!important; color:#e7c78e!important; text-align:center!important; font:11px/1.4 Georgia,'Times New Roman',serif!important; overflow:visible!important; float:none!important; clear:both!important; } body li.pa-respect .fld-name {color:#d9b77b!important;font:600 10px/1.4 Georgia,serif!important;letter-spacing:.04em!important;margin:0!important;padding:0!important} body li.pa-respect a, body li.pa-respect button {color:#f3d49b!important;cursor:pointer!important;text-decoration:none!important} body li.pa-respect a:hover,body li.pa-respect button:hover {color:#fff4d3!important} body li.pa-respect .sa-r5-score {display:inline-flex!important;align-items:center!important;justify-content:center!important;gap:5px!important;white-space:nowrap!important;font:700 12px/1 Georgia,serif!important} body li.pa-respect .sa-r5-score b {font-weight:700!important;color:#f1d5a0!important} body li.pa-respect .sa-r5-score i {font-style:normal!important;color:#9b978c!important} body li.pa-respect .sa-r5-vote {display:inline-flex!important;align-items:center!important;justify-content:center!important;min-width:23px!important;min-height:23px!important;padding:2px 5px!important;border:1px solid #b9945c!important;border-radius:4px!important;background:#1a4b3e!important;color:#f9dfad!important;box-shadow:0 1px 5px rgba(0,0,0,.25)!important} /* No styling or cloning of the post-body rating plus: it belongs to a different control. */ `; var style = document.createElement('style'); style.id = 'sa-reputazione-v5-style'; style.textContent = css; (document.head || document.documentElement).appendChild(style); function enhance(li) { if (!li || li.dataset.saR5 === '1') return; li.dataset.saR5 = '1'; /* Never invent a voting button: preserve real Rusff anchors/buttons. */ li.querySelectorAll('a,button,input[type="button"]').forEach(function (el) { var t = (el.textContent || el.value || '').trim(); if (/^\+\s*\d*$|^\+$|^\-\s*\d*$|^\-$/.test(t) || /vote|rating|respect|reputation/i.test(el.className || '')) { el.classList.add('sa-r5-vote'); } }); /* Text-only [+N/-N] can be made readable without changing native links. */ var walker = document.createTreeWalker(li, NodeFilter.SHOW_TEXT); var nodes = []; while (walker.nextNode()) { var n = walker.currentNode; if (!n.parentElement || n.parentElement.closest('a,button,script,style')) continue; if (/\[\s*\+\s*\d+\s*\/\s*-\s*\d+\s*\]/.test(n.nodeValue || '')) nodes.push(n); } nodes.forEach(function (n) { var s = n.nodeValue; var re = /\[\s*\+\s*(\d+)\s*\/\s*-\s*(\d+)\s*\]/g; var match, at = 0, frag = document.createDocumentFragment(); while ((match = re.exec(s))) { if (match.index > at) frag.appendChild(document.createTextNode(s.slice(at,match.index))); var span = document.createElement('span'); span.className = 'sa-r5-score'; var plus = document.createElement('b'); plus.textContent = '+' + match[1]; var slash = document.createElement('i'); slash.textContent = '/'; var minus = document.createElement('b'); minus.textContent = '\u2212' + match[2]; span.append(plus,slash,minus); frag.appendChild(span); at = re.lastIndex; } if (at) { if (at < s.length) frag.appendChild(document.createTextNode(s.slice(at))); n.parentNode.replaceChild(frag,n); } }); } function run() { if (!/viewtopic\.php/i.test(location.pathname)) return; document.querySelectorAll('li.pa-respect').forEach(enhance); } function start() { run(); var pending = false; var obs = new MutationObserver(function () { if (pending) return; pending = true; requestAnimationFrame(function () { pending = false; run(); }); }); obs.observe(document.body,{childList:true,subtree:true}); window.addEventListener('load',run,{once:true}); } if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded',start,{once:true}); else start(); })();