Skip to content

Commit 0a1ee2e

Browse files
authored
qr scanner ui (#247)
1 parent 693f4df commit 0a1ee2e

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed

css/content.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
left: 0;
55
width: 100%;
66
height: 100%;
7-
background: rgba(0, 0, 0, 0.6);
7+
background: rgba(255, 255, 255, 0.6);
88
z-index: 1000000;
99
display: none;
1010
cursor: crosshair;
@@ -20,6 +20,6 @@
2020

2121
#__ga_captureBox__ {
2222
position: absolute;
23-
border: white 1px dashed;
23+
border: black 1px dashed;
2424
display: none;
2525
}

src/content.ts

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,8 @@ function pasteCode(code: string) {
207207
}
208208
}
209209

210-
const activeInputBox = document.activeElement.tagName === 'INPUT' ?
210+
const activeInputBox =
211+
document.activeElement && document.activeElement.tagName === 'INPUT' ?
211212
document.activeElement :
212213
null;
213214
if (activeInputBox) {
@@ -221,3 +222,18 @@ function pasteCode(code: string) {
221222
firstInputBox.value = code;
222223
return;
223224
}
225+
226+
window.onkeydown = (event) => {
227+
if (event.keyCode === 27) {
228+
event.preventDefault();
229+
const grayLayout = document.getElementById('__ga_grayLayout__');
230+
const captureBox = document.getElementById('__ga_captureBox__');
231+
232+
if (grayLayout) {
233+
grayLayout.style.display = 'none';
234+
}
235+
if (captureBox) {
236+
captureBox.style.display = 'none';
237+
}
238+
}
239+
};

0 commit comments

Comments
 (0)