User:Ciencia Al Poder-fduser/global.js

// http://lists.wikia.com/pipermail/wikia-tech-l/2009-May/000196.html if (!window.$G){ window.$G = YAHOO.util.Dom.get; }

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;

if (YAHOO.util.Cookie.get('safemode') == 'true') { safemode = true; } if (document.location.search.indexOf('safemode=true') != -1) { safemode = true; }

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 = $G('edit_enhancements_toolbar'); var eoDiv = $G('editOptions'); if (!ehTb || !eoDiv) return; var ebDiv = $G('wpDiff').parentNode; ebDiv.insertBefore($G('wpSave'),$G('wpDiff')); ebDiv.insertBefore($G('wpPreview'),$G('wpDiff')); $T.makeChildren($G('wpMinoredit').parentNode.childNodes,eoDiv); $T.makeChildren($G('wpWatchthis').parentNode.childNodes,eoDiv); $T.makeChildren([ebDiv],eoDiv); $G('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'); }