User:Dpc01/rv.js

/* Utilizável sob a licença GNU GPL Autor: pt:user:Dpc01 */

function revert { var linkprev = document.getElementById('BodyContent').getElementsByTagName('td')[0].getElementsByTagName('a')[0]; var linknext = document.getElementById('BodyContent').getElementsByTagName('td')[1].getElementsByTagName('a')[0]; if (linkprev) { linkprev.outerHTML = linkprev.outerHTML + ' [Salvar]'; }	if (linknext) { linknext.outerHTML = linknext.outerHTML + ' [Salvar]'; } }

function confirmRevert(url) { var pgid = url.match(/oldid=([\d]+)/); if(confirm("Deseja mesmo reverter para "+pgid[1]+"?")) { document.location = url +'&action=edit&rv=1'; } else { return; } }

function submitRevert { //Preenche sumário e submete edição var pgid = location.href.match(/oldid=([\d]+)/); document.forms['editform'].wpSummary.value = 'Revert to edition ' + pgid[1]; document.forms['editform'].submit; }

window.onload = Main; function Main { if(location.href.match(/&diff=/))	revert; if(location.href.match(/&rv=1/))	submitRevert; }