User:Ciencia Al Poder-fduser/global.js

function disableAnnoyingJSErrors{ if (!window.urchinTracker) urchinTracker = function{}; if (!window.__utmSetVar) __utmSetVar = function{}; if (!window.quantserve) quantserve = function{}; if (!window.GS_googleAddAdSenseService) GS_googleAddAdSenseService = function{}; if (!window.GA_googleAddSlot) GA_googleAddSlot = function{}; if (!window.GA_googleFetchAds) GA_googleFetchAds = function{}; if (!window.GA_googleFillSlot) GA_googleFillSlot = function{}; if (!window.GS_googleEnableAllServices) GS_googleEnableAllServices = function{}; if (!window.GA_googleAddAttr) GA_googleAddAttr = function{}; if (!window.GA_googleAddAdSensePageAttr) GA_googleAddAdSensePageAttr = function{}; if (window.YAHOO && YAHOO.Wikia && YAHOO.Wikia.Tracker) YAHOO.Wikia.Tracker.init = function{}; }

if (typeof(window.safemode) == 'undefined') window.safemode = false;

var logBox;

function log(message){ if (!window.logBox){ logBox = document.createElement('textarea'); logBox.id = 'logBox'; document.getElementById('bodyContent').appendChild(logBox); }	logBox.value = logBox.value + message + "\n-\n\n"; }

function show_props(objeto, nombreobjeto){ n = nombreobjeto||'o'; var resultado = ""; for (propiedad in objeto){ try{ resultado += n + '.' + propiedad + ' = ' + objeto[propiedad] + '\n'; } catch(e){} }	return resultado; }

/* Evita el envío del formulario al pulsar 'enter' en el resumen */ function anulaSubmitOnEnter{ var input = document.getElementById('wpSummary'); if (!input) return; $E._simpleAdd(input, 'keypress', escapeEnterInput, 0); }

function escapeEnterInput(e){ if (e.keyCode == 13){ if (e.preventDefault) e.preventDefault; else e.returnValue = false; } }

function addZeroEditSectionLink{ if (wgNamespaceNumber == -1 || wgAction != 'view') return; var s = $T.create('span', {'class':'editsection',style:'float:none;position:absolute;'}); var a = $T.create('a', {href: wgScript+'?title='+wgPageName+'&action=edit&section=0', title:'Editar la sección inicial'}, 'editar'); $T.makeChildren([document.createTextNode('['),a,document.createTextNode(']')],s); (document.getElementById('content')||document.getElementById('article')).getElementsByTagName('h1')[0].appendChild(s); }

function restoreEditSaveButtons{ var ehTb = $('edit_enhancements_toolbar'); var eoDiv = $('editOptions'); if (!ehTb || !eoDiv) return; var ebDiv = $('wpDiff').parentNode; ebDiv.insertBefore($('wpSave'),$('wpDiff')); ebDiv.insertBefore($('wpPreview'),$('wpDiff')); $T.makeChildren($('wpMinoredit').parentNode.childNodes,eoDiv); $T.makeChildren($('wpWatchthis').parentNode.childNodes,eoDiv); $T.makeChildren([ebDiv],eoDiv); $('wpSummary').setAttribute('style', 'width: 80% ! important'); ehTb.appendChild(eoDiv); ehTb.removeChild(ehTb.getElementsByTagName('ul')[0]); $E.removeListener(window, 'resize', EditEnhancements);

}

function nullifyEditEnhancements{ window.EditEnhancements = function{}; window.EditEnhancementsLoad = function{}; if (window.EditEnhancementsPreview){ window.EditEnhancementsPreview.onEvent = function{}; window.EditEnhancementsPreview.loop = function{}; if (window.EditEnhancementsPreview.interval) clearInterval(window.EditEnhancementsPreview.interval); } }

// Ejecutar aquí try{ if (!window.safemode){ disableAnnoyingJSErrors; nullifyEditEnhancements; addOnloadHook(anulaSubmitOnEnter); addOnloadHook(addZeroEditSectionLink); if (wgAction == 'edit' || wgAction == 'submit') $E.onDOMReady(restoreEditSaveButtons); $E.onDOMReady(nullifyEditEnhancements); } }catch(e){ alert('Casque en el onload Global.js'); }