Created
March 20, 2016 12:48
-
-
Save edg2s/f7db01d240ad3c83d183 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
new mw.Api().get( { | |
action: 'query', | |
list: 'recentchanges', | |
rcuser: mw.user.getName(), | |
rcprop: 'comment', | |
rctype: 'edit', | |
rclimit: 50 | |
} ).then( function ( response ) { | |
var comments, usedComments = {}, | |
changes = ve.getProp( response, 'query', 'recentchanges' ) || []; | |
comments = changes.map( function ( change ) { | |
// Remove section /* headings */ | |
return change.comment.replace( /\/\*.+?\*\//g, '' ).trim(); | |
} ); | |
// Filter out duplicates and empty comments | |
comments = comments.filter( function ( comment ) { | |
var exists; | |
exists = usedComments.hasOwnProperty( comment ); | |
usedComments[ comment ] = true; | |
return !exists && comment; | |
} ); | |
} ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment