Advertisement
Joeytje50

Untitled

Oct 8th, 2012
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function ajaxBatchDeleteAPage( title, reason ) {
  2.     var url =  wgServer + wgScriptPath + '/api.php?action=query&prop=info&intoken=delete|protect&titles=' + encodeURIComponent( title ) + '&format=json';
  3.     $.getJSON( url, function( data ) {
  4.         for ( var p in data.query.pages ) {
  5.             break;
  6.         }
  7.         var DT = data.query.pages[p].deletetoken,
  8.             PT = data.query.pages[p].protecttoken,
  9.             url1 = wgServer + wgScriptPath + '/api.php?title=' + encodeURIComponent( title ) + '&reason=' + encodeURIComponent( reason ) + '&format=json',
  10.             url2 = url1 + '&action=protect&protections=create=sysop&token=' + encodeURIComponent( PT );
  11.             url1 += '&action=delete&token=' + encodeURIComponent( DT );
  12.         $.post( url1, function() {
  13.             $( '#abd-output' ).append( '  > Deleted\n' );
  14.             $( '#abd-output' ).append( '> Attempting to fully protect [[' + page + ']]\n' );
  15.             $.post( url2, function() {
  16.                 $( '#abd-output' ).append( '  > Fully protected\n' );
  17.                 setTimeout( ajaxDeleteStart, 1000 );
  18.             });
  19.         });
  20.     });
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement