RemapAccesskeys

RemapAccesskeys allows you to create new keyboard shortcuts or overwrite existing ones by remapping accesskeys assigned to links and other site elements in a fully customizable way.
== Features ==
* Assign accesskey to first DOM element matching provided selector.
* Automatically unset accesskey attribute from all elements using your desired accesskey, so it can be remapped.
* Allow conditions to set different shortcuts depending on the context.
* Allow running after specified MediaWiki hook has been fired to allow integrations with other scripts or JS-dependent features.
== ==
== ==
Configuration is absolutely necessary for this script to run. This is a customizability extension which gives you the ability to set keyboard shortcuts just the way you like. Configuration is stored in window.customKeyboardShortcuts array which holds JS objects with configuration keys for an unlimited number of shortcuts.
=== Configuration keys ===
Key 	 	Data type 	Required?
selector 	Selector for the DOM element to which you want to assign an accesskey. 	String 	Yes
accesskey	Accesskey to use. Can be either something new or already registered accesskey. 	One-character printable string	Yes
condition	Condition which has to be met in order for the accesskey to be assigned. 	Boolean 	No
hook 	Add accesskey and perform condition check once this MediaWiki JS hook has been fired.	String 	No
=== Basic configuration ===
// RemapAccesskeys configuration
window.customKeyboardShortcuts = [
 {
 selector: '.selectorOf #my > element',
 accesskey: '1'
 }
];
=== Example use-cases ===
Although this script has been made with freedom in mind, here are some example use cases you might want to borrow:
; Search modal
: Change accesskey from to but not in edit mode where access key will publish your edit.
{
 selector: '.global-navigation__search',
 accesskey: 's',
 condition: ( mw.config.get( 'wgAction' ) !== 'edit' )
},
; ThemeToggler
: Make temporarily switch your wiki theme on FandomDesktop.
{
 selector: '.skin-theme-toggle-temporal',
 accesskey: 't',
 hook: 'dev.themeToggler.loaded'
},
; Site width
: Make change your preferred page with on FandomDesktop.
{
 selector: '.content-size-toggle',
 accesskey: 'w'
},
; Right rail state
: Make change visibility of the right rail on FandomDesktop.
{
 selector: '.right-rail-toggle',
 accesskey: 'r'
},