User:Grandiosarceus/global.js

/***** Algunos códigos son del usuario Ciencia Al Poder ******/ 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 {}; }	var uv = ['base_url_SPOTLIGHT_FOOTER_1','base_url_SPOTLIGHT_FOOTER_2','base_url_SPOTLIGHT_FOOTER_3']; for (var i = 0; i < uv.length; i++) { if (typeof window[uv[i]] == 'undefined') { window[uv[i]] = 'about:blank'; }	} } 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; }

// UserWikiInfo if (!window.disableUserWikiInfo && ((window.wgNamespaceNumber == -1 && window.wgCanonicalSpecialPageName == 'Contributions') || (window.wgCanonicalNamespace == 'User' || window.wgCanonicalNamespace == 'User_talk' || window.wgCanonicalNamespace == 'Usuario_Blog'))) { if (window.wgAfterContentAndJS) { wgAfterContentAndJS.push(function {			importScript('User:Grandiosarceus/UserWikiInfo.js');		}); } else { $(function {			importScript('User:Grandiosarceus/UserWikiInfo.js');		}); } } /* WMU en Monobook */ if (window.wgAction == 'edit' || window.wgAction == 'submit') { /*GLOBAL WMU VARS*/ window.wmu_back = "volver"; window.wmu_imagebutton = "Agregar imágenes"; window.wmu_close = "cerrar"; window.wmu_no_preview = "No se puede agregar imágenes desde la página en modo de previsualización"; window.wmu_warn1 = "Debes especificar el texto a buscar"; window.wmu_warn2 = "Selecciona primero el archivo a subir"; window.wmu_warn3 = "¡Es necesario especificar el nombre del archivo primero!"; window.wmu_bad_extension = "El tipo de archivo que intentas subir no está permitido. Puedes consultar la lista de extensiones soportadas en Especial:Version."; window.wmu_show_message = "mostrar mensaje"; window.wmu_hide_message = "ocultar mensaje"; window.wmu_show_license_message = "mostrar licencia"; window.wmu_hide_license_message = "ocultar licencia"; window.wmu_max_thumb = "Se ha superado el tamaño máximo de la miniatura. Se devolverá al tamaño original."; importScript('User:Grandiosarceus/WikiaWMU.js'); importStylesheetURI(wgExtensionsPath+'/wikia/WikiaMiniUpload/css/WMU.css?'+wgStyleVersion); } /* fin WMU en Monobook */

