Lashtw commited on
Commit
2d3fe4d
·
verified ·
1 Parent(s): 22ba5a0

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +206 -63
index.html CHANGED
@@ -381,18 +381,18 @@
381
  position: fixed;
382
  bottom: 20px;
383
  right: 20px;
384
- width: 44px;
385
- height: 44px;
386
  border-radius: 50%;
387
- background: rgba(15, 23, 42, 0.7);
388
- border: 1px solid rgba(255, 255, 255, 0.15);
389
  backdrop-filter: blur(8px);
390
  display: flex;
391
  align-items: center;
392
  justify-content: center;
393
  cursor: pointer;
394
  color: #94a3b8;
395
- opacity: 0.35;
396
  transition: all 0.2s;
397
  z-index: 500;
398
  }
@@ -402,38 +402,104 @@
402
  color: #fff;
403
  }
404
 
 
 
 
405
  .modal-backdrop {
406
  display: none;
407
  position: fixed;
408
  inset: 0;
409
  background: rgba(0, 0, 0, 0.75);
410
- backdrop-filter: blur(10px);
411
  z-index: 2000;
412
  align-items: center;
413
  justify-content: center;
414
  }
415
- .modal-box {
416
  background: #1e293b;
417
- border: 1px solid rgba(255, 255, 255, 0.15);
418
- border-radius: 16px;
419
- padding: 28px;
420
- width: 340px;
421
  text-align: center;
422
  color: #fff;
 
423
  }
424
- .modal-box input {
425
- width: 100%;
426
- padding: 10px;
427
- border-radius: 8px;
428
- border: 1px solid #334155;
429
- background: #0f172a;
430
- color: #fff;
431
  font-size: 1.2rem;
432
- text-align: center;
433
- letter-spacing: 6px;
434
- margin: 15px 0 20px;
435
- outline: none;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
436
  }
 
