User:Ciencia Al Poder-fduser/global.js

function disableAnnoyingJSErrors { var fn = ['urchinTracker','__utmSetVar','quantserve','GS_googleAddAdSenseService','GA_googleAddSlot', 'GA_googleFetchAds','GA_googleFillSlot','GS_googleEnableAllServices','GA_googleAddAttr','GA_googleAddAdSensePageAttr', 'GA_googleFillSlotWithSize','GA_googleUseIframeRendering','COMSCORE'];

for (var i = 0; i < fn.length; i++) { if (typeof window[fn[i]] == 'undefined') { window[fn[i]] = function {}; }	}	/*extra*/ if (typeof window.COMSCORE.beacon == 'undefined') { window.COMSCORE.beacon = function {}; } }

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

if (document.cookie.indexOf('safemode=true') != -1) { safemode = true; } if (document.location.search.indexOf('safemode=true') != -1) { safemode = true; }

var logBox;

function log(message) { if (!window.logBox){ $('#bodyContent').append(' '); }	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 { $('#wpSummary').keypress(function(e) {		if (e.which == 13) return false;	}); }

function addZeroEditSectionLink { if (wgNamespaceNumber == -1 || wgAction != 'view') return; $('#content h1,#article h1,#user_masthead_head h2').eq(0).append(' [editar] '); //Aprovecho para quitar el de Wikia $('#article').find('span.editsection-upper').remove; }

function restoreEditSaveButtons { var ehTb = $('#edit_enhancements_toolbar'); var eoDiv = $('#editOptions'); if (!ehTb.exists || !eoDiv.exists) return; $('#wpMinoredit').parent.eq(0).children.appendTo(eoDiv); $('#wpWatchthis').parent.eq(0).children.appendTo(eoDiv); $('#wpDiff').before($('#wpSave')).before($('#wpPreview')).parent.eq(0).appendTo(eoDiv); $('#wpSummary').attr('style','width:80% !important;'); ehTb.append(eoDiv).attr('class', 'color1 clearfix').removeAttr('style').find('ul').remove; $('#editpage-copywarn').removeAttr('style'); $('#wpTextbox1').css('width','100%'); }

// Blame Wikia developers for making so DIRTY code!!! using "this" inside an object (not a class) function nullifyEditEnhancements { if (window.EditEnhancementsLoad) { window.EditEnhancementsLoad = function{}; }	if (window.EditEnhancements) { $(window).unbind( 'resize', EditEnhancements ); window.EditEnhancements = function{}; }	if (window.EditEnhancementsPreview){ EditEnhancementsPreview.timestamp = 0; EditEnhancementsPreview.calculate = function{}; EditEnhancementsPreview.onEvent = function{}; EditEnhancementsPreview.loop = function{}; if (window.EditEnhancementsPreview.interval) clearInterval(window.EditEnhancementsPreview.interval); if (window.interval) clearInterval(window.interval); } }

function restoreWatchlistLink { if (!$('#header_watchlist').exists) { $('#header_mytalk').before('Seguimiento \n'); } }

function loadPersonalGlobals{ if (wgServer == "http://es.pokemon.wikia.com" || wgServer == "http://pokemon.wikia.com") return; var path = 'http://www.telefonica.net/web2/martineznovo/wikidex/global.'; importScriptURI(path+'js'); importStylesheetURI(path+'css'); }

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