Update index.html
Browse files- index.html +5 -7
index.html
CHANGED
|
@@ -3,7 +3,7 @@
|
|
| 3 |
<head>
|
| 4 |
<meta charset="UTF-8">
|
| 5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
-
<title>سازنده و خواننده QR Code (نسخه
|
| 7 |
<style>
|
| 8 |
body {
|
| 9 |
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
|
|
@@ -200,7 +200,9 @@
|
|
| 200 |
</div>
|
| 201 |
|
| 202 |
<script>
|
| 203 |
-
|
|
|
|
|
|
|
| 204 |
|
| 205 |
// گرفتن ارجاع به عناصر HTML
|
| 206 |
const generateBtn = document.getElementById('generate-btn');
|
|
@@ -285,12 +287,11 @@
|
|
| 285 |
|
| 286 |
readBtn.disabled = true;
|
| 287 |
readResultP.textContent = 'در حال خواندن تصویر...';
|
|
|
|
| 288 |
readResultP.classList.add('loader');
|
| 289 |
-
// حذف دکمه کپی قبلی
|
| 290 |
const oldCopyBtn = readResultBox.querySelector('.copy-btn');
|
| 291 |
if(oldCopyBtn) oldCopyBtn.remove();
|
| 292 |
|
| 293 |
-
|
| 294 |
const reader = new FileReader();
|
| 295 |
reader.readAsDataURL(file);
|
| 296 |
reader.onload = async () => {
|
|
@@ -300,7 +301,6 @@
|
|
| 300 |
"fn_index": 1,
|
| 301 |
"data": [fileDataUrl]
|
| 302 |
};
|
| 303 |
-
// نمایش بخشی از کد بیس۶۴ برای جلوگیری از شلوغی
|
| 304 |
readReqPayload.textContent = JSON.stringify({...payload, data: [fileDataUrl.substring(0, 50) + '...'] }, null, 2);
|
| 305 |
readResPayload.textContent = "در حال دریافت پاسخ...";
|
| 306 |
|
|
@@ -323,7 +323,6 @@
|
|
| 323 |
readResultP.textContent = decodedText || "متنی در QR Code یافت نشد.";
|
| 324 |
readResultP.classList.remove('loader');
|
| 325 |
|
| 326 |
-
// افزودن دکمه کپی در صورت موفقیتآمیز بودن
|
| 327 |
if (decodedText) {
|
| 328 |
const copyBtn = document.createElement('button');
|
| 329 |
copyBtn.textContent = 'کپی متن';
|
|
@@ -332,7 +331,6 @@
|
|
| 332 |
readResultBox.appendChild(copyBtn);
|
| 333 |
}
|
| 334 |
|
| 335 |
-
|
| 336 |
} catch (error) {
|
| 337 |
console.error('Error reading QR code:', error);
|
| 338 |
readResultP.textContent = `خطا: ${error.message}`;
|
|
|
|
| 3 |
<head>
|
| 4 |
<meta charset="UTF-8">
|
| 5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>سازنده و خواننده QR Code (نسخه نهایی)</title>
|
| 7 |
<style>
|
| 8 |
body {
|
| 9 |
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
|
|
|
|
| 200 |
</div>
|
| 201 |
|
| 202 |
<script>
|
| 203 |
+
// *** خط زیر اصلاح شد ***
|
| 204 |
+
// آدرس API صحیح برای اسپیس Elias207/QRcode
|
| 205 |
+
const API_URL = "https://elias207-qrcode.hf.space/run/predict/";
|
| 206 |
|
| 207 |
// گرفتن ارجاع به عناصر HTML
|
| 208 |
const generateBtn = document.getElementById('generate-btn');
|
|
|
|
| 287 |
|
| 288 |
readBtn.disabled = true;
|
| 289 |
readResultP.textContent = 'در حال خواندن تصویر...';
|
| 290 |
+
readResultP.style.color = 'inherit';
|
| 291 |
readResultP.classList.add('loader');
|
|
|
|
| 292 |
const oldCopyBtn = readResultBox.querySelector('.copy-btn');
|
| 293 |
if(oldCopyBtn) oldCopyBtn.remove();
|
| 294 |
|
|
|
|
| 295 |
const reader = new FileReader();
|
| 296 |
reader.readAsDataURL(file);
|
| 297 |
reader.onload = async () => {
|
|
|
|
| 301 |
"fn_index": 1,
|
| 302 |
"data": [fileDataUrl]
|
| 303 |
};
|
|
|
|
| 304 |
readReqPayload.textContent = JSON.stringify({...payload, data: [fileDataUrl.substring(0, 50) + '...'] }, null, 2);
|
| 305 |
readResPayload.textContent = "در حال دریافت پاسخ...";
|
| 306 |
|
|
|
|
| 323 |
readResultP.textContent = decodedText || "متنی در QR Code یافت نشد.";
|
| 324 |
readResultP.classList.remove('loader');
|
| 325 |
|
|
|
|
| 326 |
if (decodedText) {
|
| 327 |
const copyBtn = document.createElement('button');
|
| 328 |
copyBtn.textContent = 'کپی متن';
|
|
|
|
| 331 |
readResultBox.appendChild(copyBtn);
|
| 332 |
}
|
| 333 |
|
|
|
|
| 334 |
} catch (error) {
|
| 335 |
console.error('Error reading QR code:', error);
|
| 336 |
readResultP.textContent = `خطا: ${error.message}`;
|