Spaces:
Running
Running
Update index.html
Browse files- index.html +11 -3
index.html
CHANGED
|
@@ -10,6 +10,8 @@
|
|
| 10 |
<script src="https://cdn.jsdelivr.net/npm/canvas-confetti@1.9.2/dist/confetti.browser.min.js"></script>
|
| 11 |
<!-- 載入 QR Code 產生器 -->
|
| 12 |
<script src="https://cdn.jsdelivr.net/npm/qrcode-generator/qrcode.js"></script>
|
|
|
|
|
|
|
| 13 |
<style>
|
| 14 |
/* 定義閃卡的翻轉效果 */
|
| 15 |
.flip-container {
|
|
@@ -1308,8 +1310,11 @@
|
|
| 1308 |
generateLinkBtn.disabled = true;
|
| 1309 |
|
| 1310 |
try {
|
|
|
|
| 1311 |
const wordsString = JSON.stringify(words);
|
| 1312 |
-
const
|
|
|
|
|
|
|
| 1313 |
const start = startRangeInput.value || '';
|
| 1314 |
const end = endRangeInput.value || '';
|
| 1315 |
const isLocked = lockSettingsCheckbox.checked;
|
|
@@ -1435,8 +1440,12 @@
|
|
| 1435 |
|
| 1436 |
if (sharedData) {
|
| 1437 |
try {
|
| 1438 |
-
|
|
|
|
|
|
|
|
|
|
| 1439 |
const sharedWords = JSON.parse(decodedWordsString);
|
|
|
|
| 1440 |
if (Array.isArray(sharedWords) && sharedWords.length > 0) {
|
| 1441 |
words = sharedWords.map(word => ({ ...word, proficiency: 0, incorrectCount: 0 }));
|
| 1442 |
saveWordsToStorage();
|
|
@@ -1521,4 +1530,3 @@
|
|
| 1521 |
</body>
|
| 1522 |
</html>
|
| 1523 |
|
| 1524 |
-
|
|
|
|
| 10 |
<script src="https://cdn.jsdelivr.net/npm/canvas-confetti@1.9.2/dist/confetti.browser.min.js"></script>
|
| 11 |
<!-- 載入 QR Code 產生器 -->
|
| 12 |
<script src="https://cdn.jsdelivr.net/npm/qrcode-generator/qrcode.js"></script>
|
| 13 |
+
<!-- 【已新增】載入 Pako 壓縮函式庫 -->
|
| 14 |
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/pako/2.1.0/pako.min.js"></script>
|
| 15 |
<style>
|
| 16 |
/* 定義閃卡的翻轉效果 */
|
| 17 |
.flip-container {
|
|
|
|
| 1310 |
generateLinkBtn.disabled = true;
|
| 1311 |
|
| 1312 |
try {
|
| 1313 |
+
// 【已修改】使用 pako 壓縮資料
|
| 1314 |
const wordsString = JSON.stringify(words);
|
| 1315 |
+
const compressedData = pako.deflate(wordsString);
|
| 1316 |
+
const base64Words = btoa(String.fromCharCode.apply(null, compressedData));
|
| 1317 |
+
|
| 1318 |
const start = startRangeInput.value || '';
|
| 1319 |
const end = endRangeInput.value || '';
|
| 1320 |
const isLocked = lockSettingsCheckbox.checked;
|
|
|
|
| 1440 |
|
| 1441 |
if (sharedData) {
|
| 1442 |
try {
|
| 1443 |
+
// 【已修改】使用 pako 解壓縮資料
|
| 1444 |
+
const binaryString = atob(sharedData);
|
| 1445 |
+
const compressedData = new Uint8Array(binaryString.length).map((_, i) => binaryString.charCodeAt(i));
|
| 1446 |
+
const decodedWordsString = pako.inflate(compressedData, { to: 'string' });
|
| 1447 |
const sharedWords = JSON.parse(decodedWordsString);
|
| 1448 |
+
|
| 1449 |
if (Array.isArray(sharedWords) && sharedWords.length > 0) {
|
| 1450 |
words = sharedWords.map(word => ({ ...word, proficiency: 0, incorrectCount: 0 }));
|
| 1451 |
saveWordsToStorage();
|
|
|
|
| 1530 |
</body>
|
| 1531 |
</html>
|
| 1532 |
|
|
|