437
  .btn {
438
  padding: 8px 16px;
439
  border-radius: 8px;
@@ -530,28 +596,48 @@
530
 
531
  <!-- 編輯模式浮動條 -->
532
  <div class="edit-banner" id="editBanner">
533
- <span style="font-size:0.85rem; color:#38bdf8;">✦ 自由排版中</span>
534
  <button class="btn btn-secondary" onclick="randomizeQuote()">隨機金句</button>
535
  <button class="btn btn-secondary" onclick="openAdminDrawer()">作息與項目</button>
536
  <button class="btn btn-success" onclick="exitEditMode()">完成並鎖定</button>
537
  </div>
538
 
539
  <!-- 齒輪按鈕 -->
540
- <div class="settings-trigger" onclick="openAuthModal()" title="開啟看板設定">
541
- <svg width="22" height="22" fill="currentColor" viewBox="0 0 24 24">
542
  <path d="M19.14 12.94c.04-.3.06-.61.06-.94 0-.32-.02-.64-.07-.94l2.03-1.58c.18-.14.23-.41.12-.61l-1.92-3.32c-.12-.22-.37-.29-.59-.22l-2.39.96c-.5-.38-1.03-.7-1.62-.94l-.36-2.54c-.04-.24-.24-.41-.48-.41h-3.84c-.24 0-.43.17-.47.41l-.36 2.54c-.59.24-1.13.57-1.62.94l-2.39-.96c-.22-.08-.47 0-.59.22L2.74 8.87c-.12.21-.08.47.12.61l2.03 1.58c-.05.3-.09.63-.09.94s.02.64.07.94l-2.03 1.58c-.18.14-.23.41-.12.61l1.92 3.32c.12.22.37.29.59.22l2.39-.96c.5.38 1.03.7 1.62.94l.36 2.54c.05.24.24.41.48.41h3.84c.24 0 .44-.17.47-.41l.36-2.54c.59-.24 1.13-.56 1.62-.94l2.39.96c.22.08.47 0 .59-.22l1.92-3.32c.12-.22.07-.47-.12-.61l-2.01-1.58zM12 15.6c-1.98 0-3.6-1.62-3.6-3.6s1.62-3.6 3.6-3.6 3.6 1.62 3.6 3.6-1.62 3.6-3.6 3.6z"/>
543
  </svg>
544
  </div>
545
 
546
- <!-- 密碼 Modal -->
547
- <div class="modal-backdrop" id="authModal">
548
- <div class="modal-box">
549
- <h3>進入看板設定</h3>
550
- <p style="color:#94a3b8; font-size:0.8rem; margin-top:6px;">請輸入管理員密碼</p>
551
- <input type="password" id="authPassword" placeholder="PIN" maxlength="6" onkeydown="if(event.key==='Enter') verifyPassword()">
552
- <div style="display:flex; justify-content:center; gap:8px;">
553
- <button class="btn btn-secondary" onclick="closeAuthModal()">取消</button>
554
- <button class="btn btn-primary" onclick="verifyPassword()">解鎖排版</button>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
555
  </div>
556
  </div>
557
  </div>
@@ -564,13 +650,12 @@
564
  </div>
565
 
566
  <div class="drawer-content">
567
- <!-- 跨環境匯出/匯入工具箱 -->
568
  <div class="setting-block" style="border: 1px solid #38bdf8;">
569
  <h4>設定資料備份與同步 (Lively 專用)</h4>
570
- <p style="font-size:0.8rem; color:#94a3b8;">在瀏覽器調整好後,點擊「匯出代碼」並複製;接著在桌面 Lively 桌布點開設定「匯入」,即可完美同步。</p>
571
  <div style="display:flex; gap:8px;">
572
- <button class="btn btn-secondary" style="flex:1;" onclick="exportConfig()">📤 匯出設定代碼</button>
573
- <button class="btn btn-primary" style="flex:1;" onclick="importConfig()">📥 匯入設定代碼</button>
574
  </div>
575
  </div>
576
 
@@ -741,22 +826,97 @@
741
  let appState = loadAppData();
742
  let isEditing = false;
743
  let isClassBreak = false;
 
744
 
745
  function loadAppData() {
746
- const saved = localStorage.getItem("classroom_dashboard_v5");
747
  return saved ? JSON.parse(saved) : DEFAULT_DATA;
748
  }
749
  function saveAppData() {
750
- localStorage.setItem("classroom_dashboard_v5", JSON.stringify(appState));
751
  }
752
 
753
- // 匯出與匯入功能
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
754
  function exportConfig() {
755
  const jsonStr = JSON.stringify(appState);
756
  navigator.clipboard.writeText(jsonStr).then(() => {
757
- alert("✓ 設定代碼已成功複製到剪貼簿!請至 Lively 桌面開啟設定並點擊「匯入」。");
758
  }).catch(() => {
759
- prompt("請手動複製以下設定代碼:", jsonStr);
760
  });
761
  }
762
 
@@ -770,12 +930,12 @@
770
  saveAppData();
771
  renderBoard();
772
  closeAdminDrawer();
773
- alert("✓ 設定代碼匯入成功,已全面更新版面!");
774
  } else {
775
- alert("資料格式不完整,請確認是否完整複製代碼。");
776
  }
777
  } catch (e) {
778
- alert("代碼解析失敗,請確認貼上的內容是否正確。");
779
  }
780
  }
781
  }
@@ -1069,23 +1229,6 @@
1069
  updateClock();
1070
  updateDailyQuote();
1071
 
1072
- function openAuthModal() {
1073
- document.getElementById("authPassword").value = "";
1074
- document.getElementById("authModal").style.display = "flex";
1075
- document.getElementById("authPassword").focus();
1076
- }
1077
- function closeAuthModal() {
1078
- document.getElementById("authModal").style.display = "none";
1079
- }
1080
- function verifyPassword() {
1081
- if (document.getElementById("authPassword").value === "902") {
1082
- closeAuthModal();
1083
- enterEditMode();
1084
- } else {
1085
- alert("密碼錯誤");
1086
- }
1087
- }
1088
-
1089
  function enterEditMode() {
1090
  isEditing = true;
1091
  document.body.classList.add("is-editing");
 
381
  position: fixed;
382
  bottom: 20px;
383
  right: 20px;
384
+ width: 48px;
385
+ height: 48px;
386
  border-radius: 50%;
387
+ background: rgba(15, 23, 42, 0.8);
388
+ border: 1.5px solid rgba(255, 255, 255, 0.25);
389
  backdrop-filter: blur(8px);
390
  display: flex;
391
  align-items: center;
392
  justify-content: center;
393
  cursor: pointer;
394
  color: #94a3b8;
395
+ opacity: 0.4;
396
  transition: all 0.2s;
397
  z-index: 500;
398
  }
 
