630
edits
No edit summary |
No edit summary |
||
Line 18: | Line 18: | ||
prop: \'wikitext\', \ | prop: \'wikitext\', \ | ||
text:\'{{#invoke:Roman Date| main | \' + date + \' }}\' \ | text:\'{{#invoke:Roman Date| main | \' + date + \' }}\' \ | ||
}).done( function ( data ) { \ | |||
resultDiv.innerHTML = data.expandtemplates.wikitext; \ | |||
} ); \ | |||
} \ | |||
</script> \ | |||
</div>'); | |||
}); | |||
}); | |||
$(function() { | |||
mw.loader.using( [ | |||
'oojs-ui', | |||
'oojs-ui-core', | |||
] ).done( function () { | |||
var numInput = new OO.ui.NumberInputWidget({id: 'numeral'}); | |||
$('#ir-roman-numeral-converter').append('<div class=\"mw-inputbox-centered\"> ', numInput.$element, ' \ | |||
<input type=\"submit\" onclick=\"submit()\" class=\"mw-ui-button mw-ui-progressive webfonts-changed\" value=\"Convert Date\"> \ | |||
<div id=\"result\"></div> \ | |||
<script> \ | |||
function submit(){ \ | |||
const resultDiv = document.getElementById(\"result\"); \ | |||
const api = new mw.Api(); \ | |||
let numeral = $(\'#numeral input[type=hidden]\').val(); \ | |||
api.get({ \ | |||
action: \'expandtemplates\', \ | |||
prop: \'wikitext\', \ | |||
text:\'{{#invoke:Roman Numeral| main |explanation=yes \' + numeral + \' | }}\' \ | |||
}).done( function ( data ) { \ | }).done( function ( data ) { \ | ||
resultDiv.innerHTML = data.expandtemplates.wikitext; \ | resultDiv.innerHTML = data.expandtemplates.wikitext; \ |