MediaWiki:Gadget-jsonDoc.js

From RuneRealm Wiki

This is an old revision of this page, as edited by Alex (talk | contribs) at 00:10, 17 October 2024. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

Jump to navigation Jump to search

After saving, you may need to bypass your browser's cache to see the changes. For further information, see Wikipedia:Bypass your cache.

  • In most Windows and Linux browsers: Hold down Ctrl and press F5.
  • In Safari: Hold down ⇧ Shift and click the Reload button.
  • In Chrome and Firefox for Mac: Hold down both ⌘ Cmd+⇧ Shift and press R.
if (mw.config.get('wgPageContentModel') === 'json' && !$('.json-contentmodel-documentation').length && mw.config.get('wgArticleId')!==0) {
  var raw_url = mw.config.get('wgServer')+mw.mw.util.getUrl(null, {action:'raw', ctype:'application/json'});
  $('#mw-content-text').prepend($(
  	'<div class="documentation json-contentmodel-documentation">'+
  		'<div class="documentation-header">'+
  			'<span class="documentation-title">JSON module documentation</span>'+
  		'</div>'+
  		'<div class="documentation-subheader">'+
  			'<span class="documentation-documentation">'+
  				'This documentation is generated by <a href="/w/MediaWiki:Gadget-jsonDoc.js" title="MediaWiki:Gadget-jsonDoc.js">MediaWiki:Gadget-jsonDoc.js</a>.'+
  			'</span>'+
  		'</div>'+
  		'<div class="documentation-content">'+
  			'<p>This page is set to the JSON content model. Below is a parsed version of the data, as a table. To see the raw data, you can <a href="'+mw.mw.util.getUrl(null, {action:'edit'})+'">edit the page</a>.</p>'+
  			'<p>To load this data in an on-wiki scribunto module, use <code>mw.loadJsonData("'+mw.config.get('wgPageName')+'")</code> (<a href="https://www.mediawiki.org/wiki/Extension:Scribunto/Lua_reference_manual#mw.loadJsonData">documentation</a>).</p>'+
  			'<p>To load this data externally, it is recommended to send a GET request to <a href="'+raw_url+'">'+raw_url+'</a></p>'+
  		'</div>'+
  	'</div>'
  ));
}