-
Notifications
You must be signed in to change notification settings - Fork 27
/
DEBUG.user.js
45 lines (45 loc) · 2.37 KB
/
DEBUG.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
// ==UserScript==
// @name DEBUG
// @version 2024.7.24
// @description Event and context info
// @namespace https://github.com/jesus2099/konami-command
// @supportURL https://github.com/jesus2099/konami-command/labels/DEBUG
// @downloadURL https://github.com/jesus2099/konami-command/raw/master/DEBUG.user.js
// @author jesus2099
// @licence CC-BY-NC-SA-4.0; https://creativecommons.org/licenses/by-nc-sa/4.0/
// @licence GPL-3.0-or-later; http://www.gnu.org/licenses/gpl-3.0.txt
// @since 2022-12-10
// @grant none
// @include /^https?:\/\//
// @run-at document-end
// ==/UserScript==
"use strict";
console.debug(GM_info.script.name + " - " + location.href);
if (GM_info.platform) console.debug("GM_info.platform: " + JSON.stringify(GM_info.platform, null, "\t"));
console.debug(GM_info);
document.body.addEventListener("keydown", keyboardMouseEventDebug);
document.body.addEventListener("keypress", keyboardMouseEventDebug);
document.body.addEventListener("keyup", keyboardMouseEventDebug);
document.body.addEventListener("auxclick", keyboardMouseEventDebug);
document.body.addEventListener("click", keyboardMouseEventDebug);
document.body.addEventListener("dblclick", keyboardMouseEventDebug);
document.body.addEventListener("mousedown", keyboardMouseEventDebug);
document.body.addEventListener("mouseup", keyboardMouseEventDebug);
document.body.addEventListener("contextmenu", keyboardMouseEventDebug);
document.body.addEventListener("touchstart", keyboardMouseEventDebug);
document.body.addEventListener("touchmove", keyboardMouseEventDebug);
document.body.addEventListener("touchend", keyboardMouseEventDebug);
document.body.addEventListener("touchcancel", keyboardMouseEventDebug);
function keyboardMouseEventDebug(event) {
console.debug(
event.type.toUpperCase().padEnd(12)
+ (event.altKey && event.key != "Alt" ? "Alt + " : "")
+ (event.ctrlKey && event.key != "Control" ? "Control + " : "")
+ (event.metatKey && event.key != "Meta" ? "Meta + " : "")
+ (event.shiftKey && event.key != "Shift" ? "Shift + " : "")
+ (event.key !== undefined ? event.key + " " : "")
+ (event.location ? "(" + ["standard", "left", "right", "numpad", "mobile", "joystick"][event.location] + ") " : "")
+ (event.repeat === true ? "(repeat) " : "")
+ (event.button !== undefined ? ["left", "wheel", "right", "back", "forward"][event.button] + " " : "")
);
}