User:Vanished user 68167137/VANDAL-III

From Wikipedia, the free encyclopedia

Wdflake's VANDAL-III is a tool that I wrote to somewhat simplify the process of reverting vandalism. Unlike the standalone software or user javascript file, this tool is a simple javascript bookmarklet. For most users, this tool will be hopelessly inadequate, but I decided to post it here for the sake of the one person who will actually use it. The name has no special significance; I used all caps so it would stand out on my toolbar, the number 3 because its the third version, and roman numerals because they're kind of neat.

Usage[edit]

This tool only works on the diff pages. Once an editor finds a diff page where a clean copy is on the left and a vandalized copy is on the right, they merely have to click on the bookmarklet, which I recommend placing in the Bookmarks Toolbar for easy access. The tool opens another window and reverts the article to the clean version on the right. It also asks if the vandal should be warned on his user_talk page. If so, the tool inserts a {{test}} template.

Note[edit]

Currently, this page uses popup windows to achieve its functions, so popup blockers may hinder its ability to function.

Installation[edit]

To install this tool, create a bookmark with the following as its location.

javascript:(function(){var td=document.getElementById('bodyContent').getElementsByTagName('td');var editlink=td[0].getElementsByTagName('a')[1];var rvfrom=td[1].getElementsByTagName('a')[2].firstChild.nodeValue;var rvto=td[0].getElementsByTagName('a')[2].firstChild.nodeValue;var page=document.getElementsByTagName('h1')[0].firstChild.nodeValue;var edit=window.open(editlink);edit.onload=function(){edit.document.editform.wpSummary.value=%22Reverted edit(s) by %22+rvfrom+%22 to the version by %22+rvto;edit.document.editform.submit();edit.close();};if (confirm('Press OK to warn this user about vandalism')) {var usertalk=window.open('http://en.wikipedia.org/w/index.php?title=User_talk:'+rvfrom+'&action=edit&section=new');usertalk.onload=function(){usertalk.document.editform.wpSummary.value='Your edits to [['+page+']]';usertalk.document.editform.wpTextbox1.value='{{subst:Test|'+page+'}}';usertalk.document.editform.submit();usertalk.close();};}history.back();})();

Code[edit]

Because the code had to be compressed into a bookmarklet, here is the code in an easier to read format.

1   javascript:(function(){
2     var  td=document.getElementById('bodyContent').getElementsByTagName('td');
3     var editlink=td[0].getElementsByTagName('a')[1];
4     var rvfrom=td[1].getElementsByTagName('a')[2].firstChild.nodeValue;
5     var rvto=td[0].getElementsByTagName('a')[2].firstChild.nodeValue;
6     var page=document.getElementsByTagName('h1')[0].firstChild.nodeValue;
7     var edit=window.open(editlink);
8     edit.onload=function(){
9       edit.document.editform.wpSummary.value=%22Reverted edit(s) by %22+rvfrom+%22 to the version by %22+rvto;
10      edit.document.editform.submit();
11      edit.close();
12    };
13    if (confirm('Press OK to warn this user about vandalism')) {
14      var usertalk=window.open('http://en.wikipedia.org/w/index.php?title=User_talk:'+rvfrom+'&action=edit&section=new');
15      usertalk.onload=function(){
16        usertalk.document.editform.wpSummary.value='Your edits to [['+page+']]';
17        usertalk.document.editform.wpTextbox1.value='{{subst:Test|'+page+'}}';
18        usertalk.document.editform.submit();
19        usertalk.close();
20      };
21    }
22    history.back();
23  })();