MediaWiki:Vector.js: Difference between revisions

Jump to navigation Jump to search
(Created page with "→‎All JavaScript here will be loaded for users of the Vector skin: // Move the table of contents to the sidebar $(document).ready(function() { var $toc = $('#toc'); if ($toc.length) { var $newToc = $toc.clone(); $newToc.find('a').each(function() { $(this).attr('href', $(this).attr('href').replace(/^#/, '#toc_')); }); $newToc.attr('id', 'mw-panel'); $newToc.addClass('toc'); $newToc.find('h2').text('Co...")
 
mNo edit summary
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
/* All JavaScript here will be loaded for users of the Vector skin */
/* All JavaScript here will be loaded for users of the Vector skin */


// Move the table of contents to the sidebar
/* Custom backport of sidebar TOC from Vector 2022 skin
$(document).ready(function() {
var t = document.querySelector("#toc.toc");
    var $toc = $('#toc');
var e = document.querySelector("#mw-panel");
    if ($toc.length) {
e.insertBefore(t, e.firstElementChild.nextSibling);*/
        var $newToc = $toc.clone();
        $newToc.find('a').each(function() {
            $(this).attr('href', $(this).attr('href').replace(/^#/, '#toc_'));
        });
        $newToc.attr('id', 'mw-panel');
        $newToc.addClass('toc');
        $newToc.find('h2').text('Contents');
        $toc.after($newToc);
        $toc.hide();
    }
});

Latest revision as of 06:17, 22 February 2024

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

/* Custom backport of sidebar TOC from Vector 2022 skin
var t = document.querySelector("#toc.toc");
var e = document.querySelector("#mw-panel");
e.insertBefore(t, e.firstElementChild.nextSibling);*/