MediaWiki:Gadget-jsonDoc.js: Difference between revisions
Jump to navigation
Jump to search
Content added Content deleted
(Created page with "if (mw.config.get('wgPageContentModel') === 'json' && !$('.json-contentmodel-documentation').length && mw.config.get('wgArticleId')!==0) { var raw_url = mw.config.get('wgServer')+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>'...") |
No edit summary Tag: Reverted |
||
Line 1: | Line 1: | ||
if (mw.config.get('wgPageContentModel') === 'json' && !$('.json-contentmodel-documentation').length && mw.config.get('wgArticleId')!==0) { |
if (mw.config.get('wgPageContentModel') === 'json' && !$('.json-contentmodel-documentation').length && mw.config.get('wgArticleId')!==0) { |
||
var raw_url = mw.config.get('wgServer')+mw.util.getUrl(null, {action:'raw', ctype:'application/json'}); |
var raw_url = mw.config.get('wgServer')+mw.mw.util.getUrl(null, {action:'raw', ctype:'application/json'}); |
||
$('#mw-content-text').prepend($( |
$('#mw-content-text').prepend($( |
||
'<div class="documentation json-contentmodel-documentation">'+ |
'<div class="documentation json-contentmodel-documentation">'+ |
||
Line 12: | Line 12: | ||
'</div>'+ |
'</div>'+ |
||
'<div class="documentation-content">'+ |
'<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.util.getUrl(null, {action:'edit'})+'">edit the page</a>.</p>'+ |
'<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 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>'+ |
'<p>To load this data externally, it is recommended to send a GET request to <a href="'+raw_url+'">'+raw_url+'</a></p>'+ |
Revision as of 00:10, 17 October 2024
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>'
));
}