User:Abc518/vector.js: Difference between revisions
Appearance
Content deleted Content added
Will this actually work? |
←Blanked the page |
||
Line 1: | Line 1: | ||
importScript('User:John254/mass rollback.js') |
|||
importScript('User:AzaToth/morebits.js'); |
|||
importScript('User:AzaToth/twinklefluff.js'); |
|||
importScript('User:AzaToth/twinklewarn.js'); |
|||
importScript('User:AzaToth/twinklearv.js'); |
|||
importScript('User:AzaToth/twinklespeedy.js'); |
|||
importScript('User:AzaToth/twinklediff.js'); |
|||
importScript('User:AzaToth/twinkleprotect.js'); |
|||
importScript('User:AzaToth/twinkleprod.js'); |
|||
importScript('User:AzaToth/twinklexfd.js'); |
|||
importScript('User:AzaToth/twinkleimage.js'); |
|||
importScript('User:AzaToth/twinkleunlink.js'); |
|||
importScript('User:AzaToth/twinkledelimages.js'); |
|||
importScript('User:Anomie/unwatch.js'); |
|||
importScript('User:Ale_jrb/Scripts/statusCheck.js'); |
|||
// TESTING STUFF!!! |
|||
var latesttitle; |
|||
function abc518TESTCallback(test) { |
|||
var Window = new SimpleWindow( 600, 325 ); |
|||
Window.setTitle( "AFD Watch List" ); |
|||
var form = new QuickForm( abc518TESTeval ); |
|||
var pos = form.append( { |
|||
type: 'select', |
|||
name: 'position', |
|||
label: 'Keep or Delete: ', |
|||
tooltip: 'My position: Keep or delete' |
|||
} |
|||
); |
|||
pos.append( { type:'option', label:'Keep', value:'Keep', selected: 1 } ); |
|||
pos.append( { type:'option', label:'Delete', value:'Delete', selected: 0 } ); |
|||
pos.append( { type:'option', label:'Merge', value:'Merge', selected: 0 } ); |
|||
pos.append( { type:'option', label:'Redirect', value:'Redirect', selected: 0 } ); |
|||
form.append( { |
|||
type: 'input', |
|||
name: 'createdby', |
|||
label: 'AfD Opened By: ', |
|||
value: '' |
|||
} ); |
|||
form.append( { |
|||
type: 'input', |
|||
name: 'comments', |
|||
label: 'Comments: ', |
|||
value: '' |
|||
} ); |
|||
form.append( { type:'submit' } ); |
|||
var result = form.render(); |
|||
Window.setContent( result ); |
|||
Window.display(); |
|||
} |
|||
function abc518TESTeval(e) { |
|||
wgPageName = wgPageName.replace( /_/g, ' ' ); |
|||
var position = e.target.position.value; |
|||
var createdby = e.target.createdby.value; |
|||
var comments = e.target.comments.value; |
|||
var query = { |
|||
'action': 'query', |
|||
'list': 'allpages', |
|||
'apprefix': 'Articles for deletion/' + wgPageName, |
|||
'apnamespace': 4, |
|||
'apfilterredir': 'nonredirects', |
|||
'aplimit': 500 |
|||
}; |
|||
alert('processing'); |
|||
var wikipedia_api = new Wikipedia.api( 'Checking if page exist', query, abc518TEST.callbacks.afd.main ); |
|||
//wikipedia_api.params = { usertalk:usertalk, reason:reason, noinclude:noinclude, xfdcat:xfdcat }; |
|||
wikipedia_api.params= {position:position, createdby:createdby, comments:comments}; |
|||
wikipedia_api.post(); |
|||
} |
|||
function num2order( num ) { |
|||
switch( num ) { |
|||
case 1: return ''; |
|||
case 2: return '2nd'; |
|||
case 3: return '3rd'; |
|||
default: return num + 'th'; |
|||
} |
|||
} |
|||
abc518TEST.callbacks = { |
|||
afd: { |
|||
main: function ( self ) { |
|||
var xmlDoc = self.responseXML; |
|||
var titles = xmlDoc.evaluate( '//allpages/p/@title', xmlDoc, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null ); |
|||
if( titles.snapshotLength <= 0 ) { |
|||
alert('No AfD discussion for this page'); |
|||
return; |
|||
} |
|||
// Find the latest afd |
|||
var number = 0; |
|||
for( var i = 0; i < titles.snapshotLength; ++i ) { |
|||
var title = titles.snapshotItem(i).value; |
|||
} |
|||
latesttitle = title; |
|||
var query = { |
|||
'title': 'user:abc518/afdlist', |
|||
'action': 'submit' |
|||
}; |
|||
var wikipedia_wiki = new Wikipedia.wiki( 'Adding to my list', query, abc518TEST.callbacks.afd.mylist ); |
|||
wikipedia_wiki.params = self.params; |
|||
wikipedia_wiki.get(); |
|||
}, |
|||
mylist: function( self ) { |
|||
var form = self.responseXML.getElementById('editform'); |
|||
var text = form.wpTextbox1.value; |
|||
text += "<!-- This is a test -->\n|-\n| [["+wgPageName+"]]\n| [[" + latesttitle + "]]\n| "+self.params.position+"\n| Open\n| [[usertalk/"+self.params.createdby+"|"+self.params.createdby+"]]\n| "+self.params.comments+'\n'; |
|||
var postData = { |
|||
'wpMinoredit': undefined, // Per memo |
|||
'wpWatchthis': form.wpWatchthis.checked ? '' : undefined, |
|||
'wpStarttime': form.wpStarttime.value, |
|||
'wpEdittime': form.wpEdittime.value, |
|||
'wpAutoSummary': form.wpAutoSummary.value, |
|||
'wpEditToken': form.wpEditToken.value, |
|||
'wpSection': form.wpSection.value, |
|||
'wpSummary': "adding [[" + latesttitle + ']].', |
|||
'wpTextbox1': text |
|||
}; |
|||
self.post( postData ); |
|||
} |
|||
} |
|||
} |
|||
function abc518TEST() { |
|||
if( wgNamespaceNumber < 0 || wgCurRevisionId == false ) { |
|||
return; |
|||
} |
|||
addPortletLink( 'p-cactions', "javascript:abc518TESTCallback('test12')", "AFD WATCH", "abc-ar", "Add to my AfD watch list on my userpage", ""); |
|||
} |
|||
addOnloadHook(abc518TEST); |