Home  

Random  

Nearby  



Log in  



Settings  



Donate  



About Wikipedia  

Disclaimers  



Wikipedia





User:Guarapiranga/accessKeysCheatSheet.js





User page  

Talk  



Language  

Watch  

View source  


< User:Guarapiranga
 


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.
//  Adds alt+shift+? as an access key to show a list of all default access keys

$(() => {
 let dialog;
 $('<a>').attr('accesskey', '?').text('This access keys cheat sheet').hide().click(() => {
  if (dialog) {
   if (dialog.isOpened()) {
    dialog.close();
   } else {
    dialog.open({
     actions: [],
     size: 'medium'
    });
   }
   return false;
  }
  mw.loader.using('oojs-ui-windows', () => {
   let winMan = new OO.ui.WindowManager();
   winMan.$element.css('width', '35em').appendTo(document.body);
   dialog = new OO.ui.MessageDialog();
   winMan.addWindows([dialog]);
   $('<table>').addClass('wikitable').css('width', '100%').append(
    $('[accesskey]').map(function () {
     return $('<tr>').append(
      $('<th>').text(this.accessKey.toUpperCase()),
      $('<td>').text(
       this.getAttribute('aria-label') ||
       this.title.replace(/ \[.+?\]/, '') ||
       this.textContent ||
       this.value ||
       $(`label[for="${this.id}"]`).text()
      )
     );
    }).get()
   ).appendTo(dialog.text.$element);
   dialog.open({
    actions: [],
    size: 'medium'
   });
  });
  return false;
 }).appendTo(document.body);
});

Retrieved from "https://en.wikipedia.org/w/index.php?title=User:Guarapiranga/accessKeysCheatSheet.js&oldid=1091445506"
 



Last edited on 4 June 2022, at 11:09  


Languages

 



This page is not available in other languages.
 

Wikipedia


This page was last edited on 4 June 2022, at 11:09 (UTC).

Content is available under CC BY-SA 4.0 unless otherwise noted.



Privacy policy

About Wikipedia

Disclaimers

Contact Wikipedia

Code of Conduct

Developers

Statistics

Cookie statement

Terms of Use

Desktop