MediaWiki:Timeless.js: Difference between revisions

From The Joe Frank Wiki
OnAirJS
 
(No difference)

Latest revision as of 13:19, 8 November 2024

/* All JavaScript here will be loaded for users of the Timeless skin */

$(document).ready(function() {
    // Fetch expanded template content using the MediaWiki API
    $.get(mw.util.wikiScript('api'), {
        action: 'parse',
        page: 'Template:DisplayBroadcasts',
        format: 'json'
    }).done(function(data) {
        if (data && data.parse && data.parse.text) {
            var templateContent = data.parse.text['*'];
            // Append the parsed template content to the page tools section
            $('#page-tools').prepend('<div class="custom-template">' + templateContent + '</div>');
        } else {
            console.error('Error: Template content could not be loaded.');
        }
    }).fail(function() {
        console.error('Error: API request failed.');
    });
});