-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgwTabIndex.user.js
49 lines (44 loc) · 995 Bytes
/
gwTabIndex.user.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// ==UserScript==
// @name GlyphWiki: add tab indexes and access keys
// @version 2023.01.01
// @namespace szc
// @description -
// @match *://glyphwiki.org/wiki/*
// @match *://*.glyphwiki.org/wiki/*
// @run-at document-idle
// @grant none
// @inject-into content
// ==/UserScript==
if (document.body.dataset.action == 'edit' || document.body.dataset.action == 'preview') {
let tabIndex = {
edGlyphEditor: 101,
edRelated: 102,
edTextbox: 103,
edTextboxMetaJoho: 104,
edSummary: 105,
edPreview: 106,
edSubmit: 107,
}
for (let id in tabIndex) {
let el = document.getElementById(id);
if (el) {
el.tabIndex = tabIndex[id];
}
}
}
let accessKeys = {
// refer to MediaWiki
caMain: 'c',
caTalk: 't',
caEdit: 'e',
caHistory: 'h',
edGlyphEditor: 'a', // no MediaWiki equivalent
edPreview: 'p',
edSubmit: 's',
}
for (let id in accessKeys) {
let el = document.getElementById(id);
if (el) {
el.accessKey = accessKeys[id];
}
}