-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuserscript.js
More file actions
61 lines (56 loc) · 2.41 KB
/
userscript.js
File metadata and controls
61 lines (56 loc) · 2.41 KB
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
50
51
52
53
54
55
56
57
58
59
60
61
// ==UserScript==
// @name GeoFS Flight Protection
// @namespace http://tampermonkey.net/
// @version 1.5
// @description Asks for confirmation for critical keybinds to prevent accidental flight interference.
// @author RYANAIR5719
// @match https://www.geo-fs.com/geofs.php*
// @match https://geo-fs.com/geofs.php*
// @icon https://raw.githubusercontent.com/RYANAIR5719/GeoFS-Flight-Protection/main/logo.png
// @grant none
// @updateURL https://raw.githubusercontent.com/RYANAIR5719/GeoFS-Flight-Protection/main/userscript.js
// @downloadURL https://raw.githubusercontent.com/RYANAIR5719/GeoFS-Flight-Protection/main/userscript.js
// @run-at document-start
// ==/UserScript==
(function () {
'use strict';
window.addEventListener('keydown', function (e) {
var target = e.target || e.srcElement;
if (target.tagName === 'INPUT' || target.tagName === 'TEXTAREA' || target.isContentEditable) {
return;
}
if (e.code === 'Tab') {
let userConfirmed = confirm(`Are you sure you want to teleport to the camera location?`);
if (!userConfirmed) {
e.preventDefault();
e.stopPropagation();
e.stopImmediatePropagation();
console.log(`Blocked [TAB] key press.`);
} else {
console.log(`Confirmed [TAB] key press.`);
}
}
else if (e.code === 'KeyV') {
let userConfirmed = confirm(`Are you sure you want to open replay mode?`);
if (!userConfirmed) {
e.preventDefault();
e.stopPropagation();
e.stopImmediatePropagation();
console.log(`Blocked [V] key press.`);
} else {
console.log(`Confirmed [V] key press.`);
}
}
else if (e.code === 'KeyE' && geofs.aircraft.animations.values.engineOn == true && geofs.aircraft.animations.values.groundContact == false) {
let userConfirmed = confirm(`Are you sure you want to shut down the engine?`);
if (!userConfirmed) {
e.preventDefault();
e.stopPropagation();
e.stopImmediatePropagation();
console.log(`Blocked [E] key press.`);
} else {
console.log(`Confirmed [E] key press.`);
}
}
}, true);
})();