XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet
公开
关注 0 Fork 0 Star 1
返回提交历史

XFEstudio/gpt4free

Improve qrcode scanner

f5b1b48c
hlohaus <983577+hlohaus@users.noreply.github.com>
提交于

代码差异

1 个文件 +11 -6
Modified g4f/gui/client/qrcode.html +11 -6
@@ -20,7 +20,7 @@
20 20 <h2>QR Code Scanner</h2>
21 21 <video id="video"></video>
22 22 <button id="startCamera">Start Camera</button>
23 <button id="stopScan">Stop Scanning</button>
23 <button id="stopCamera">Stop Camera</button>
24 24 <button id="switchCamera">Switch Camera</button>
25 25 <button id="toggleFlash">Toggle Flash</button>
26 26 <p id="cam-status"></p>
@@ -57,8 +57,13 @@
57 57 startCamera();
58 58 });
59 59
60 document.getElementById('stopScan').addEventListener('click', () => {
61 qrScanner.stop();
60 document.getElementById('stopCamera').addEventListener('click', () => {
61 if (currentStream) {
62 currentStream.getTracks().forEach(track => track.stop());
63 }
64 if (qrScanner) {
65 qrScanner.stop();
66 }
62 67 });
63 68
64 69 document.getElementById('toggleFlash').addEventListener('click', async () => {
@@ -120,10 +125,10 @@
120 125 video.srcObject = stream;
121 126
122 127 qrScanner = new QrScanner(videoElem, result => {
123 camStatus.innerText = 'Camera Success: ', result;
124 console.log('decoded QR code:', result.data);
128 camStatus.innerText = 'Camera Success: ' + result.data;
129 console.log('decoded QR code:', result);
125 130 if (result.data.startsWith(share_url)) {
126 location.href = result.data;
131 window.parent.location = result.data;
127 132 }
128 133 }, {
129 134 highlightScanRegion: true,