Skip to content

brettz9/mediawiki-js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mediawiki-js

Ultra-light, vanilla JavaScript wrapper of Mediawiki API for use in the browser.

Simple one-shot usage:

MediaWikiJS('https://en.wikipedia.org', {action: 'query', prop: 'revisions', titles: 'Main Page'}, function (data) {
    var pages = data.query.pages;
    alert('Last edited by: ' + pages[Object.keys(pages)[0]].revisions[0].user);
});

Simple reusable usage:

var mwjs = MediaWikiJS('https://en.wikipedia.org');
mwjs.send({action: 'query', prop: 'revisions', titles: 'Main Page'}, function (data) {
    var pages = data.query.pages;
    alert('Last edited by: ' + pages[Object.keys(pages)[0]].revisions[0].user);
});

Configuration object:

var mwjs = MediaWikiJS({baseURL: 'https://en.wikipedia.org', apiPath: '/w/api.php'});
mwjs.send({action: 'query', prop: 'revisions', titles: 'Main Page'}, function (data) {
    var pages = data.query.pages;
    alert('Last edited by: ' + pages[Object.keys(pages)[0]].revisions[0].user);
});

To-dos

  1. Node support and publish

About

Ultra-light wrapper for Mediawiki API

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published