MediaWiki:Common.js: Difference between revisions

From XMethod Wiki
Jump to navigation Jump to search
No edit summary
 
No edit summary
Line 1: Line 1:
/* Make Admin Tools sidebar header clickable */
/* Make Admin Tools sidebar header clickable - links to Newsletter Dashboard */
$(function() {
$(function() {
     var adminHeader = document.querySelector("#p-Special\\:NewsletterDashboard .vector-menu-heading-label, #p-Admin_Tools .vector-menu-heading-label");
    // Find the Admin Tools section header
     if (adminHeader) {
     var sections = document.querySelectorAll(".vector-menu-heading-label");
        var link = document.createElement("a");
     sections.forEach(function(header) {
        link.href = "/Special:NewsletterDashboard";
        if (header.textContent.trim() === "Admin Tools") {
        link.style.color = "inherit";
            var link = document.createElement("a");
        link.style.textDecoration = "none";
            link.href = "/Special:NewsletterDashboard";
        link.textContent = adminHeader.textContent;
            link.style.color = "inherit";
        adminHeader.textContent = "";
            link.style.textDecoration = "none";
        adminHeader.appendChild(link);
            link.style.cursor = "pointer";
     }
            link.textContent = header.textContent;
            header.textContent = "";
            header.appendChild(link);
        }
     });
});
});

Revision as of 04:51, 2 February 2026

/* Make Admin Tools sidebar header clickable - links to Newsletter Dashboard */
$(function() {
    // Find the Admin Tools section header
    var sections = document.querySelectorAll(".vector-menu-heading-label");
    sections.forEach(function(header) {
        if (header.textContent.trim() === "Admin Tools") {
            var link = document.createElement("a");
            link.href = "/Special:NewsletterDashboard";
            link.style.color = "inherit";
            link.style.textDecoration = "none";
            link.style.cursor = "pointer";
            link.textContent = header.textContent;
            header.textContent = "";
            header.appendChild(link);
        }
    });
});