Skip to content

Instantly share code, notes, and snippets.

@kwon37xi
Last active September 6, 2020 14:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kwon37xi/7ae5715b6c9c539e0aa7da0f709392f9 to your computer and use it in GitHub Desktop.
Save kwon37xi/7ae5715b6c9c539e0aa7da0f709392f9 to your computer and use it in GitHub Desktop.
dokuwiki linux-chrome accessKey change userscript
// ==UserScript==
// @name kwonnam wiki accesskey changer
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author KwonNam Son
// @match https://kwonnam.pe.kr/wiki/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
var newMappings = {
"`": "~",
"1": "!",
"2": "@",
"3": "#",
"4": "$",
"5": "%",
"6": "^",
"7": "&",
"8": "*",
"9": "(",
"0": ")",
"-": "_",
"=": "+" /*,
"b": "n",
"i": "?" - no need in vivaldi */
};
// execute after all DOM loaded
window.addEventListener('load', function() {
var buttons = document.getElementsByClassName("toolbutton");
console.log("buttons : " + buttons.length);
var i;
for (i = 0; i < buttons.length; i++) {
if (buttons[i].accessKey) {
var accessKey = buttons[i].accessKey.toLowerCase();
console.log("idx " + i + " " + buttons[i].accessKey);
if (newMappings[accessKey]) {
buttons[i].accessKey = newMappings[accessKey];
}
}
}
}, false);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment