630
edits
No edit summary |
No edit summary |
||
Line 6: | Line 6: | ||
] ).done( function () { | ] ).done( function () { | ||
var dateInput = new mw.widgets.DateInputWidget({id: 'date'}); | var dateInput = new mw.widgets.DateInputWidget({id: 'date'}); | ||
$('#ir-roman-date-converter').append('<div class=\"mw-inputbox-centered\"> ' + dateInput.$element + ' \ | |||
<input type=\"submit\" onclick=\"submit()\" class=\"mw-ui-button mw-ui-progressive webfonts-changed\" value=\"Convert Date\"> \ | |||
<div id=\"result\"></div> \ | <div id=\"result\"></div> \ | ||
<script> \ | <script> \ | ||
Line 15: | Line 13: | ||
const resultDiv = document.getElementById(\"result\"); \ | const resultDiv = document.getElementById(\"result\"); \ | ||
const api = new mw.Api(); \ | const api = new mw.Api(); \ | ||
let | let getDate = '+ dateInput.getValue +'; \ | ||
api.get({ \ | api.get({ \ | ||
action: \'expandtemplates\', \ | action: \'expandtemplates\', \ | ||
prop: \'wikitext\', \ | prop: \'wikitext\', \ | ||
text:\'{{#invoke:Roman Date| main | \' + | text:\'{{#invoke:Roman Date| main | \' + getDate() + \' }}\' \ | ||
}).done( function ( data ) { \ | }).done( function ( data ) { \ | ||
resultDiv.innerHTML = data.expandtemplates.wikitext; \ | resultDiv.innerHTML = data.expandtemplates.wikitext; \ | ||
Line 26: | Line 24: | ||
</script> \ | </script> \ | ||
</div>'); | </div>'); | ||
}); | |||
}); | }); |