Jump to content

User:Enterprisey/up-one-lvl-kbd.js

From Wikipedia, the free encyclopedia

This is the current revision of this page, as edited by Enterprisey (talk | contribs) at 21:23, 5 December 2019 (for UX). The present address (URL) is a permanent link to this version.

(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)
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() {
    var breadcrumbEl = document.getElementsByClassName( "subpages" )[0];
    if( breadcrumbEl ) {
        mw.loader.using( [ "mediawiki.util" ], function () {

            // If someone's already using the "U" access key, clear that
            var hasOurAccessKey = document.querySelectorAll( "a[accesskey=u]" );
            for( var i = 0; i < hasOurAccessKey.length; i++ ) {
                hasOurAccessKey[i].setAttribute( "accesskey", "" );
                $( hasOurAccessKey[i] ).updateTooltipAccessKeys();
            }

            var lastSubpage = breadcrumbEl.children[ breadcrumbEl.children.length - 1 ];
            lastSubpage.accessKey = "u";
            $( lastSubpage ).updateTooltipAccessKeys();
        } );
    }
} );