User:Max Schwarz/monobook.js

// addPurge $(function {    var hist; var url;    if (!(hist = document.getElementById('ca-history') )) return;    if (!(url = hist.getElementsByTagName('a')[0] )) return;    if (!(url = url.href )) return;    mw.util.addPortletLink('p-cactions', url.replace(/([?&]action=)history([&#]|$)/, '$1purge$2'), 'purge', 'ca-purge', 'Purge server cache for this page', '0'); });

/* */ //On diff pages this script replaces (Difference between revisions)with //different tools for reverting the edit and warning the user that made the edit. //For instructions see talk page. // Revert tools by Lorian 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 ('What message would you like to leave?', ''); window.location = 'http://en.wikipedia.org/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'); user2 = user2[0].getElementsByTagName('a')[3].innerHTML;    document.getElementById('contentSub').innerHTML = '(Revert / Message) (Vandalism / Message) (Warn: Test / Blatant / Nonsense / Blanking)'; } else if (location.href.match(/revert=1/)) { document.getElementById('wpSummary').value = 'Reverted edits by '+_GET['user2']+' to version ' + _GET['oldid']+' by '+_GET['user1']+''; document.getElementById('editform').submit; } else if (location.href.match(/revert=2/)) { document.getElementById('wpSummary').value = 'Reverted edits by '+_GET['user2']+' to version ' + _GET['oldid']+' by '+_GET['user1']+' ('+_GET['message']+')'; document.getElementById('editform').submit; } else if (location.href.match(/vandalism=1/)) { document.getElementById('wpSummary').value = 'Reverted vandalism by '+_GET['user2']+' to version ' + _GET['oldid']+' by '+_GET['user1']+''; document.getElementById('editform').submit; } else if (location.href.match(/vandalism=2/)) { document.getElementById('wpSummary').value = 'Reverted vandalism by '+_GET['user2']+' to version ' + _GET['oldid']+' by '+_GET['user1']+' ('+_GET['message']+')'; document.getElementById('editform').submit; } else if (location.href.match(/warn=1/)) { document.getElementById('wpSummary').value = 'Vandalism warning'; document.getElementById('wpTextbox1').value = ' '+''; document.getElementById('editform').submit; } else if (location.href.match(/warn=2/)) { document.getElementById('wpSummary').value = 'Vandalism warning'; document.getElementById('wpTextbox1').value = ' '+''; document.getElementById('editform').submit; } else if (location.href.match(/warn=3/)) { document.getElementById('wpSummary').value = 'Vandalism warning'; document.getElementById('wpTextbox1').value = ' '+''; document.getElementById('editform').submit; } else if (location.href.match(/warn=4/)) { document.getElementById('wpSummary').value = 'Vandalism warning'; document.getElementById('wpTextbox1').value = ' '+''; document.getElementById('editform').submit; } }); /* */

// wikiEd // install User:Cacycle/wikEd in-browser text editor //document.write('<script type="text/javascript" src="' //+ 'http://en.wikipedia.org/w/index.php?title=User:Cacycle/wikEd.js' //+ '&action=raw&ctype=text/javascript"></' + 'script>');

///////// Twinkle ///////////

importScript('User:AzaToth/twinkle.js');

TwinkleConfig = { //revertMaxRevisions             :       50, //userTalkPageMode               :       'window', //showSharedIPNotice             :       true, //openTalkPage                   :       [ 'agf', 'norm', 'vand' ], //openTalkPageOnAutoRevert       :       false, //openAOLAnonTalkPage            :       false, //summaryAd                      :       " using TW", //deletionSummaryAd              :       " using TW", //protectionSummaryAd            :       " using TW", //watchSpeedyPages               :       [ 'g3', 'g5', 'g10', 'g11', 'g12' ], //watchProdPages                 :       true, //openUserTalkPageOnSpeedyDelete :       [ 'g1', 'g2', 'g10', 'g11', 'g12', 'a1', 'a7', 'i3', 'i4', 'i5', 'i6', 'i7', 'u3', 't1' ], watchRevertedPages             :       [ 'torev' ], //markRevertedPagesAsMinor       :       [ 'agf', 'norm', 'vand', 'torev' ], //deleteTalkPageOnDelete         :       false, //watchWarnings                  :       true, //markAIVReportAsMinor           :       true, //markSpeedyPagesAsMinor         :       true, //offerReasonOnNormalRevert      :       true, //orphanBacklinksOnSpeedyDelete  :       {orphan:true, exclude:['g6']} };