MediaWiki:Common.js/insertNewArticleTemplate.js

// This allows the inserting of Category:New article templates $(document).ready(function {   // Source editor    if (document.getElementById("EditPageIntro")) {        document.getElementById("new-template-btn-brickfilms").addEventListener("click", function { /*$.getJSON('/api.php?action=parse&page=Template:Brickfilmer_article_template&prop=wikitext&format=json', function(data) {               var code = data.parse.text['*'];                console.log(code);            });*/ $.get('/api.php?action=parse&page=Template:Brickfilmer_article_template&prop=wikitext&format=xmlfm') .done(function(data){   // parse the xml    data = $.parseXML(data);    console.log(data);    // do anything you want with the parsed data    var xmlText = new XMLSerializer.serializeToString(data);    console.log(xmlText);    document.querySelector("#wpTextbox1").innerHTML = xmlText;  }) .fail(function{   alert('something went wrong!');  }) });   } });