Usuario:Chixpy/WSS1/reversion.js

De Inciclopedia
Ir a la navegación Ir a la búsqueda

Nota: Después de publicar, quizás necesite actualizar la caché de su navegador para ver los cambios.

  • Firefox/Safari: Mantenga presionada la tecla Shift mientras pulsa el botón Actualizar, o presiona Ctrl+F5 o Ctrl+R (⌘+R en Mac)
  • Google Chrome: presione Ctrl+Shift+R (⌘+Shift+R en Mac)
  • Internet Explorer/Edge: mantenga presionada Ctrl mientras pulsa Actualizar, o presione Ctrl+F5
  • Opera: Presiona Ctrl+F5.
/*
* Fuente: http://en.wikipedia.org/wiki/Usuario:Lorian/monobook.js
* Personalizada por Axxgreazz, para el [http://es.wikipedia.org/wiki/Usuario:Axxgreazz/Monobook-Suite Monobook-Suite]
* Modificada por Chixpy para su uso en [http://inciclopedia.wikia.com/wiki/User:Chixpy/WSS1 Inciclopedia] (y otras wikis de wikia).

<pre><nowiki> */


// Revert tools
function getElementsByClass(searchClass,node,tag) {
  // Function from http://www.dustindiaz.com/getelementsbyclass/
  var classElements = new Array();
  if ( node == null )
    node = document;
  if ( tag == null )
    tag = '*';
  var els = node.getElementsByTagName(tag);
  var elsLen = els.length;
  var pattern = new RegExp("(^|\\s)"+searchClass+"(\\s|$)");
  for (i = 0, j = 0; i < elsLen; i++) {
    if ( pattern.test(els[i].className) ) {
      classElements[j] = els[i];
      j++;
    }
  }
  return classElements;
}

// _GET code from NoGray JS Library http://www.nogray.com/new_site/
var _GET = new Array();
var _uri = location.href;

var _temp_get_arr = _uri.substring(_uri.indexOf('?')+1, _uri.length).split("&");

var _temp_get_arr_1 = new Array();

for(_get_arr_i=0; _get_arr_i<_temp_get_arr.length; _get_arr_i++){
  _temp_get_arr_1 = _temp_get_arr[_get_arr_i].split("=");
  _GET[decodeURI(_temp_get_arr_1[0])] = decodeURI(_temp_get_arr_1[1]);
}

delete _uri; delete _temp_get_arr; delete _temp_get_arr_1;

function getMessage (where, user1, user2) {
  var message = prompt ('¿Qué mensaje deseas dejar?', '');
  window.location = 'http://'+ location.hostname + '/index.php?title=' + _GET['title'] + '&action=edit&oldid=' + _GET['oldid'] + '&'+where+'=2&user1='+user1+'&user2='+user2+'&message='+message;
}

addOnloadHook(function (){
  if (location.href.match(/diff=/)) {
    // Get username of submitter
    var user1 = getElementsByClass('diff-otitle',null,'td'); user1 = user1[0].getElementsByTagName('a')[2].innerHTML;
    var user2 = getElementsByClass('diff-ntitle',null,'td'); user2 = user2[0].getElementsByTagName('a')[3].innerHTML;
    document.getElementById('contentSub').innerHTML = '(<a href="http://'+ location.hostname + '/index.php?title=' + _GET['title'] + '&action=edit&oldid=' + _GET['oldid'] +
 '&revert=1&user1='+user1+'&user2='+user2+'">Revertir</a> / <a href="javascript:var message = getMessage(\'revert\', \''+user1+'\', \''+user2+'\');">Mensaje</a>)' +

/* DESACTIVANDO MENSAJES AUTOMÁTICOS

' (Avisos a usuarios: <a href="http://'+ location.hostname + 
'/index.php?title=User_talk:'+user2+'&action=edit&warn=1">Prueba</a> / <a href="http://'+ location.hostname + '/index.php?title=User_talk:'+user2+'&action=edit&warn=2">No WP</a> / <a href="http://'+ location.hostname + '/index.php?title=User_talk:'+user2+'&action=edit&warn=3">Blanqueo</a> / <a href="http://'+ location.hostname + '/index.php?title=User_talk:'+user2+'&action=edit&warn=4">Detente</a> / <a href="http://'+ location.hostname + '/index.php?title=User_talk:'+user2+'&action=edit&warn=5">Última advertencia</a> / <a href="http://'+ location.hostname + '/index.php?title=User_talk:'+user2+'&action=edit&warn=6">Bloqueo</a>)'+

*/

'';
  } else if (location.href.match(/revert=1/)) {
    document.getElementById('wpSummary').value = 'WSS1: Revertidos los cambios de [[User:'+_GET['user2']+'|'+_GET['user2']+']] a la versión ' + _GET['oldid']+' de [[User:'+_GET['user1']+'|'+_GET['user1']+']]';
    document.getElementById('editform').submit();
  } else if (location.href.match(/revert=2/)) {
    document.getElementById('wpSummary').value = 'WSS1: Revertido de [[User:' + _GET['user2'] + '|]] a ' + _GET['user1'] + '(' +_GET['message']+ ')';
    document.getElementById('editform').submit();
  }

/* DESACTIVANDO LOS MENSAJES AUTOMÁTICOS

    else if (location.href.match(/warn=1/)) {
    document.getElementById('wpSummary').value = 'WSS1: Aviso de que no haga pruebas en los artículo al usuario';
    document.getElementById('wpTextbox1').value = document.getElementById('wpTextbox1').value + '{' + '{AvisoPrueba}} ~~'+'~~';
    document.getElementById('editform').submit();
  } else if (location.href.match(/warn=2/)) {
    document.getElementById('wpSummary').value = 'WSS1: Aviso de que esto no copie de otros lugares al usuario';
    document.getElementById('wpTextbox1').value = document.getElementById('wpTextbox1').value + '{' + '{AvisoCopia}} ~~'+'~~';
    document.getElementById('editform').submit();
  } else if (location.href.match(/warn=3/)) {
    document.getElementById('wpSummary').value = 'WSS1: Aviso de que no blanquee al usuario';
    document.getElementById('wpTextbox1').value = document.getElementById('wpTextbox1').value + '{' + '{AvisoBlanqueo}} ~~'+'~~';
    document.getElementById('editform').submit();
  } else if (location.href.match(/warn=4/)) {
    document.getElementById('wpSummary').value = 'WSS1: Aviso de que deje de editar al usuario';
    document.getElementById('wpTextbox1').value = document.getElementById('wpTextbox1').value + '{' + '{AvisoQuieto}} ~~'+'~~';
    document.getElementById('editform').submit();
  } else if (location.href.match(/warn=5/)) {
    document.getElementById('wpSummary').value = 'WSS1: Última advertencia al usuario';
    document.getElementById('wpTextbox1').value = document.getElementById('wpTextbox1').value + '{' + '{AvisoUltimatum}} ~~'+'~~';
    document.getElementById('editform').submit();
  } else if (location.href.match(/warn=6/)) {
    document.getElementById('wpSummary').value = 'WSS1: Informando de que ha sido bloqueado al usuario';
    document.getElementById('wpTextbox1').value = document.getElementById('wpTextbox1').value + '{' + '{AvisoBloqueo}} ~~'+'~~';
    document.getElementById('editform').submit();
  }
*/
});
//</nowiki></pre>