Emoji u1f384.svg
Merry Christmas from the IIWiki Team! Have a happy new year!

MediaWiki:VectorPlus.js

Revision as of 01:11, 23 February 2024 by Makko Oko (talk | contribs) (Created page with "$(document).ready(function() { // Check if the current page has a "Tools" menu if ($("#p-tb").length) { // Create a new dropdown menu var dropdown = $("<li>", { "class": "interlanguage-link interwiki-tools" }); var dropdownLink = $("<a>", { "href": "#", "text": "Tools" }); var dropdownList = $("<ul>"); // Move the "What links here" link to the dropdown menu var whatLinksHere = $("#t-whatlinkshere"); if (whatLinksHere.length) { dropd...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Note: After publishing, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Press Ctrl-F5.
$(document).ready(function() {
  // Check if the current page has a "Tools" menu
  if ($("#p-tb").length) {
    // Create a new dropdown menu
    var dropdown = $("<li>", { "class": "interlanguage-link interwiki-tools" });
    var dropdownLink = $("<a>", { "href": "#", "text": "Tools" });
    var dropdownList = $("<ul>");

    // Move the "What links here" link to the dropdown menu
    var whatLinksHere = $("#t-whatlinkshere");
    if (whatLinksHere.length) {
      dropdownList.append($("<li>").append(whatLinksHere));
    }

    // Move the "Related changes" link to the dropdown menu
    var relatedChanges = $("#t-recentchangeslinked");
    if (relatedChanges.length) {
      dropdownList.append($("<li>").append(relatedChanges));
    }

    // Move the "Permanent link" link to the dropdown menu
    var permanentLink = $("#t-permalink");
    if (permanentLink.length) {
      dropdownList.append($("<li>").append(permanentLink));
    }

    // Move the "Page information" link to the dropdown menu
    var pageInfo = $("#t-info");
    if (pageInfo.length) {
      dropdownList.append($("<li>").append(pageInfo));
    }

    // Add the dropdown menu to the "Tools" menu
    dropdown.append(dropdownLink);
    dropdown.append(dropdownList);
    $("#p-tb ul").prepend(dropdown);

    // Remove the original links from the "Tools" menu
    $("#t-whatlinkshere, #t-recentchangeslinked, #t-permalink, #t-info").remove();
  }
});