MediaWiki:Common.js: Difference between revisions

From Artifacts of Capitalism
No edit summary
No edit summary
Line 1: Line 1:
$(document).ready(function () {
$(document).ready(function () {
  // Confirm loading
   console.log("✅ Common.js is loading and attempting to insert link...");
   console.log("✅ Ready to add custom personal tools link");


   // Create new link item
   // Create new link
   var $newLink = $('<li id="pt-mycustomlink"><a href="/index.php/Special:RecentChanges">Recent Changes</a></li>');
   var $customLink = $('<li><a href="/index.php/Special:RecentChanges">Recent Changes</a></li>');


   // Add it to the personal tools menu
   // Wait a bit for the Chameleon menu to render
   if ($('#p-personal ul').length) {
   setTimeout(function () {
     $('#p-personal ul').append($newLink);
     var menu = $('.cmln-personal-tools .dropdown-menu');
  } else if ($('.cmln-personal-tools ul').length) {
    if (menu.length) {
    // Chameleon skin fallback
      menu.append($customLink);
    $('.cmln-personal-tools ul').append($newLink);
      console.log("✅ Custom link added to personal tools menu.");
  } else {
    } else {
    console.warn("⚠️ Personal tools menu not found.");
      console.warn("⚠️ Personal tools dropdown not found.");
   }
    }
   }, 500); // Slight delay to ensure menu has rendered
});
});

Revision as of 20:38, 14 July 2025

$(document).ready(function () {
  console.log("✅ Common.js is loading and attempting to insert link...");

  // Create new link
  var $customLink = $('<li><a href="/index.php/Special:RecentChanges">Recent Changes</a></li>');

  // Wait a bit for the Chameleon menu to render
  setTimeout(function () {
    var menu = $('.cmln-personal-tools .dropdown-menu');
    if (menu.length) {
      menu.append($customLink);
      console.log("✅ Custom link added to personal tools menu.");
    } else {
      console.warn("⚠️ Personal tools dropdown not found.");
    }
  }, 500); // Slight delay to ensure menu has rendered
});