User:R'n'B/newdstest.js

// newdabsolver.js // Copyright (c) 2014 w:en:User:R'n'B; // Creative Commons Attribution-ShareAlike License applies /*jshint multistr:true */ (function (mw, $) { 	var	check = function {		// make sure dabcolorizer has already run		if (mw.RnB && mw.RnB.dabtag) {			mw.loader.using(['jquery.ui'], init);		} else {			setTimeout(check, 250);		}	},	dt, 	app,	init = function  {		app = mw.RnB.dabsolve = {};		app.current_pageid = mw.config.get("wgArticleId"),		dt = mw.RnB.dabtag;		/*  dt contains:			dt.pagelinkdata, with API info and templates for each internal link,				the value dt.pagelinkdata[pageid].known_dab is true if the				page is a dabpage, undefined if not;			dt.redirectsFromTo,			dt.redirectsToFrom,			dt.originalWikitext,		*/		api = dt.api;		// request this page's wikitext		api.request({ action: 'query', prop: 'revisions', pageids: app.current_pageid, rvprop: 'content' }, loadwikitext);		// set up the user interface		// TODO	},	loadwikitext = function (response) {		app.originalWikitext = response.query.pages[app.current_pageid].revisions["*"];	};

check; }(mediaWiki, jQuery) );