Skip to content

Instantly share code, notes, and snippets.

Avatar

JJPMaster JJPMaster

View GitHub Profile
View example3.js
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',
@JJPMaster
JJPMaster / example2.js
Created Apr 16, 2021
Second example of MediaWiki API
View example2.js
var params = {
action: 'edit',
title: 'User:JJPMaster/sandbox',
text: 'This edit is being automatically made as part of my new blog post.',
minor: true
},
api = new mw.Api();
api.postWithToken( 'csrf', params ).done( function ( data ) {
console.log( data );
@JJPMaster
JJPMaster / example.json
Last active May 30, 2022
JSON output of example of MediaWiki API usage
View example.json
{
"batchcomplete": "",
"query": {
"users": [
{
"userid": 31726653,
"name": "JJPMaster",
"editcount": 3975,
"groups": [
"abusefilter-helper",
@JJPMaster
JJPMaster / example.js
Created Apr 16, 2021
Example of MediaWiki API
View example.js
var params = {
action: 'query',
list: 'users',
ususers: 'JJPMaster',
usprop: 'gender|editcount|groups',
format: 'json'
},
api = new mw.Api();
var users = data.query.users,
u;