Usuario:Tomatejc/reversion.js
Apariencia
Nota: Después de guardar, debes refrescar la caché de tu navegador para ver los cambios. Internet Explorer: mantén presionada Ctrl mientras pulsas Actualizar. Firefox: mientras presionas Mayús pulsas el botón Actualizar, (o presiona Ctrl-Shift-R). Los usuarios de Google Chrome y Safari pueden simplemente pulsar el botón Recargar. Para más detalles e instrucciones acerca de otros exploradores, véase Ayuda:Cómo limpiar la caché.
//<pre>
//Fuente: http://en.wikipedia.org/wiki/Usuario:Lorian/monobook.js
//Personalizada por Axxgreazz, para el [[w:es:User:Axxgreazz/Monobook-Suite]]
//http://es.wikipedia.org/wiki/Usuario:Axxgreazz/Monobook-Suite
// 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 ('Que mensaje deseas dejar?', '');
window.location = 'http://'+ location.hostname + '/w/index.php?title=' + _GET['title'] + '&action=edit&oldid=' + _GET['oldid'] + '&'+where+'=2&user1='+user1+'&user2='+user2+'&message='+message;
}
$(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');
if (user2[0].getElementsByTagName('a')[2].href.indexOf ('undo=') != -1)
{ user2 = user2[0].getElementsByTagName('a')[3].innerHTML; }
else
{ user2 = user2[0].getElementsByTagName('a')[2].innerHTML; }
var oldid = getElementsByClass('diff-otitle',null,'td');
oldid = oldid[0].getElementsByTagName('a')[0].href.split("oldid=")[1];
document.getElementById('contentSub').innerHTML = '(<a href="http://'+ location.hostname + '/w/index.php?title=' + _GET['title'] + '&action=edit&oldid=' + _GET['oldid'] + '&revert=1&user1='+user1+'&user2='+user2+'">Rv</a> / <a href="javascript:var message = getMessage(\'revert\', \''+user1+'\', \''+user2+'\');">Mens.</a> / <a href="http://'+ location.hostname + '/w/index.php?title=' + _GET['title'] + '&action=edit&oldid=' + _GET['oldid'] + '&revert=3&user1='+user1+'&user2='+user2+'">Vand.</a> / <a href="http://'+ location.hostname + '/w/index.php?title=' + _GET['title'] + '&action=edit&oldid=' + _GET['oldid'] + '&revert=4&user1='+user1+'&user2='+user2+'">Pruebas</a> / <a href="http://'+ location.hostname + '/w/index.php?title=' + _GET['title'] + '&action=edit&oldid=' + _GET['oldid'] + '&revert=5&user1='+user1+'&user2='+user2+'">Spam</a> / <a href="http://'+ location.hostname + '/w/index.php?title=' + _GET['title'] + '&action=edit&oldid=' + _GET['oldid'] + '&revert=6&user1='+user1+'&user2='+user2+'">PVN</a> / <a href="http://'+ location.hostname + '/w/index.php?title=' + _GET['title'] + '&action=edit&oldid=' + _GET['oldid'] + '&revert=7&user1='+user1+'&user2='+user2+'">Rec. SR</a>) (Avisos: <a href="http://'+ location.hostname + '/w/index.php?title=User_talk:'+user2+'&action=edit§ion=new&warn=1">Prueba</a> / <a href="http://'+ location.hostname + '/w/index.php?title=User_talk:'+user2+'&action=edit§ion=new&warn=2">Vand.</a> / <a href="http://'+ location.hostname + '/w/index.php?title=User_talk:'+user2+'&action=edit§ion=new&warn=3">Reit.</a> / <a href="http://'+ location.hostname + '/w/index.php?title=User_talk:'+user2+'&action=edit§ion=new&warn=4">Detente</a> / <a href="http://'+ location.hostname + '/w/index.php?title=User_talk:'+user2+'&action=edit§ion=new&warn=5">Última advert.</a> / <a href="http://'+ location.hostname + '/w/index.php?title=User_talk:'+user2+'&action=edit§ion=new&warn=6">Spam</a> / <a href="http://'+ location.hostname + '/w/index.php?title=User_talk:'+user2+'&action=edit§ion=new&warn=8">PVN</a> / <a href="http://'+ location.hostname + '/w/index.php?title=User_talk:'+user2+'&action=edit§ion=new&warn=7">ME</a>)';
} else if (location.href.match(/revert=1/)) {
document.getElementById('wpSummary').value = '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 = 'Revertidos los cambios de [[User:'+_GET['user2']+'|'+_GET['user2']+']] a la versión ' + _GET['oldid']+' de [[User:'+_GET['user1']+'|'+_GET['user1']+']] ('+_GET['message']+')';
document.getElementById('editform').submit();
}
else if (location.href.match(/revert=3/)) {
document.getElementById('wpSummary').value = 'Revierto vandalismo de [[User:'+_GET['user2']+'|'+_GET['user2']+']] ([[Usuario Discusión:'+_GET['user2']+'|disc.]] · [[Especial:Contributions/'+_GET['user2']+'|contr.]])';
document.getElementById('editform').submit();
}
else if (location.href.match(/revert=4/)) {
document.getElementById('wpSummary').value = 'Revierto pruebas de [[User:'+_GET['user2']+'|'+_GET['user2']+']] ([[Usuario Discusión:'+_GET['user2']+'|disc.]] · [[Especial:Contributions/'+_GET['user2']+'|contr.]])';
document.getElementById('editform').submit();
}
else if (location.href.match(/revert=5/)) {
document.getElementById('wpSummary').value = 'Revierto posible spam de [[User:'+_GET['user2']+'|'+_GET['user2']+']] ([[Usuario Discusión:'+_GET['user2']+'|disc.]] · [[Especial:Contributions/'+_GET['user2']+'|contr.]])';
document.getElementById('editform').submit();
}
else if (location.href.match(/revert=6/)) {
document.getElementById('wpSummary').value = 'Revierto cambios de [[User:'+_GET['user2']+'|'+_GET['user2']+']] ([[Usuario Discusión:'+_GET['user2']+'|disc.]] · [[Especial:Contributions/'+_GET['user2']+'|contr.]]) por posible falta al [[WP:PVN|PVN]]';
document.getElementById('editform').submit();
}
else if (location.href.match(/revert=7/)) {
document.getElementById('wpSummary').value = 'Recupero cartel de sin relevancia eliminado por [[User:'+_GET['user2']+'|'+_GET['user2']+']] ([[Usuario Discusión:'+_GET['user2']+'|disc.]] · [[Especial:Contributions/'+_GET['user2']+'|contr.]])';
document.getElementById('editform').submit();
}
else if (location.href.match(/warn=1/)) {
document.getElementById('wpSummary').value = 'Aviso de pruebas';
document.getElementById('wpTextbox1').value = '{{sub'+'st:prueba}} ~~'+'~~';
document.getElementById('editform').submit();
} else if (location.href.match(/warn=2/)) {
document.getElementById('wpSummary').value = 'Aviso de vandalismo';
document.getElementById('wpTextbox1').value = '{{sub'+'st:Usuario:Tomatejc/Planvand}} ~~'+'~~';
document.getElementById('editform').submit();
} else if (location.href.match(/warn=3/)) {
document.getElementById('wpSummary').value = 'Aviso al usuario';
document.getElementById('wpTextbox1').value = '{{sub'+'st:prueba2a}} ~~'+'~~';
document.getElementById('editform').submit();
} else if (location.href.match(/warn=4/)) {
document.getElementById('wpSummary').value = 'Aviso al usuario';
document.getElementById('wpTextbox1').value = '{{sub'+'st:prueba3}} ~~'+'~~';
document.getElementById('editform').submit();
} else if (location.href.match(/warn=5/)) {
document.getElementById('wpSummary').value = 'Aviso al usuario';
document.getElementById('wpTextbox1').value = '{{sub'+'st:prueba4}} ~~'+'~~';
document.getElementById('editform').submit();
} else if (location.href.match(/warn=6/)) {
document.getElementById('wpSummary').value = 'Aviso de spam';
document.getElementById('wpTextbox1').value = '{{sub'+'st:Prueba0c}} ~~'+'~~';
document.getElementById('editform').submit();
}
else if (location.href.match(/warn=7/)) {
document.getElementById('wpSummary').value = 'Manual de estilo';
document.getElementById('wpTextbox1').value = '{{sub'+'st:Prueba0b}} ~~'+'~~';
document.getElementById('editform').submit();
}
else if (location.href.match(/warn=8/)) {
document.getElementById('wpSummary').value = 'Punto de vista neutral';
document.getElementById('wpTextbox1').value = '{{sub'+'st:Prueba0}} ~~'+'~~';
document.getElementById('editform').submit();
}
});
//</pre>