MediaWiki:VectorPlus.js: Difference between revisions

Jump to navigation Jump to search
mNo edit summary
mNo edit summary
Line 1: Line 1:
// Clone and move the "Tools" section to the right-navigation area
$(function(){
$(function(){
  // Clone the "Tools" section from the sidebar
    // Check if the elements exist
  var $toolsMenu = $('#p-tb').clone();
    if (!$('#t-whatlinkshere').length || !$('#t-recentchanges').length || !$('#t-permalink').length || !$('#t-info').length) {
        return;
    }


  // Create a new "Tools" section in the right-navigation
    // Create a dropdown menu for the tools
  var $newToolsMenu = $('<div id="p-newtools" class="vector-menu-content"></div>');
    $('<div id="p-custom-tools" class="vector-menu vector-menu-dropdown">').append(
  $newToolsMenu.append($toolsMenu.find('ul').html());
        $('<h3>').text('Tools'),
  $newToolsMenu.prepend('<h3 id="p-newtools-label" class="vector-menu-heading">Tools</h3>');
        $('<div class="menu">').append(
 
            $('#t-whatlinkshere, #t-recentchanges, #t-permalink, #t-info')
  // Insert the new "Tools" section in the right-navigation after #ca-history
        )
  $newToolsMenu.insertAfter('#ca-history');
    ).insertAfter('#ca-history');
 
})
  // Remove the original "Tools" section from the sidebar
  $('#p-tb').remove();
});

Revision as of 01:39, 23 February 2024

$(function(){
    // Check if the elements exist
    if (!$('#t-whatlinkshere').length || !$('#t-recentchanges').length || !$('#t-permalink').length || !$('#t-info').length) {
        return;
    }

    // Create a dropdown menu for the tools
    $('<div id="p-custom-tools" class="vector-menu vector-menu-dropdown">').append(
        $('<h3>').text('Tools'),
        $('<div class="menu">').append(
            $('#t-whatlinkshere, #t-recentchanges, #t-permalink, #t-info')
        )
    ).insertAfter('#ca-history');
})