User:Bola/global.js

/** userRights (for Bureaucrats only) **/ addOnloadHook(function {    if (wgNamespaceNumber != 2 && wgNamespaceNumber != 3)  // User or User talk        return;    var user = wgTitle.split("/")[0];    var url = wgScript + "?title=Special:UserRights&user=" + encodeURIComponent(user);    addPortletLink("p-tb", url, "User rights", "t-userrights", "List of user groups for "+user); });

importScriptPage('Usuario:Bola/global.js', 'es.helpers');

/** Nuevo botón para página de discusión **/

if (typeof(mwCustomEditButtons) != 'undefined') {

mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://upload.wikimedia.org/wikipedia/commons/e/ec/Button_aviso.png", "speedTip": "Respondido en", "tagOpen": "", "tagClose": "", "sampleText": "Muy buenas, el mensaje que dejaste en mi discusión ha sido respondido allí, por favor, visita la página para revisar la respuesta."}; }

/* Created by User:Grunny, modify by User:Cizagna */ (function($){if(typeof window.grQuickAdopt!=='undefined'){return false;} window.grQuickAdopt={version:'0.1',init:function{if(wgCanonicalSpecialPageName==='Contributions'){var $qaLink=$('').attr('title',grQuickAdopt.langMsg('adopt-tooltip')).attr('style','cursor: pointer').text(grQuickAdopt.langMsg('adopt-link-text')).click(grQuickAdopt.quicklyAdopt);$('#contentSub > a:last').after(' | ',$qaLink);}},langConfig:{userLang:false,es:{'adopt-reason':'Adoptando el wiki','adopt-tooltip':'Da a este usuario el cargo de Administrador','adopt-link-text':'QAdopt','adopt-success-text':'Adopción exitosa'}},langMsg:function(name){if(grQuickAdopt.langConfig.userLang&&wgUserLanguage in grQuickAdopt.langConfig&&name in grQuickAdopt.langConfig[wgUserLanguage]){return grQuickAdopt.langConfig[wgUserLanguage][name];} if(wgContentLanguage in grQuickAdopt.langConfig&&name in grQuickAdopt.langConfig[wgContentLanguage]){return grQuickAdopt.langConfig[wgContentLanguage][name];} return grQuickAdopt.langConfig.es[name];},quicklyAdopt:function{var quickRightsUser=$('input[name="target"]').val,addRights='sysop',rightsReason=grQuickAdopt.langMsg('adopt-reason'),tokenUrl=wgServer+wgScriptPath+'/api.php?action=query&list=users&ususers='+encodeURIComponent(quickRightsUser)+'&ustoken=userrights&format=json';$.getJSON(tokenUrl,function(data){var urToken=data.query.users[0].userrightstoken,rightsChangeUrl=wgServer+wgScriptPath+'/api.php?action=userrights&user='+encodeURIComponent(quickRightsUser) +'&add='+addRights+'&reason='+encodeURIComponent(rightsReason)+'&format=json&token='+encodeURIComponent(urToken);$.post(rightsChangeUrl,function{$('#contentSub').after(' '+grQuickAdopt.langMsg('adopt-success-text')+' ');grQuickAdopt.checkIfUserPageExists;});});},checkIfUserPageExists:function{var checkingUrl=wgServer+wgScriptPath+'/api.php?action=query&prop=revisions&meta=siteinfo&titles=User:'+wgUserName+'&format=json';$.getJSON(checkingUrl,function(data){for(var p in data.query.pages){break;} if(p!=='-1'){return false;} grQuickAdopt.getEditToken;});},getEditToken:function{var editTokenUrl=wgServer+wgScriptPath+'/api.php?action=query&prop=info|revisions&intoken=edit&titles=Main%20Page&format=json',editSummary='Creando página de usuario',editPageName='User:'+wgUserName;if(!window.grUserPageText){return false;} $.getJSON(editTokenUrl,function(data){for(var p in data.query.pages){break;} var editToken=data.query.pages[p].edittoken;grQuickAdopt.makeAPIEdit(editPageName,editSummary,grUserPageText,editToken);});},makeAPIEdit:function(editPageName,editSummary,editContent,editToken){$.ajax({url:wgScriptPath+'/api.php?',data:'action=edit&title='+encodeURIComponent(editPageName)+'&summary='+encodeURIComponent(editSummary) +'&text='+encodeURIComponent(editContent)+'&format=json&token='+encodeURIComponent(editToken),dataType:'json',type:'POST',success:function(data){if(data.edit.result==='Success'){var editId=data.edit.newrevid;$('div.successbox').append(' Página de usuario a sido creada');}else{alert('Error: Resultado API desconocido.');}},error:function(xhr){alert('Error: Edición fallida.');}});}};$(document).ready(grQuickAdopt.init);})(jQuery);