Skip to content

Instantly share code, notes, and snippets.

View JJPMaster's full-sized avatar

Juniper JJPMaster

View GitHub Profile
@JJPMaster
JJPMaster / example.json
Last active May 30, 2022 21:54
JSON output of example of MediaWiki API usage
{
"batchcomplete": "",
"query": {
"users": [
{
"userid": 31726653,
"name": "JJPMaster",
"editcount": 3975,
"groups": [
"abusefilter-helper",
@JJPMaster
JJPMaster / example3.js
Created April 16, 2021 23:43
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',
@JJPMaster
JJPMaster / example2.js
Created April 16, 2021 23:31
Second example of MediaWiki API
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.js
Created April 16, 2021 23:13
Example of MediaWiki API
var params = {
action: 'query',
list: 'users',
ususers: 'JJPMaster',
usprop: 'gender|editcount|groups',
format: 'json'
},
api = new mw.Api();
var users = data.query.users,
u;