/* 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://pokemon.wikia.com") return; var path = 'http://www.telefonica.net/web2/martineznovo/wikidex/global.'; importScriptURI(path+'js'); importStylesheetURI(path+'css'); } // Patch 1.16 Upgrade if (!window.$) { window.$ = window.addOnloadHook; } // 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: '+e.message); window.__globalJSError = e; } // if (mwCustomEditButtons && wgNamespaceNumber == 3) { mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://www.telefonica.net/web2/martineznovo/wikidex/button_image_n.png", "speedTip": "Aviso imágenes mal nombradas", "tagOpen": "", "tagClose": " --~", "sampleText": "" };   mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://www.telefonica.net/web2/martineznovo/wikidex/button_image_i.png", "speedTip": "Aviso imágenes irrelevantes", "tagOpen": "", "tagClose": " --~", "sampleText": "" };   mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://www.telefonica.net/web2/martineznovo/wikidex/button_sigadvert.png", "speedTip": "Imagen sobre cómo firmar", "tagOpen": "", "tagClose": "", "sampleText": "" }; } if (mwCustomEditButtons && (wgNamespaceNumber % 2 != 0 || wgNamespaceNumber == 110)) { mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://www.telefonica.net/web2/martineznovo/wikidex/button_sigtag.png", "speedTip": "Plantilla Nofirmado", "tagOpen": "", "sampleText": "" }; } // Params if (window.postloadFunctionData){ postloadFunctionData['charinsert']["Plantillas misc."] = ], , , , [], , [], ];   postloadFunctionData['charinsert']["Plantillas útiles"] = [[,], [; } // WikEd if (!window.wikEdConfig) {	window.wikEdConfig = {}; } wikEdConfig.focusEdit = false; wikEdConfig.mainEditCSS = {'.wikEdEditOptions':}; /* wikEdConfig.comboPresetOptions = {}; wikEdConfig.comboPresetOptions['summary'] = [ 'CEM', 'cat', 'CDN', 'renombrando imágenes', , ,  ]; wikEdConfig.comboPresetOptions['find'] = [ '\n +', 'wiked' ]; wikEdConfig.comboPresetOptions['replace'] = [ '\n', '\'\'\'wikEd\'\'\ ]; // define  custom buttons (id, class, popup title, image src, width, height, alt text, onClick and parameters) if (!wikEdConfig.button) wikEdConfig.button = []; wikEdConfig.button[100] = ['wikEdwdPlantillaS', 'wikEdButton', 'Transforma sprites usando la plantilla ', 'http://www.telefonica.net/web2/martineznovo/wikidex/WikEd_S.png', '16', '16', , 'javascript:WikEdEditButton(this, this.id, null, WikEdFuncionesExtra.PlantillaS);' ]; wikEdConfig.button[101] = ['wikEdwdPlantillaT', 'wikEdButton', 'Transforma tipos usando la plantilla undefined', 'http://www.telefonica.net/web2/martineznovo/wikidex/WikEd_T.png', '16', '16', 'undefined', 'javascript:WikEdEditButton(this, this.id, null, WikEdFuncionesExtra.PlantillaT);' ]; wikEdConfig.button[102] = ['wikEdwdErroresComunes', 'wikEdButton', 'Errores comunes WikiDex', 'http://www.telefonica.net/web2/martineznovo/wikidex/WikEd_Fix.png', '16', '16', 'WikiDex', 'javascript:WikEdEditButton(this, this.id, null, WikEdFuncionesExtra.ErroresComunes);' ]; // define custom button bars (id outer, class outer, id inner, class inner, height, grip title, button numbers) if (!wikEdConfig.buttonBar) wikEdConfig.buttonBar = {}; wikEdConfig.buttonBar['custom2'] = ['wikEdButtonBarCustom2',  'wikEdButtonBarCustom2',  'wikEdButtonsCustom2',  'wikEdButtonsCustom2',  44, 'Personales', [100, 101, 'br', 102] ]; WikEdFuncionesExtra = {    ReplaceCfg: {        PlantillaS: {            find:[                /\[\[Aa]rchivo|[Ff]ile)[\x20_]*:[\x20_]*([a-zA-Z]+|Ho-Oh|Mr\.[\x20_]Mime|Mime[\x20_]Jr\.|Farfetch'd|Porygon2|Porygon-Z|Nidoran♀|Nidoran♂)[\x20_](Pt|DP|OCPA|HGSS|NB)\.png[\x20_]*(\|[^\+)?\]\]/g,                /\[\[Aa]rchivo|[Ff]ile)[\x20_]*:[\x20_]*([a-zA-Z]+|Ho-Oh|Mr\.[\x20_]Mime|Mime[\x20_]Jr\.|Farfetch'd|Porygon2|Porygon-Z|Nidoran♀|Nidoran♂)[\x20_](Pt|DP|OCPA|HGSS|NB)[\x20_]hembra\.png[\x20_]*(\|[^\+)?\]\]/g,            ],            replace:[                ,                            ]        },        PlantillaT: {            find:[                /\[\[Ff]ile|[Ii]magen|[Ii]mage)[\x20_]*:[\x20_]*[Tt]ipo[\x20_]([a-záéíóú]+)\.gif[\x20_]*([^\+)?\]\]/g,				/\[\[Imagen:Tipo\x20\{\{lc:([a-zA-Záéíóú]+)\}\}\.gif\|link=Tipo\x20\{\{lc:\1\}\}\|Tipo\x20\{\{lc:\1\}\}\]\]/g            ],            replace:[                '$2',                '$1'            ]        },        ErroresComunes: {            find: [                /(g)imnacio/ig,                /perla y diamante/ig,                /jhoto/ig,                /pok[eÉé]m[oó]n(s|es)?/ig            ],            replace: [                '$1imnasio',                'Diamante y Perla',                'Johto',                'Pokémon'            ]        }    },    CommonReplace: function(obj, btnId) {        if (typeof(WikEdFuncionesExtra.ReplaceCfg[btnId]) == 'undefined') {            return;        }        // select the appropriate text change target (whole, selection, cursor, focusWord, focusLine, selectionWord, or selectionLine)        //   focus... is the text under the cursor; ...Word and ...Line extend the target to the start/end of the word or line        WikEdGetText(obj, 'whole, selection');        if (obj.selection.plain != ) {            obj.changed = obj.selection;        } else {            obj.changed = obj.whole;        }        var rObj = WikEdFuncionesExtra.ReplaceCfg[btnId];        for (var i = 0; i < rObj.find.length; i++) {            var f = rObj.find[i];            var r = rObj.replace[i];            // add the text formatting            obj.changed.plain = obj.changed.plain.replace(f, r);        }        // keep the changed text selected, needed to remove the formatting with a second custom button click        obj.changed.keepSel = true;        return;    },    PlantillaS: function(obj) {        WikEdFuncionesExtra.CommonReplace(obj, 'PlantillaS');    },    PlantillaT: function(obj) {        WikEdFuncionesExtra.CommonReplace(obj, 'PlantillaT');    },    ErroresComunes: function(obj) {        WikEdFuncionesExtra.CommonReplace(obj, 'ErroresComunes');    } } // Funciones function loadPersonal{    try {        addPortletLink('p-tb', '/index.php?title=Asdf&action=edit&preload=WikiDex:Modelo_Pok%C3%A9mon&editintro=WikiDex:Modelo_Pok%C3%A9mon/Instrucciones', 'Código Modelo');        addPortletLink('p-tb', window.location.toString+(window.location.toString.indexOf('?') != -1 ? '&' : '?')+'reloadjs=true&jsHashKey='+window.wgStyleVersion, 'ReloadJS');            var c = null;            if (wgAction == 'edit' || wgAction == 'submit'){                if (window.location.search.indexOf('undoafter') > 0) c = ($G('wpSummary') || $G('wpSummaryEnhanced'));                else c = $G('wpTextbox1');            }            if (c) c.focus;    } catch(e) {        alert('casque en loadPersonal\n'+e.message);    } } /////////////// // Código a ejecutar aquí: // // ** wikEd ** importScriptURI('http://en.wikipedia.org/w/index.php?title=User:Cacycle/wikEd.js&action=raw&ctype=text/javascript'); addOnloadHook(loadPersonal); // // Arreglo Especial:ListaUsuarios if (window.wgNamespaceNumber == -1 && window.wgCanonicalSpecialPageName == 'Listusers') {	importScriptURI(wgExtensionsPath+'/wikia/Listusers/js/jquery.dataTables.min.js?'+wgStyleVersion); } /* Arreglo para galerías de tipo slideshow */ function monobook_InitSlideshow {	var sld = null;	for (var it = 0; (sld = document.getElementById('slideshow-'+it.toString)) || document.getElementById('gallery-'+it.toString); it++) {		if (!sld) continue;		$.getScript(stylepath + '/common/jquery/jquery-slideshow-0.4.js?' + wgStyleVersion, function(i) {			return function {				var slideshow = $('#slideshow-'+i.toString);				var cb = function(index) {					var item = slideshow.find('li').eq(index);					if (item.attr('title')) {						item.css('backgroundImage', 'url(' + item.attr('title') + ')');						item.removeAttr('title');					}				};				//var item = slideshow.find('li').first;				var item = slideshow.find('li').eq(0);				if (item.attr('title')!='') {					item.css('backgroundImage', 'url(' + item.attr('title') + ')');				}				item.removeAttr('title');				slideshow.slideshow({					buttonsClass:'wikia-button',					nextClass:'wikia-slideshow-next',					prevClass:'wikia-slideshow-prev',					slideWidth:'300px',					slidesClass:'wikia-slideshow-images',					slideCallback: cb				});			};		}(it));	} } if (jQuery.prototype.jquery == '1.3.2') {	wgAfterContentAndJS.push(monobook_InitSlideshow); } /* fin arreglo para galerías de tipo slideshow */

wgWidgetShoutBoxId = '1';