402
  color: #fff;
403
  }
404
 
405
+ /* =========================================
406
+ 螢幕密碼盤 Modal (專門解決桌布鍵盤焦點問題)
407
+ ========================================= */
408
  .modal-backdrop {
409
  display: none;
410
  position: fixed;
411
  inset: 0;
412
  background: rgba(0, 0, 0, 0.75);
413
+ backdrop-filter: blur(12px);
414
  z-index: 2000;
415
  align-items: center;
416
  justify-content: center;
417
  }
418
+ .pin-modal-box {
419
  background: #1e293b;
420
+ border: 1px solid rgba(255, 255, 255, 0.18);
421
+ border-radius: 20px;
422
+ padding: 24px 28px;
423
+ width: 320px;
424
  text-align: center;
425
  color: #fff;
426
+ box-shadow: 0 25px 50px rgba(0,0,0,0.6);
427
  }
428
+ .pin-modal-box h3 {
 
 
 
 
 
 
429
  font-size: 1.2rem;
430
+ margin-bottom: 4px;
431
+ }
432
+ .pin-modal-box p {
433
+ font-size: 0.8rem;
434
+ color: #94a3b8;
435
+ margin-bottom: 16px;
436
+ }
437
+
438
+ /* PIN 碼顯示點 */
439
+ .pin-dots-display {
440
+ display: flex;
441
+ justify-content: center;
442
+ gap: 12px;
443
+ margin-bottom: 20px;
444
+ height: 24px;
445
+ align-items: center;
446
+ }
447
+ .pin-dot {
448
+ width: 14px;
449
+ height: 14px;
450
+ border-radius: 50%;
451
+ border: 2px solid #64748b;
452
+ background: transparent;
453
+ transition: all 0.15s ease;
454
+ }
455
+ .pin-dot.filled {
456
+ background: #38bdf8;
457
+ border-color: #38bdf8;
458
+ box-shadow: 0 0 10px rgba(56, 189, 248, 0.6);
459
+ transform: scale(1.15);
460
+ }
461
+ .pin-dot.error {
462
+ background: #ef4444;
463
+ border-color: #ef4444;
464
+ box-shadow: 0 0 10px rgba(239, 68, 68, 0.6);
465
+ }
466
+
467
+ /* 數字鍵盤網格 */
468
+ .pin-keypad {
469
+ display: grid;
470
+ grid-template-columns: repeat(3, 1fr);
471
+ gap: 10px;
472
+ margin-bottom: 16px;
473
+ }
474
+ .pin-btn {
475
+ height: 52px;
476
+ font-size: 1.35rem;
477
+ font-weight: 600;
478
+ border-radius: 12px;
479
+ border: 1px solid rgba(255, 255, 255, 0.1);
480
+ background: rgba(15, 23, 42, 0.7);
481
+ color: #f8fafc;
482
+ cursor: pointer;
483
+ display: flex;
484
+ align-items: center;
485
+ justify-content: center;
486
+ transition: all 0.15s ease;
487
+ }
488
+ .pin-btn:hover {
489
+ background: rgba(56, 189, 248, 0.2);
490
+ border-color: #38bdf8;
491
+ color: #fff;
492
+ }
493
+ .pin-btn:active {
494
+ transform: scale(0.95);
495
+ background: #38bdf8;
496
+ color: #0f172a;
497
+ }
498
+ .pin-btn.action-btn {
499
+ font-size: 1rem;
500
+ color: #94a3b8;
501
  }
