-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathscript.js
More file actions
196 lines (171 loc) · 3.8 KB
/
Copy pathscript.js
File metadata and controls
196 lines (171 loc) · 3.8 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
// Extension: Watch for DOM changes and check for the call UI to appear
let observer = new MutationObserver(function(mutations) {
mutations.forEach(function(mutation) {
if (document.querySelector('.rG0ybd') !== null) {
run();
}
})
});
observer.observe(document.body, {childList: true});
// Bookmarklet: Run when clicked
if (document.querySelector('.rG0ybd') !== null) {
run();
}
function run() {
// Find the mic button
var micButton = document.querySelector('[aria-label="Turn off microphone (⌘ + d)"]') || document.querySelector('[aria-label="Turn on microphone (⌘ + d)"]') || document.querySelector('[aria-label="Turn off microphone (ctrl + d)"]') || document.querySelector('[aria-label="Turn on microphone (ctrl + d)"]')
// Mute the mic to start
/*
if (micButton.dataset.isMuted === "false") {
micButton.click();
}
*/
var spacebarDown = false;
// Check on every key down
document.onkeydown = function(e) {
var chatField = document.getElementsByClassName("KHxj8b")[0]; // Ignore everything if the chat field is active
if (document.activeElement !== chatField && e.key === ' ' && spacebarDown == false) {
spacebarDown = true;
if (micButton.dataset.isMuted === "true") {
micButton.click();
}
}
};
// Listen for space key up and when released mute the mic
document.onkeyup = function (e) {
if (e.key === ' ' && spacebarDown == true) {
spacebarDown = false;
if (micButton.dataset.isMuted === "false") {
micButton.click();
}
}
};
// Add custom styling
const style = document.createElement('style');
style.innerHTML = `
:root {
--opacity-full: 1;
--opacity-inactive: .5;
}
/* Footer bar */
.rG0ybd {
opacity: 1;
transform: translateY(0);
transition: opacity 100ms;
transition: background-color 250ms !important;
background-color: #fff0;
box-shadow: none;
}
.rG0ybd:hover {
background-color: #00000061;
}
.rG0ybd:hover {
--opacity-inactive: .8;
}
/* Top bar */
.lvE3se, .NzPR9b {
background-color: #fff0;
transition: background-color 250ms !important;
box-shadow: none;
}
.lvE3se:hover {
background-color: #00000061;
}
/* Divider line */
.qO3Z3c {
opacity: .5;
}
/* Top Bar Icons */
.NzPR9b .NPEfkd {
color: white;
opacity: var(--opacity-inactive);
transition: opacity 250ms !important;
}
.NzPR9b .NPEfkd:hover {
opacity: var(--opacity-full);
transition: opacity 250ms !important;
}
/* Name */
.lMHHZ {
/* transform: translateY(-88px); */
background-image: none !important;
}
/* Meeting Name and Caret */
.gSlHI .SQHmX > * {
color: white;
opacity: var(--opacity-inactive);
transition: opacity 250ms;
}
.gSlHI:hover .SQHmX > * {
opacity: 1;
transition: opacity 250ms;
}
/* Video and Mic buttons */
.A00RE {
border: none;
}
.A00RE.jY9Dbb .bkbMM { /* While active */
opacity: 1;
}
.bkbMM { /* Icon */
fill: white !important;
opacity: var(--opacity-inactive);
transition: opacity 250ms !important;
}
.A00RE:hover .bkbMM {
fill: white !important;
opacity: 1;
transition: opacity 250ms !important;
}
.ZPasfd {
border-color: transparent;
}
/* Red buttons */
.uJNmj.FTMc0c {
border: none;
background-color: rgba(217, 48, 37, .6);
}
/* Raise hand */
.x4JyWe > * {
color: white;
opacity: var(--opacity-inactive);
transition: opacity 250ms;
}
.x4JyWe:hover > * {
opacity: 1;
transition: opacity 250ms;
}
/* Captions */
.n8i9t > * {
color: white;
opacity: var(--opacity-inactive);
transition: opacity 250ms;
}
.n8i9t:hover > * {
opacity: 1;
transition: opacity 250ms;
}
/* Present */
.XMjwIe > * {
color: white;
}
.XMjwIe:hover > * {
opacity: 1;
transition: opacity 250ms;
}
.o9fq9d { /* Icon */
color: white;
}
/* Kebab */
.NlWrkb {
color: white;
opacity: var(--opacity-inactive);
transition: opacity 250ms;
}
.NlWrkb:hover {
opacity: 1;
transition: opacity 250ms;
}
`;
document.head.appendChild(style);
}