Merge branch 'master' of https://github.com/WPAFC/afch-rewrite
This commit is contained in:
parent
86f470468f
commit
6c7d3bd93f
@ -33,7 +33,7 @@ New versions of the script can be released through `scripts/release.py`, which a
|
||||
|
||||
### Version history
|
||||
|
||||
* 0.9 Hatted Hamster (8 Novemeber 2014)
|
||||
* 0.9 Hatted Hamster (8 November 2014)
|
||||
* 0.8 Wandering Walrus (18 May 2014)
|
||||
* 0.7 Less is More (13 April 2014)
|
||||
* 0.6 Dancing Turtle (27 March 2014)
|
||||
|
@ -460,37 +460,6 @@
|
||||
return deferred;
|
||||
};
|
||||
|
||||
/**
|
||||
* Gets the next submission in the queue (i.e. the oldest one).
|
||||
* @param {bool} older Whether to get the oldest pending submission instead of the newest one.
|
||||
* @return {$.Deferred} resolves with API call
|
||||
*/
|
||||
AFCH.Submission.prototype.getNextSubmission = function ( older ) {
|
||||
var deferred = $.Deferred(),
|
||||
request = {
|
||||
action: 'query',
|
||||
list: 'categorymembers',
|
||||
cmtitle: 'Category:Pending AfC submissions',
|
||||
cmnamespace: 5,
|
||||
cmtype: 'page',
|
||||
cmlimit: 1,
|
||||
cmsort: 'sortkey',
|
||||
cmdir: older ? 'desc' : 'asc',
|
||||
cmstartsortkey: 'P' + ( ( this.templates.length && this.templates[0].timestamp ) / 100 ) + ( older ? 0 : 1 )
|
||||
};
|
||||
|
||||
AFCH.api.get( request )
|
||||
.done( function ( data ) {
|
||||
if ( data.query.categorymembers && data.query.categorymembers.length && data.query.categorymembers[0].title ) {
|
||||
deferred.resolve( data.query.categorymembers[0].title );
|
||||
} else {
|
||||
deferred.reject( data );
|
||||
}
|
||||
} );
|
||||
|
||||
return deferred;
|
||||
};
|
||||
|
||||
/**
|
||||
* Represents text of an AfC submission
|
||||
* @param {[type]} text [description]
|
||||
@ -1209,8 +1178,10 @@
|
||||
.text( '(reloading...)' )
|
||||
);
|
||||
|
||||
afchSubmission.getNextSubmission().done( function ( title ) {
|
||||
new AFCH.status.Element( 'Continue to next submission, $1 »', { '$1': AFCH.makeLinkElementToPage( title ) } );
|
||||
new AFCH.status.Element( 'Continue to next $1, $2, or $3 »', {
|
||||
'$1': AFCH.makeLinkElementToPage( 'Special:RandomInCategory/Pending AfC submissions', 'random submission' ),
|
||||
'$2': AFCH.makeLinkElementToPage( 'Special:RandomInCategory/AfC pending submissions by age/0 days ago', 'GFOO submission' ),
|
||||
'$3': AFCH.makeLinkElementToPage( 'Special:RandomInCategory/Category:AfC submissions by age/Very old', 'very old submission' )
|
||||
} );
|
||||
|
||||
// Also, automagically reload the page in place
|
||||
|
Loading…
x
Reference in New Issue
Block a user