Ultra-light wrapper for Mediawiki API
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
CHANGES.md
MediawikiJS.js
README.md
license.txt
package.json
test.html

README.md

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