502
+
503
  .btn {
504
  padding: 8px 16px;
505
  border-radius: 8px;
 
596
 
597
  <!-- 編輯模式浮動條 -->
598
  <div class="edit-banner" id="editBanner">
599
+ <span style="font-size:0.85rem; color:#38bdf8;">✦ 自由排版中:拖曳卡片或縮放邊角</span>
600
  <button class="btn btn-secondary" onclick="randomizeQuote()">隨機金句</button>
601
  <button class="btn btn-secondary" onclick="openAdminDrawer()">作息與項目</button>
602
  <button class="btn btn-success" onclick="exitEditMode()">完成並鎖定</button>
603
  </div>
604
 
605
  <!-- 齒輪按鈕 -->
606
+ <div class="settings-trigger" onclick="openPinModal()" title="開啟看板設定">
607
+ <svg width="24" height="24" fill="currentColor" viewBox="0 0 24 24">
608
  <path d="M19.14 12.94c.04-.3.06-.61.06-.94 0-.32-.02-.64-.07-.94l2.03-1.58c.18-.14.23-.41.12-.61l-1.92-3.32c-.12-.22-.37-.29-.59-.22l-2.39.96c-.5-.38-1.03-.7-1.62-.94l-.36-2.54c-.04-.24-.24-.41-.48-.41h-3.84c-.24 0-.43.17-.47.41l-.36 2.54c-.59.24-1.13.57-1.62.94l-2.39-.96c-.22-.08-.47 0-.59.22L2.74 8.87c-.12.21-.08.47.12.61l2.03 1.58c-.05.3-.09.63-.09.94s.02.64.07.94l-2.03 1.58c-.18.14-.23.41-.12.61l1.92 3.32c.12.22.37.29.59.22l2.39-.96c.5.38 1.03.7 1.62.94l.36 2.54c.05.24.24.41.48.41h3.84c.24 0 .44-.17.47-.41l.36-2.54c.59-.24 1.13-.56 1.62-.94l2.39.96c.22.08.47 0 .59-.22l1.92-3.32c.12-.22.07-.47-.12-.61l-2.01-1.58zM12 15.6c-1.98 0-3.6-1.62-3.6-3.6s1.62-3.6 3.6-3.6 3.6 1.62 3.6 3.6-1.62 3.6-3.6 3.6z"/>
609
  </svg>
610
  </div>
611
 
612
+ <!-- 螢幕數位按鍵鎖 (點擊/觸控輸入,完美克服桌布鍵盤攔截) -->
613
+ <div class="modal-backdrop" id="pinModal">
614
+ <div class="pin-modal-box">
615
+ <h3>管理員驗證</h3>
616
+ <p>請點擊螢幕按鈕輸入 PIN 碼 (預設 902)</p>
617
+
618
+ <div class="pin-dots-display" id="pinDots">
619
+ <div class="pin-dot"></div>
620
+ <div class="pin-dot"></div>
621
+ <div class="pin-dot"></div>
622
+ </div>
623
+
624
+ <div class="pin-keypad">
625
+ <button class="pin-btn" onclick="pressKey('1')">1</button>
626
+ <button class="pin-btn" onclick="pressKey('2')">2</button>
627
+ <button class="pin-btn" onclick="pressKey('3')">3</button>
628
+ <button class="pin-btn" onclick="pressKey('4')">4</button>
629
+ <button class="pin-btn" onclick="pressKey('5')">5</button>
630
+ <button class="pin-btn" onclick="pressKey('6')">6</button>
631
+ <button class="pin-btn" onclick="pressKey('7')">7</button>
632
+ <button class="pin-btn" onclick="pressKey('8')">8</button>
633
+ <button class="pin-btn" onclick="pressKey('9')">9</button>
634
+ <button class="pin-btn action-btn" onclick="clearKey()">C</button>
635
+ <button class="pin-btn" onclick="pressKey('0')">0</button>
636
+ <button class="pin-btn action-btn" onclick="backspaceKey()">⌫</button>
637
+ </div>
638
+
639
+ <div style="display:flex; justify-content:center;">
640
+ <button class="btn btn-secondary" style="width:100%;" onclick="closePinModal()">取消</button>
641
  </div>
642
  </div>
643
  </div>
 
650
  </div>
651
 
652
  <div class="drawer-content">
 
653
  <div class="setting-block" style="border: 1px solid #38bdf8;">
654
  <h4>設定資料備份與同步 (Lively 專用)</h4>
655
+ <p style="font-size:0.8rem; color:#94a3b8;">可隨時匯出設定代碼進行備份,或匯入至其他電腦。</p>
656
  <div style="display:flex; gap:8px;">
657
+ <button class="btn btn-secondary" style="flex:1;" onclick="exportConfig()">📤 匯出代碼</button>
658
+ <button class="btn btn-primary" style="flex:1;" onclick="importConfig()">📥 匯入代碼</button>
659
  </div>
660
  </div>
661
 
 
826
  let appState = loadAppData();
827
  let isEditing = false;
828
  let isClassBreak = false;
829
+ let currentPin = "";
830
 
831
  function loadAppData() {
832
+ const saved = localStorage.getItem("classroom_dashboard_v6");
833
  return saved ? JSON.parse(saved) : DEFAULT_DATA;
834
  }
835
  function saveAppData() {
836
+ localStorage.setItem("classroom_dashboard_v6", JSON.stringify(appState));
837
  }
838
 
839
+ // =========================================
840
+ // 螢幕 PIN 碼鍵盤控制邏輯
841
+ // =========================================
842
+ function openPinModal() {
843
+ currentPin = "";
844
+ updatePinDots();
845
+ document.getElementById("pinModal").style.display = "flex";
846
+ }
847
+
848
+ function closePinModal() {
849
+ document.getElementById("pinModal").style.display = "none";
850
+ currentPin = "";
851
+ }
852
+
853
+ function pressKey(num) {
854
+ if (currentPin.length < 3) {
855
+ currentPin += num;
856
+ updatePinDots();
857
+ if (currentPin.length === 3) {
858
+ setTimeout(verifyPinCode, 150);
859
+ }
860
+ }
861
+ }
862
+
863
+ function backspaceKey() {
864
+ if (currentPin.length > 0) {
865
+ currentPin = currentPin.slice(0, -1);
866
+ updatePinDots();
867
+ }
868
+ }
869
+
870
+ function clearKey() {
871
+ currentPin = "";
872
+ updatePinDots();
873
+ }
874
+
875
+ function updatePinDots(isError = false) {
876
+ const dots = document.querySelectorAll(".pin-dot");
877
+ dots.forEach((dot, idx) => {
878
+ dot.className = "pin-dot";
879
+ if (isError) {
880
+ dot.classList.add("error");
881
+ } else if (idx < currentPin.length) {
882
+ dot.classList.add("filled");
883
+ }
884
+ });
885
+ }
886
+
887
+ function verifyPinCode() {
888
+ if (currentPin === "902") {
889
+ closePinModal();
890
+ enterEditMode();
891
+ } else {
892
+ updatePinDots(true);
893
+ setTimeout(() => {
894
+ currentPin = "";
895
+ updatePinDots();
896
+ }, 500);
897
+ }
898
+ }
899
+
900
+ // 亦支援瀏覽器環境下的實體鍵盤
901
+ window.addEventListener("keydown", (e) => {
902
+ const modal = document.getElementById("pinModal");
903
+ if (modal.style.display === "flex") {
904
+ if (e.key >= "0" && e.key <= "9") {
905
+ pressKey(e.key);
906
+ } else if (e.key === "Backspace") {
907
+ backspaceKey();
908
+ } else if (e.key === "Escape") {
909
+ closePinModal();
910
+ }
911
+ }
912
+ });
913
+
914
  function exportConfig() {
915
  const jsonStr = JSON.stringify(appState);
916
  navigator.clipboard.writeText(jsonStr).then(() => {
917
+ alert("✓ 設定代碼已複製到剪貼簿!");
918
  }).catch(() => {
919
+ prompt("請手動複製設定代碼:", jsonStr);
920
  });
921
  }
922
 
 
930
  saveAppData();
931
  renderBoard();
932
  closeAdminDrawer();
933
+ alert("✓ 匯入成功!");
934
  } else {
935
+ alert("代碼格式不正確。");
936
  }
937
  } catch (e) {
938
+ alert("代碼解析失敗。");
939
  }
940
  }
941
  }
 
1229
  updateClock();
1230
  updateDailyQuote();
1231
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1232
  function enterEditMode() {
1233
  isEditing = true;
1234
  document.body.classList.add("is-editing");