-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathgeofs_plugin.js
46 lines (43 loc) · 1.19 KB
/
geofs_plugin.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
///////////////////////////////////////////////////
//VOICE ATC
///////////////////////////////////////////////////
var ctrl = false;
var atc;
var TALK = false;
//var htmltoadd = '<iframe src="pg.html" style="display: none" id="webATC" onload=\'window.atc = document.getElementById("webATC");\'></iframe>';
//document.documentElement.innerHTML += htmltoadd;
document.addEventListener("keydown", function(e) {
if (e.keyCode == 81) {
if (ctrl) {
ctrl = false;
var freq = prompt("Enter frequency:");
if (atc) {
atc.close();
atc = null;
}
if (freq.length < 5) {
return;
}
atc = window.open("https://geofs-atc.appspot.com/pg.html?" + freq,'_blank', 'toolbar=no,status=no,menubar=no,scrollbars=no,resizable=no,left=10000, top=10000, width=10, height=10, visible=none', '');
}
else {
// Push to talk TRUE
if (TALK) return;
TALK = true;
atc.postMessage("talk", "*");
}
}
if (e.keyCode == 17 || e.keyCode == 87) {
ctrl = true;
}
}, false);
document.addEventListener("keyup", function(e) {
if (e.keyCode == 81) {
// Push to talk FALSE
TALK = false;
atc.postMessage("notalk", "*");
}
if (e.keyCode == 17 || e.keyCode == 87) {
ctrl = false;
}
}, false);