1(function(){ 2 function arregla(){ 3 var l=document.getElementById('logopcfutbolmania'); 4 if(l&&!l.getAttribute('alt')) l.setAttribute('alt','PCFutbolMania - inicio'); 5 var m=document.querySelector('main,#content,.container'); 6 if(m&&!document.querySelector('.pcfm-salto')){ 7 if(!m.id) m.id='pcfm-contenido'; 8 m.setAttribute('tabindex','-1'); 9 var a=document.createElement('a'); 10 a.className='pcfm-salto'; a.href='#'+m.id; a.textContent='Saltar al contenido'; 11 document.body.insertBefore(a,document.body.firstChild); 12 } 13 var nb=document.querySelector('.navbar'); 14 if(nb&&nb.tagName!=='NAV'&&!nb.getAttribute('role')){nb.setAttribute('role','navigation');nb.setAttribute('aria-label','Principal');} 15 var sf=document.querySelector('form[action*="search.php"]'); 16 if(sf&&!sf.getAttribute('role')) sf.setAttribute('role','search'); 17 var t=document.querySelector('.navbar-header:not(.pull-right) > .navbar-toggle'); 18 if(t){ if(!t.hasAttribute('aria-expanded')) t.setAttribute('aria-expanded','false'); 19 t.addEventListener('click',function(){ 20 var e=t.getAttribute('aria-expanded')==='true'; 21 t.setAttribute('aria-expanded',e?'false':'true'); 22 }); 23 } 24 var bt=document.getElementById('pcfm-tema'); 25 if(bt){ var o=document.documentElement.classList.contains('pcfm-oscuro'); 26 bt.setAttribute('aria-pressed',o?'true':'false'); 27 bt.addEventListener('click',function(){ 28 setTimeout(function(){ 29 bt.setAttribute('aria-pressed',document.documentElement.classList.contains('pcfm-oscuro')?'true':'false'); 30 },0); 31 }); 32 } 33 var av=document.querySelectorAll('.post_avatar a img, .author_avatar a img'); 34 for(var i=0;i<av.length;i++){ av[i].setAttribute('alt',''); av[i].setAttribute('aria-hidden','true'); } 35 var ic=document.querySelectorAll('img'); 36 for(var j=0;j<ic.length;j++){ 37 var im=ic[j]; 38 if(im.hasAttribute('alt')) continue; 39 var src=im.getAttribute('src')||''; 40 if(/ficons|icon_|folder|status|jump|buddy|star|rating|separator|spacer/i.test(src)){ im.setAttribute('alt',''); im.setAttribute('aria-hidden','true'); } 41 else { im.setAttribute('alt',''); } 42 } 43 var sin=document.querySelectorAll('input:not([type=hidden]),select,textarea'); 44 for(var s=0;s<sin.length;s++){ 45 var cc=sin[s]; 46 if(cc.id&&document.querySelector('label[for="'+CSS.escape(cc.id)+'"]')) continue; 47 if(cc.getAttribute('aria-label')||cc.closest('label')) continue; 48 var et=cc.getAttribute('placeholder')||cc.getAttribute('title')||cc.name||cc.value; 49 if(cc.type==='checkbox'&&!et) et='Seleccionar elemento'; 50 if(cc.type==='submit'&&!et) et='Enviar'; 51 if(et) cc.setAttribute('aria-label',String(et).replace(/[_\[\]]/g,' ').trim()); 52 } 53 var tb=document.querySelectorAll('table'); 54 for(var k=0;k<tb.length;k++) if(!tb[k].querySelector('th')&&!tb[k].hasAttribute('role')) tb[k].setAttribute('role','presentation'); 55 var hs=document.querySelectorAll('#posts h1[aria-label]'); 56 for(var n=0;n<hs.length;n++){ 57 var h=hs[n], s=document.createElement('h2'); 58 s.setAttribute('aria-label',h.getAttribute('alt')||h.getAttribute('aria-label')); 59 s.style.cssText=h.style.cssText; s.innerHTML=h.innerHTML; 60 h.parentNode.replaceChild(s,h); 61 } 62 } 63 if(document.readyState==='loading') document.addEventListener('DOMContentLoaded',arregla); else arregla(); 64})(); 65(function(){ 66 function texto(e){ return (e.textContent||'').replace(/\s+/g,' ').trim(); } 67 function accesible(){ 68 var n=0; 69 // 1) autocompletado en credenciales 70 var mapa=[['username','username'],['password','current-password'],['email','email'], 71 ['email2','email'],['password2','new-password'],['regcheck1','off'],['answer','off']]; 72 for(var i=0;i<mapa.length;i++){ 73 var c=document.querySelectorAll('input[name="'+mapa[i][0]+'"]'); 74 for(var j=0;j<c.length;j++) if(!c[j].getAttribute('autocomplete')) c[j].setAttribute('autocomplete',mapa[i][1]); 75 } 76 var reg=document.querySelector('form[action*="do_register"],input[name="regcheck1"]'); 77 if(reg){ 78 var np=document.querySelectorAll('input[name="password"],input[name="password2"]'); 79 for(var k=0;k<np.length;k++) np[k].setAttribute('autocomplete','new-password'); 80 } 81 // 2) etiquetas: div.formbit_label -> label for=... 82 var etiquetas=document.querySelectorAll('.formbit_label'); 83 for(var m=0;m<etiquetas.length;m++){ 84 var d=etiquetas[m]; 85 if(d.tagName==='LABEL'||d.getAttribute('data-pcfm')) continue; 86 var caja=d.parentElement, campo=null; 87 for(var t=0;t<3&&caja&&!campo;t++){ 88 campo=caja.querySelector('input:not([type=hidden]):not([type=checkbox]):not([type=radio]),textarea,select'); 89 caja=caja.parentElement; 90 } 91 if(!campo) continue; 92 if(!campo.id) campo.id='pcfm_c'+m; 93 var l=document.createElement('label'); 94 l.className=d.className; l.setAttribute('for',campo.id); l.setAttribute('data-pcfm','1'); 95 l.innerHTML=d.innerHTML; d.parentNode.replaceChild(l,d); n++; 96 } 97 // 3) controles sin nombre accesible 98 var sin=document.querySelectorAll('input:not([type=hidden]),select,textarea'); 99 for(var q=0;q<sin.length;q++){ 100 var c2=sin[q]; 101 if(c2.id&&document.querySelector('label[for="'+c2.id+'"]')) continue; 102 if(c2.getAttribute('aria-label')||c2.closest('label')) continue; 103 var ph=c2.getAttribute('placeholder')||c2.getAttribute('title')||c2.name; 104 if(ph) c2.setAttribute('aria-label',ph.replace(/[_\[\]]/g,' ').trim()); 105 } 106 // 4) un h1 por pagina si no lo hay 107 if(!document.querySelector('h1')){ 108 // el primer .thead de la pagina es el del formulario de acceso oculto: 109 // hay que quedarse con el primero VISIBLE dentro del contenido 110 var origen=null; 111 var cands=document.querySelectorAll('main .tborder > .thead, #content .tborder > .thead, main .thead'); 112 for(var c=0;c<cands.length;c++){ 113 var e=cands[c]; 114 if(e.offsetParent===null) continue; 115 var tx=texto(e); 116 if(!tx || /iniciar sesi|acceder|login/i.test(tx)) continue; 117 origen=e; break; 118 } 119 var titulo=origen?texto(origen):document.title.split('|')[0].split(' - ')[0].trim(); 120 if(titulo){ 121 var h=document.createElement('h1'); 122 h.className='pcfm-h1'; h.textContent=titulo; 123 h.style.cssText='position:absolute;
123left:-9999px;width:1px;height:1px;overflow:hidden'; 124 var dest=document.querySelector('main')||document.body; 125 dest.insertBefore(h,dest.firstChild); 126 } 127 } 128 return n; 129 } 130 if(document.readyState==='loading') document.addEventListener('DOMContentLoaded',accesible); else accesible(); 131})(); 132(function(){ 133 function menu(){ 134 var c=document.querySelector('.navbar-ex1-collapse'); 135 var t=document.querySelector('.navbar-header:not(.pull-right) > .navbar-toggle'); 136 if(!t||!c) return; 137 var v=document.querySelector('.pcfm-velo'); 138 if(!v){ v=document.createElement('div'); v.className='pcfm-velo'; document.body.appendChild(v); } 139 function abierto(){ return c.classList.contains('in')||c.classList.contains('collapsing'); } 140 function sincroniza(){ document.body.classList.toggle('pcfm-menu-abierto', c.classList.contains('in')); } 141 t.addEventListener('click', function(){ setTimeout(sincroniza,10); setTimeout(sincroniza,320); }); 142 v.addEventListener('click', function(){ if(abierto()) t.click(); }); 143 document.addEventListener('keydown', function(e){ if(e.keyCode===27&&abierto()) t.click(); }); 144 new MutationObserver(sincroniza).observe(c,{attributes:true,attributeFilter:['class']}); 145 } 146 if(document.readyState==='loading') document.addEventListener('DOMContentLoaded',menu); else menu(); 147})(); 148/* === Acabado visual 11: en movil, el ultimo mensaje va al final de la fila === */ 149(function(){ 150 function reordena(){ 151 if(window.innerWidth>767) return; 152 var filas=document.querySelectorAll('.rowbit'); 153 for(var i=0;i<filas.length;i++){ 154 var h=filas[i].querySelector('h4'); 155 if(!h) continue; 156 var ult=h.querySelector(':scope > span.hidden-lg.hidden-md.hidden-sm:not(.forum_status):not([class*="ficons_"])'); 157 if(!ult||ult.getAttribute('data-pcfm-mov')) continue; 158 var caja=h.parentElement; 159 if(!caja) continue; 160 ult.setAttribute('data-pcfm-mov','1'); 161 caja.appendChild(ult); 162 } 163 } 164 if(document.readyState==='loading') document.addEventListener('DOMContentLoaded',reordena); else reordena(); 165})(); 166 167/* === Cierre del cajon pulsando fuera (sin velo que capture pulsaciones) === */ 168(function(){ 169 document.addEventListener('click', function(e){ 170 if(window.innerWidth>767) return; 171 var c=document.querySelector('.navbar-ex1-collapse'); 172 var t=document.querySelector('.navbar-header:not(.pull-right) > .navbar-toggle'); 173 if(!c||!t||!c.classList.contains('in')) return; 174 if(c.contains(e.target)||t.contains(e.target)||e.target===t) return; 175 t.click(); 176 }, true); 177})(); 178 179/* === Calendario: "N Cumpleaños" no cabe en una celda; se abrevia === */ 180(function(){ 181 function cumples(){ 182 var celdas=document.querySelectorAll('.calendar_weekrow>div span.clear a'); 183 for(var i=0;i<celdas.length;i++){ 184 var a=celdas[i]; 185 if(a.getAttribute('data-pcfm-cump')) continue; 186 var t=(a.textContent||'').trim(); 187 var m=t.match(/^(\d+)\s*Cumplea/i); 188 if(!m) continue; 189 a.setAttribute('data-pcfm-cump','1'); 190 a.setAttribute('title', m[1]+' cumpleaños'); 191 a.textContent='ð '+m[1]; 192 } 193 } 194 if(document.readyState==='loading') document.addEventListener('DOMContentLoaded',cumples); else cumples(); 195})(); 196 197/* === Fichas de subforo: quitar las comas que separaban los enlaces === */ 198(function(){ 199 function limpia(){ 200 var bloques=document.querySelectorAll('.rowbit:not(.inline_row) .forumbit_subforums'); 201 for(var i=0;i<bloques.length;i++){ 202 var b=bloques[i]; 203 if(b.getAttribute('data-pcfm-sub')) continue; 204 b.setAttribute('data-pcfm-sub','1'); 205 var ns=b.childNodes; 206 for(var j=ns.length-1;j>=0;j--){ 207 var n=ns[j]; 208 if(n.nodeType===3 && /^[\s,]*$/.test(n.textContent) && n.textContent.indexOf(',')>=0){ 209 n.parentNode.removeChild(n); 210 } 211 } 212 } 213 } 214 if(document.readyState==='loading') document.addEventListener('DOMContentLoaded',limpia); else limpia(); 215})(); 216 217/* === Portal sin anuncios: la barra lateral pasa a ocupar todo el ancho === */ 218(function(){ 219 function portal(){ 220 var fila=document.querySelector('.rowbit.portal_row'); 221 if(!fila) return; 222 var principal=fila.querySelector('[class*="col-sm-10"], [class*="col-md-10"]'); 223 if(!principal) return; 224 var util=(principal.textContent||'').trim().length; 225 if(util<20 && principal.getBoundingClientRect().height<60){ 226 fila.classList.add('pcfm-portal-solo'); 227 principal.style.display='none'; 228 } 229 } 230 if(document.readyState==='loading') document.addEventListener('DOMContentLoaded',portal); else portal(); 231})();
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.