Skip to content

Instantly share code, notes, and snippets.

@JJPMaster
Created April 16, 2021 23:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JJPMaster/21f8fad8f09dfc03838237985eb2c3c7 to your computer and use it in GitHub Desktop.
Save JJPMaster/21f8fad8f09dfc03838237985eb2c3c7 to your computer and use it in GitHub Desktop.
Another example
var ICU = mw.util.addPortletLink("p-cactions", "#", "ICU", "medium-blog-post", "Add an ICU tag to this article", null, "#ca-move");
$(ICU).click(Tag);
function Tag()
{
var params = {
action: 'edit',
title: mw.config.get('wgPageName'),
prependtext: '{{ICU|~~' + '~~' + '~}}',
summary: 'Adding ICU tag to article',
minor: true
},
api = new mw.Api();
api.postWithToken( 'csrf', params ).done( function ( data ) {
console.log( 'ICU\'d succesfully.' );
mw.notify('ICU complete!')
} );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment