User:Ilmari Karonen/cologneblue/shorteditlinks.js

Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
$(function () {
    function fixEditLink (sectionId) {
        var section = document.getElementById(sectionId);
        if (!section) return;
        var strongTags = section.getElementsByTagName('strong');
        for (var i = 0; i < strongTags.length; i++) {
            var link = strongTags[i].firstChild;
            if (!link) continue;
            if (link.nodeType != 1) continue;
            if (link.tagName.toLowerCase() != 'a') continue;
            if (!/[?&]action=edit$/.test(link.href)) continue;
            if (link.firstChild.nodeType != 3) continue;
            link.firstChild.nodeValue = "Edit";
        }
    }
    fixEditLink('quickbar');
    fixEditLink('footer');
});