User:Opencooper/nihongo.js

$( mw.util.addPortletLink( 'p-cactions', "#", 'Nihongo', 'hStrings', 'Display nihongo template parameters', 'n') ) .click( function highlightStrings {	// Don't run outside of viewing articles	if (!((mw.config.get( 'wgCanonicalNamespace' ) === '' && mw.config.get( 'wgAction' ) === 'view')) ) {		return;	}

// Get wikitext // API docs: https://www.mediawiki.org/wiki/API:Revisions $.ajax({       url: "https://ja.wikipedia.org/w/api.php",        data: {            action: "query",            prop: "revisions",            format: "json",            titles: mw.config.get("wgPageName"),            rvprop: "content",            rvslots: "main",            origin: "*"        },        success: parseWikitext    }); } );

function parseWikitext(response) { var pageText = response.query.pages[0].revisions[0].slots.main.content; // parseLang(pageText); // parseLang-ja(pageText); // parseTransl(pageText); parseNihongo(pageText); /*	parseNihongo2(pageText); parseNihongo3(pageText); parseNihongo-s(pageText); */ // parseNihongo_foot(pageText); }