Spaces:
Running
Running
ark945 commited on
Commit ·
562aaae
1
Parent(s): 66869b1
Refactor UI: Unified quiz module & learning units dropdown with premium dark glassmorphism styling
Browse filesFiles changed (4)
- static/style.css+406-86
- templates/index.html+51-16
- templates/quiz.html+60-9
- wordApp_web.py+2-1
2 unmodified lines345678910111213141516171819201 unmodified line22232425262728293031323334353637382 unmodified lines414243444546474849505152535455565758596061626364656 unmodified lines72737475767778799 unmodified lines89909192939495969798991001011021031041051061071081091101111121 unmodified line1141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451 unmodified line1471481491501511521531541551561572 unmodified lines1601611621631641651661671681691701711721731741751761771781 unmodified line18018118218318418518618718818919019119219319419519619719819920020120220320420520620720821 unmodified lines23023123223323423523623723823924024124224316 unmodified lines2602612622632642652662 unmodified lines2692702712722732742752762772782792802812 unmodified lines28428528628728828929010 unmodified lines3013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613626 unmodified lines3693703713723733743756 unmodified lines3823833843853863873883893903913923933943953963973983994004014024 unmodified lines4074084094104114124134144154164174184194204214224234244254264274284294304312 unmodified lines--primary-color: #6366f1; /* Indigo 500 */--primary-hover: #4f46e5; /* Indigo 600 */--accent-color: #ec4899; /* Pink 500 */--bg-color: #f1f5f9; /* Slate 100 */--card-bg: #ffffff;--text-main: #1e293b; /* Slate 800 */--text-muted: #64748b; /* Slate 500 */--border-color: #cbd5e1; /* Slate 300 */--success: #22c55e;--error: #ef4444;}body {font-family: 'Segoe UI', 'Inter', system-ui, -apple-system, sans-serif;background-color: var(--bg-color);color: var(--text-main);margin: 0;padding: 20px;1 unmodified line}.container {max-width: 900px;margin: 0 auto;}.card {background: var(--card-bg);border-radius: 16px;padding: 32px;box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);margin-bottom: 24px;transition: transform 0.2s;}/* Header Specifics */2 unmodified linesflex-wrap: wrap;justify-content: space-between;align-items: center;background: linear-gradient(to right, #ffffff, #f8fafc);}h1 {color: var(--primary-color);font-size: 1.8rem;margin: 0;display: flex;align-items: center;gap: 10px;}h2 {color: var(--text-main);font-size: 1.5rem;margin-top: 0;margin-bottom: 20px;border-bottom: 2px solid var(--bg-color);padding-bottom: 10px;}/* Controls & Buttons */6 unmodified lines.user-select-wrapper {display: flex;align-items: center;background: var(--bg-color);padding: 5px 15px;border-radius: 50px;border: 1px solid var(--border-color);}9 unmodified linesfont-weight: 600;}.btn {display: inline-flex;align-items: center;justify-content: center;padding: 10px 24px;border-radius: 12px;border: none;cursor: pointer;font-weight: 600;transition: all 0.2s ease;text-decoration: none;font-size: 0.95rem;box-shadow: 0 2px 4px rgb(0 0 0 / 0.05);}.btn:hover {transform: translateY(-2px);box-shadow: 0 4px 6px rgb(0 0 0 / 0.1);}.btn:active {1 unmodified line}.btn-primary {background-color: var(--primary-color);color: white;}.btn-primary:hover {background-color: var(--primary-hover);}.btn-secondary {background-color: white;color: var(--text-main);border: 1px solid var(--border-color);}.btn-secondary:hover {background-color: var(--bg-color);color: var(--primary-color);}/* Unit List */.unit-item {display: flex;justify-content: space-between;align-items: center;padding: 20px;border: 1px solid var(--bg-color);border-radius: 12px;margin-bottom: 15px;transition: all 0.2s;1 unmodified line.unit-item:hover {border-color: var(--primary-color);background-color: #f8fafc;}.unit-name {font-size: 1.1rem;font-weight: 700;color: var(--text-main);}2 unmodified lines.word-card {text-align: center;padding: 60px 20px;}.word-main {font-size: 3.5rem;font-weight: 800;color: var(--text-main);letter-spacing: -1px;margin-bottom: 20px;}.options {display: grid;grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));gap: 20px;margin-top: 30px;}1 unmodified line.quiz-btn {padding: 25px;font-size: 1.1rem;background: white;border: 2px solid var(--bg-color);border-radius: 16px;cursor: pointer;transition: all 0.2s;color: var(--text-main);}.quiz-btn:hover {border-color: var(--primary-color);background: #e0e7ff;}.correct {background: #dcfce7 !important;border-color: #22c55e !important;color: #14532d;}.wrong {background: #fee2e2 !important;border-color: #ef4444 !important;color: #7f1d1d;}/* ==========================================21 unmodified lines}.tab-btn:hover {color: var(--primary-color);background-color: rgba(99, 102, 241, 0.05);border-radius: 8px 8px 0 0;}.tab-btn.active {color: var(--primary-color);border-bottom-color: var(--primary-color);}.tab-content {16 unmodified lineswidth: 100%;border-radius: 12px;border: 1px solid var(--border-color);box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.05);}.progress-table {2 unmodified linesborder-spacing: 0;text-align: center;font-size: 0.9rem;background: white;}.progress-table th, .progress-table td {border-right: 1px solid var(--border-color);border-bottom: 1px solid var(--border-color);padding: 10px 8px;vertical-align: middle;}2 unmodified lines}.progress-table th {background-color: #f8fafc;font-weight: 700;color: var(--text-main);}10 unmodified linestable-layout: auto;}/* Sticky 表頭 (縱向滾動固定在最上方) */.matrix-table thead th {position: sticky;top: 0;background-color: #f8fafc;z-index: 15;box-shadow: 0 2px 2px -1px rgba(0,0,0,0.1);}/* Sticky 首欄日期 (橫向滾動固定在最左邊) */.matrix-table td.sticky-col-header,.matrix-table th.sticky-col-header {position: sticky;left: 0;background-color: #f8fafc;z-index: 10;box-shadow: 2px 0 5px -2px rgba(0,0,0,0.15);border-right: 2px solid var(--border-color) !important;}/* 雙重 Sticky (左上角交角) */.matrix-table th.sticky-col-header {z-index: 30;top: 0;background-color: #f1f5f9;}/* Sticky 最下方 Summary (縱向滾動固定在最下方) */.matrix-summary-row td {position: sticky;bottom: 0;background-color: #f1f5f9;z-index: 15;box-shadow: 0 -2px 5px -2px rgba(0,0,0,0.15);font-weight: bold;border-top: 2px solid var(--border-color) !important;}/* 交角左下角的 Summary */.matrix-summary-row td.sticky-col-header {z-index: 25;left: 0;background-color: #e2e8f0 !important;}/* 週末列高亮 */.weekend-row td {background-color: #fafbfc;}.weekend-row td.date-col {background-color: #f1f5f9 !important;color: var(--primary-color);}/* 矩陣交叉格最小寬度與排列 */.matrix-cell {min-width: 130px;padding: 6px 8px !important;6 unmodified lines/* 測驗小標籤 */.progress-badge {font-size: 0.72rem;padding: 3px 6px;border-radius: 6px;white-space: nowrap;text-overflow: ellipsis;6 unmodified lines}.badge-quiz {background-color: #e0e7ff;color: #3730a3;border: 1px solid #c7d2fe;}.badge-reverse {background-color: #f3e8ff;color: #6b21a8;border: 1px solid #e9d5ff;}.badge-spelling {background-color: #fce7f3;color: #9d174d;border: 1px solid #fbcfe8;}/* Summary 欄格 */4 unmodified lines/* 個人彙總狀態標籤 */.unit-status-pill {display: inline-block;padding: 2px 8px;border-radius: 50px;font-size: 0.7rem;font-weight: 700;}.unit-status-pill.completed {background-color: #dcfce7;color: #15803d;}.unit-status-pill.in-progress {background-color: #fef3c7;color: #d97706;}.unit-status-pill.not-started {background-color: #f1f5f9;color: #64748b;}2 unmodified lines345678910111213141516171819202122232425261 unmodified line28293031323334353637383940414243444546472 unmodified lines5051525354555657585960616263646566676869707172737475767778798081828384858687888990919293946 unmodified lines1011021031041051061071089 unmodified lines1181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621 unmodified line1641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981991 unmodified line2012022032042052062072082092102112122 unmodified lines2152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512521 unmodified line25425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528621 unmodified lines30830931031131231331431531631731831932032116 unmodified lines3383393403413423433442 unmodified lines3473483493503513523533543553563573583593602 unmodified lines36336436536636736836910 unmodified lines3803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404416 unmodified lines4484494504514524534546 unmodified lines4614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974 unmodified lines5025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507512 unmodified lines--primary-color: #6366f1; /* Indigo 500 */--primary-hover: #4f46e5; /* Indigo 600 */--accent-color: #ec4899; /* Pink 500 */--bg-color: #0b0f19; /* Dark Theme Deep Blue */--card-bg: rgba(17, 24, 39, 0.7); /* Glassmorphic Translucent Dark Gray */--text-main: #f8fafc; /* Slate 50 */--text-muted: #94a3b8; /* Slate 400 */--border-color: rgba(255, 255, 255, 0.1); /* Subtle Translucent Slate */--success: #10b981; /* Emerald 500 */--error: #ef4444; /* Red 500 */}* {box-sizing: border-box;}body {font-family: 'Segoe UI', 'Inter', system-ui, -apple-system, sans-serif;background: radial-gradient(circle at 50% 0%, #1e1b4b 0%, #090d16 70%);background-color: var(--bg-color);background-attachment: fixed;color: var(--text-main);margin: 0;padding: 20px;1 unmodified line}.container {max-width: 950px;margin: 0 auto;}.card {background: var(--card-bg);backdrop-filter: blur(16px);-webkit-backdrop-filter: blur(16px);border: 1px solid var(--border-color);border-radius: 16px;padding: 32px;box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5), 0 1px 3px rgba(255, 255, 255, 0.05);margin-bottom: 24px;transition: transform 0.2s, box-shadow 0.2s;}/* Header Specifics */2 unmodified linesflex-wrap: wrap;justify-content: space-between;align-items: center;background: rgba(17, 24, 39, 0.85);border: 1px solid rgba(255, 255, 255, 0.15);}h1 {font-size: 2rem;margin: 0;display: flex;align-items: center;gap: 12px;font-weight: 800;background: linear-gradient(135deg, #a5b4fc 0%, #f472b6 100%);-webkit-background-clip: text;-webkit-text-fill-color: transparent;}h2 {color: #f8fafc;font-size: 1.5rem;margin-top: 0;margin-bottom: 20px;border-bottom: 1px solid rgba(255, 255, 255, 0.1);padding-bottom: 10px;font-weight: 700;}h3 {color: #cbd5e1;font-weight: 600;}a {color: #818cf8;text-decoration: none;transition: color 0.2s;}a:hover {color: #a5b4fc;}/* Controls & Buttons */6 unmodified lines.user-select-wrapper {display: flex;align-items: center;background: rgba(255, 255, 255, 0.05);padding: 6px 16px;border-radius: 50px;border: 1px solid var(--border-color);}9 unmodified linesfont-weight: 600;}select option {background-color: #0b0f19;color: #f8fafc;}input[type="text"], input[type="file"] {background: rgba(255, 255, 255, 0.05);border: 1px solid var(--border-color);border-radius: 12px;padding: 12px 16px;color: var(--text-main);font-size: 1rem;outline: none;transition: all 0.2s;}input[type="text"]:focus {border-color: var(--primary-color);box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);}.btn {display: inline-flex;align-items: center;justify-content: center;padding: 12px 24px;border-radius: 12px;border: none;cursor: pointer;font-weight: 700;transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);text-decoration: none;font-size: 0.95rem;box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);}.btn:hover {transform: translateY(-2px);box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.2);}.btn:active {1 unmodified line}.btn-primary {background: linear-gradient(135deg, #6366f1, #8b5cf6);color: white;box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);}.btn-primary:hover {background: linear-gradient(135deg, #4f46e5, #7c3aed);box-shadow: 0 6px 20px rgba(99, 102, 241, 0.45);}.btn-secondary {background-color: rgba(255, 255, 255, 0.05);color: var(--text-main);border: 1px solid var(--border-color);}.btn-secondary:hover {background-color: rgba(255, 255, 255, 0.1);color: #ffffff;border-color: rgba(255, 255, 255, 0.2);}/* Unit List (for study files/import list if any) */.unit-item {display: flex;justify-content: space-between;align-items: center;padding: 20px;border: 1px solid var(--border-color);background: rgba(255, 255, 255, 0.02);border-radius: 12px;margin-bottom: 15px;transition: all 0.2s;1 unmodified line.unit-item:hover {border-color: var(--primary-color);background-color: rgba(255, 255, 255, 0.05);box-shadow: 0 0 15px rgba(99, 102, 241, 0.15);}.unit-name {font-size: 1.15rem;font-weight: 700;color: var(--text-main);}2 unmodified lines.word-card {text-align: center;padding: 60px 20px;border-radius: 16px;background: rgba(255, 255, 255, 0.02);border: 1px solid var(--border-color);}.word-main {font-size: 3.5rem;font-weight: 800;color: #f8fafc;letter-spacing: -1px;margin-bottom: 20px;background: linear-gradient(135deg, #ffffff, #cbd5e1);-webkit-background-clip: text;-webkit-text-fill-color: transparent;}.pos {color: #818cf8;font-weight: 600;font-size: 1.1rem;margin-bottom: 10px;}.definition {font-size: 1.5rem;font-weight: 600;color: #e2e8f0;}.options {display: grid;grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));gap: 20px;margin-top: 30px;}1 unmodified line.quiz-btn {padding: 25px;font-size: 1.1rem;background: rgba(255, 255, 255, 0.03);border: 2px solid var(--border-color);border-radius: 16px;cursor: pointer;transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);color: var(--text-main);}.quiz-btn:hover {border-color: var(--primary-color);background: rgba(99, 102, 241, 0.15);box-shadow: 0 0 15px rgba(99, 102, 241, 0.2);transform: translateY(-2px);}.correct {background: rgba(16, 185, 129, 0.15) !important;border-color: #10b981 !important;color: #34d399 !important;box-shadow: 0 0 15px rgba(16, 185, 129, 0.3) !important;}.wrong {background: rgba(239, 68, 68, 0.15) !important;border-color: #ef4444 !important;color: #f87171 !important;box-shadow: 0 0 15px rgba(239, 68, 68, 0.3) !important;}/* ==========================================21 unmodified lines}.tab-btn:hover {color: #cbd5e1;background-color: rgba(255, 255, 255, 0.03);border-radius: 8px 8px 0 0;}.tab-btn.active {color: #818cf8;border-bottom-color: #818cf8;}.tab-content {16 unmodified lineswidth: 100%;border-radius: 12px;border: 1px solid var(--border-color);box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);}.progress-table {2 unmodified linesborder-spacing: 0;text-align: center;font-size: 0.9rem;background: rgba(15, 23, 42, 0.6);color: #e2e8f0;}.progress-table th, .progress-table td {border-right: 1px solid var(--border-color);border-bottom: 1px solid var(--border-color);padding: 12px 10px;vertical-align: middle;}2 unmodified lines}.progress-table th {background-color: rgba(30, 41, 59, 0.8);font-weight: 700;color: var(--text-main);}10 unmodified linestable-layout: auto;}/* Sticky 表頭 */.matrix-table thead th {position: sticky;top: 0;background-color: #1e293b;z-index: 15;box-shadow: 0 2px 2px -1px rgba(0, 0, 0, 0.3);}/* Sticky 首欄日期 */.matrix-table td.sticky-col-header,.matrix-table th.sticky-col-header {position: sticky;left: 0;background-color: #1e293b;z-index: 10;box-shadow: 2px 0 5px -2px rgba(0, 0, 0, 0.3);border-right: 2px solid var(--border-color) !important;}/* 雙重 Sticky */.matrix-table th.sticky-col-header {z-index: 30;top: 0;background-color: #0f172a;}/* Sticky 最下方 Summary */.matrix-summary-row td {position: sticky;bottom: 0;background-color: #0f172a;z-index: 15;box-shadow: 0 -2px 5px -2px rgba(0, 0, 0, 0.3);font-weight: bold;border-top: 2px solid var(--border-color) !important;}/* 交角左下角 */.matrix-summary-row td.sticky-col-header {z-index: 25;left: 0;background-color: #1e293b !important;}/* 週末列 */.weekend-row td {background-color: rgba(255, 255, 255, 0.01);}.weekend-row td.date-col {background-color: #1e293b !important;color: #cbd5e1;}/* 矩陣格 */.matrix-cell {min-width: 130px;padding: 6px 8px !important;6 unmodified lines/* 測驗小標籤 */.progress-badge {font-size: 0.72rem;padding: 4px 8px;border-radius: 6px;white-space: nowrap;text-overflow: ellipsis;6 unmodified lines}.badge-quiz {background-color: rgba(99, 102, 241, 0.2);color: #a5b4fc;border: 1px solid rgba(99, 102, 241, 0.4);}.badge-reverse {background-color: rgba(139, 92, 246, 0.2);color: #c084fc;border: 1px solid rgba(139, 92, 246, 0.4);}.badge-spelling {background-color: rgba(236, 72, 153, 0.2);color: #f472b6;border: 1px solid rgba(236, 72, 153, 0.4);}.progress-legend {display: flex;gap: 15px;flex-wrap: wrap;align-items: center;}.legend-item {display: flex;align-items: center;gap: 6px;font-weight: 600;font-size: 0.9rem;color: #94a3b8;}/* Summary 欄格 */4 unmodified lines/* 個人彙總狀態標籤 */.unit-status-pill {display: inline-block;padding: 4px 10px;border-radius: 50px;font-size: 0.7rem;font-weight: 700;}.unit-status-pill.completed {background-color: rgba(16, 185, 129, 0.15);color: #34d399;}.unit-status-pill.in-progress {background-color: rgba(245, 158, 11, 0.15);color: #fbbf24;}.unit-status-pill.not-started {background-color: rgba(255, 255, 255, 0.05);color: #94a3b8;}/* ==========================================5. Dropdown & Unified Quiz Styles (Premium Redesign)========================================== *//* 首頁單元下拉選單包裝 */.unit-select-wrapper-homepage {position: relative;margin-bottom: 24px;width: 100%;}.unit-select-homepage {width: 100%;padding: 16px 20px;font-size: 1.15rem;font-weight: 600;color: #f8fafc;background-color: rgba(255, 255, 255, 0.03);border: 2px solid var(--border-color);border-radius: 14px;cursor: pointer;transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);appearance: none;-webkit-appearance: none;-moz-appearance: none;background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2394a3b8'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2.5' d='M19.5 8.25l-7.5 7.5-7.5-7.5'/%3E%3C/svg%3E");background-repeat: no-repeat;background-position: right 20px center;background-size: 16px;padding-right: 48px;}.unit-select-homepage:focus {border-color: var(--primary-color);box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.25), 0 10px 15px -3px rgba(99, 102, 241, 0.1);outline: none;}/* 動態出現的單元詳細卡片 */.selected-unit-card {display: none;flex-direction: column;gap: 20px;border: 1px solid var(--border-color);border-radius: 16px;padding: 28px;background: rgba(30, 41, 59, 0.4);box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.4), 0 10px 10px -5px rgba(0, 0, 0, 0.3);animation: cardSlideUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;}@keyframes cardSlideUp {from {opacity: 0;transform: translateY(20px) scale(0.98);}to {opacity: 1;transform: translateY(0) scale(1);}}.selected-unit-card .unit-header-info {display: flex;justify-content: space-between;align-items: center;width: 100%;border-bottom: 1.5px solid rgba(255, 255, 255, 0.08);padding-bottom: 18px;}.selected-unit-card .unit-name {font-size: 1.5rem;font-weight: 800;color: #f8fafc;background: linear-gradient(135deg, #c7d2fe, #fbcfe8);-webkit-background-clip: text;-webkit-text-fill-color: transparent;}.selected-unit-card .unit-count-badge {font-size: 0.9rem;font-weight: 700;color: #a5b4fc;background: rgba(99, 102, 241, 0.2);padding: 6px 16px;border-radius: 50px;border: 1px solid rgba(99, 102, 241, 0.3);}/* 學習按鈕組 */.unit-action-group {display: flex;gap: 16px;flex-wrap: wrap;width: 100%;margin-top: 10px;}.btn-action-study {flex: 1;min-width: 140px;font-size: 1.1rem;font-weight: 700;padding: 16px 24px;border-radius: 12px;border: 2px solid rgba(255, 255, 255, 0.08);background-color: rgba(255, 255, 255, 0.03);color: #cbd5e1;cursor: pointer;display: flex;align-items: center;justify-content: center;gap: 10px;transition: all 0.2s ease;}.btn-action-study:hover {border-color: rgba(255, 255, 255, 0.2);background-color: rgba(255, 255, 255, 0.08);color: #ffffff;transform: translateY(-2px);box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);}.btn-action-quiz {flex: 1;min-width: 140px;font-size: 1.1rem;font-weight: 700;padding: 16px 24px;border-radius: 12px;border: none;background: linear-gradient(135deg, #6366f1, #8b5cf6);color: #ffffff;cursor: pointer;display: flex;align-items: center;justify-content: center;gap: 10px;transition: all 0.2s ease;box-shadow: 0 4px 14px rgba(99, 102, 241, 0.4);}.btn-action-quiz:hover {transform: translateY(-2px);box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);background: linear-gradient(135deg, #4f46e5, #7c3aed);}/* 測驗頁面模式選擇卡片 */.quiz-mode-card-container {display: grid;grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));gap: 20px;margin-top: 25px;}.quiz-mode-card {border: none;border-radius: 16px;padding: 24px;color: #ffffff;cursor: pointer;text-align: left;transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);display: flex;flex-direction: column;justify-content: space-between;min-height: 160px;box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);position: relative;overflow: hidden;}.quiz-mode-card::after {content: '';position: absolute;top: -30%;right: -30%;width: 120px;height: 120px;background: rgba(255, 255, 255, 0.1);border-radius: 50%;transition: all 0.3s ease;}.quiz-mode-card:hover::after {transform: scale(1.3);}.quiz-mode-card:hover {transform: translateY(-5px);box-shadow: 0 20px 25px -5px rgba(99, 102, 241, 0.25), 0 10px 10px -5px rgba(0, 0, 0, 0.3);}.quiz-mode-card.mode-chinese {background: linear-gradient(135deg, #6366f1, #4f46e5);}.quiz-mode-card.mode-english {background: linear-gradient(135deg, #8b5cf6, #7c3aed);}.quiz-mode-card.mode-spelling {background: linear-gradient(135deg, #ec4899, #db2777);}.quiz-mode-card-icon {font-size: 2.2rem;margin-bottom: 12px;}.quiz-mode-card-title {font-size: 1.3rem;font-weight: 700;margin-bottom: 6px;}.quiz-mode-card-desc {font-size: 0.9rem;opacity: 0.9;font-weight: normal;line-height: 1.45;}
49 unmodified lines5051525354555657585960616263646566676869707172737475767796 unmodified lines17417517617717817949 unmodified lines<div id="unit-list">{% if units %}{% for unit in units %}<div class="unit-item" style="flex-direction: column; align-items: start; gap: 15px;"><div class="unit-name"style="border-bottom: 1px solid var(--border-color); width: 100%; padding-bottom: 10px; margin-bottom: 5px;">{{ unit }}</div><div style="display: flex; gap: 8px; flex-wrap: wrap;"><a href="#" onclick="goStudy('{{ unit }}')" class="btn btn-secondary">📖 單字卡</a><a href="#" onclick="goQuiz('{{ unit }}', 'quiz')" class="btn btn-primary"style="background-color: #6366f1;">選中文</a><a href="#" onclick="goQuiz('{{ unit }}', 'reverse')" class="btn btn-primary"style="background-color: #8b5cf6;">選英文</a><a href="#" onclick="goQuiz('{{ unit }}', 'spelling')" class="btn btn-primary"style="background-color: #ec4899;">拼字</a></div></div>{% endfor %}{% else %}<div style="text-align: center; padding: 40px; color: var(--text-muted);"><p style="font-size: 4rem; margin: 0;">📭</p><p>目前還沒有單字資料庫</p><a href="{{ url_for('import_page') }}" class="btn btn-primary" style="margin-top: 10px;">立即匯入PDF</a></div>{% endif %}</div>96 unmodified lineswindow.location.href = `/quiz/${mode}/${unit}?user=${encodeURIComponent(user)}`;}// Tab 切換與進度表資料拉取邏輯function switchTab(tabId) {const btns = document.querySelectorAll('.tab-btn');49 unmodified lines505152535455565758596061626364656667686970717273747576777879808196 unmodified lines17817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321449 unmodified lines<div id="unit-list">{% if units %}<div class="unit-select-wrapper-homepage"><select id="unitSelector" class="unit-select-homepage" onchange="selectUnit(this.value)"><option value="">📚 請選擇學習單元...</option>{% for unit in units %}<option value="{{ unit }}">{{ unit }}</option>{% endfor %}</select></div><!-- 動態呈現所選單元的卡片 --><div id="selected-unit-card" class="selected-unit-card"><div class="unit-header-info"><div id="selected-unit-name" class="unit-name">--</div><span id="selected-unit-count" class="unit-count-badge">0 單字</span></div><p style="color: var(--text-muted); font-size: 0.95rem; margin: 5px 0; font-weight: 500;">請選擇學習模式或進入測驗:</p><div class="unit-action-group"><button id="btn-go-study" class="btn-action-study">📖 單字卡</button><button id="btn-go-quiz" class="btn-action-quiz">✏️ 測驗模式</button></div></div>{% else %}<div style="text-align: center; padding: 40px; color: var(--text-muted);"><p style="font-size: 4rem; margin: 0;">📭</p><p>目前還沒有單字資料庫</p><a href="{{ url_for('import_page') }}" class="btn btn-primary" style="margin-top: 10px;">立即匯入 PDF</a></div>{% endif %}</div>96 unmodified lineswindow.location.href = `/quiz/${mode}/${unit}?user=${encodeURIComponent(user)}`;}function goUnifiedQuiz(unit) {const user = document.getElementById('currentUser').value;window.location.href = `/quiz/${unit}?user=${encodeURIComponent(user)}`;}async function selectUnit(unit) {const card = document.getElementById('selected-unit-card');if (!unit) {card.style.display = 'none';return;}document.getElementById('selected-unit-name').innerText = unit;document.getElementById('selected-unit-count').innerText = '⏳ 載入中...';// Set buttons click handlersdocument.getElementById('btn-go-study').onclick = () => goStudy(unit);document.getElementById('btn-go-quiz').onclick = () => goUnifiedQuiz(unit);card.style.display = 'flex';try {const res = await fetch(`/api/words/${unit}`);const words = await res.json();document.getElementById('selected-unit-count').innerText = `${words.length} 個單字`;} catch (e) {console.error(e);document.getElementById('selected-unit-count').innerText = '載入失敗';}}// Tab 切換與進度表資料拉取邏輯function switchTab(tabId) {const btns = document.querySelectorAll('.tab-btn');
39 unmodified lines4041424344454625 unmodified lines7273747576777879808182838485868788899091929394959697989910086 unmodified lines18718818919019119218 unmodified lines21121221321421521653 unmodified lines27027127227327427527639 unmodified lines<body><div class="container"><div class="card" id="quiz-container"><h2 id="unit-title">正在載入試題...</h2><div id="progress" style="margin-bottom: 10px;"></div>25 unmodified lineslet currentIndex = 0;let score = 0;let wrongWords = [];async function init() {const res = await fetch(`/api/words/${unit}`);words = await res.json();shuffle(words);renderQuestion();}function shuffle(array) {array.sort(() => Math.random() - 0.5);}const mode = "{{ mode }}"; // 'quiz', 'reverse', 'spelling'// Define mode logicconst isSpelling = mode === 'spelling';const isReverse = mode === 'reverse';function renderQuestion() {if (currentIndex >= words.length) return finishQuiz();const target = words[currentIndex];document.getElementById('unit-title').innerText = `正在測試 (${modeText(mode)}):${unit}`;document.getElementById('progress').innerText = `進度:${currentIndex + 1} / ${words.length}`;// 1. Setup Question Display86 unmodified linesinput.disabled = true;const target = words[currentIndex];if (userVal.toLowerCase() === target.word.toLowerCase()) {score++;18 unmodified linesasync function checkAnswer(selected, correct, btn) {const btns = document.querySelectorAll('.quiz-btn');btns.forEach(b => b.disabled = true);if (selected.word === correct.word) {score++;53 unmodified linesunit: unit,score: score,total: words.length,mode: modeText(mode),user_name: currentUser, // Pass user name to backendwrong_words_list: wrongWords})39 unmodified lines404142434445464748495051525354555657585960616263646566676869707172737475767725 unmodified lines10310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814986 unmodified lines23623723823924024124218 unmodified lines26126226326426526626753 unmodified lines32132232332432532632739 unmodified lines<body><div class="container"><!-- 模式選擇畫面 --><div id="mode-select-container" class="card" style="display: none; max-width: 800px; margin: 0 auto;"><a href="/" style="display: inline-block; text-decoration: none; color: var(--text-muted); font-weight: 600; margin-bottom: 20px;">← 返回首頁</a><h2 style="margin-bottom: 5px; border-bottom: none; padding-bottom: 0; color: var(--text-main); font-weight: 800;">✏️ 選擇測驗模式</h2><p style="color: var(--text-muted); margin-bottom: 25px;">單元:<strong id="mode-select-unit-name" style="color: var(--primary-color);"></strong></p><div class="quiz-mode-card-container"><div onclick="selectQuizMode('quiz')" class="quiz-mode-card mode-chinese"><div class="quiz-mode-card-icon">📚</div><div><div class="quiz-mode-card-title">選中文</div><div class="quiz-mode-card-desc">給予英文單字,選出正確的中文解釋。</div></div></div><div onclick="selectQuizMode('reverse')" class="quiz-mode-card mode-english"><div class="quiz-mode-card-icon">🔍</div><div><div class="quiz-mode-card-title">選英文</div><div class="quiz-mode-card-desc">給予中文定義,選出正確的英文單字。</div></div></div><div onclick="selectQuizMode('spelling')" class="quiz-mode-card mode-spelling"><div class="quiz-mode-card-icon">✍️</div><div><div class="quiz-mode-card-title">拼字測驗</div><div class="quiz-mode-card-desc">播放英文發音並提供中文提示,拼寫單字。</div></div></div></div></div><div class="card" id="quiz-container" style="display: none;"><h2 id="unit-title">正在載入試題...</h2><div id="progress" style="margin-bottom: 10px;"></div>25 unmodified lineslet currentIndex = 0;let score = 0;let wrongWords = [];let activeMode = "{{ mode }}"; // 'quiz', 'reverse', 'spelling' or 'None'async function init() {if (activeMode && activeMode !== "None" && activeMode !== "unified" && activeMode !== "") {document.getElementById('mode-select-container').style.display = 'none';document.getElementById('quiz-container').style.display = 'block';startQuiz();} else {document.getElementById('quiz-container').style.display = 'none';document.getElementById('mode-select-container').style.display = 'block';document.getElementById('mode-select-unit-name').innerText = unit;}}function selectQuizMode(chosenMode) {activeMode = chosenMode;document.getElementById('mode-select-container').style.display = 'none';document.getElementById('quiz-container').style.display = 'block';startQuiz();}async function startQuiz() {const res = await fetch(`/api/words/${unit}`);words = await res.json();shuffle(words);renderQuestion();}// Shuffle questionsfunction shuffle(array) {array.sort(() => Math.random() - 0.5);}function renderQuestion() {if (currentIndex >= words.length) return finishQuiz();const target = words[currentIndex];const isSpelling = activeMode === 'spelling';const isReverse = activeMode === 'reverse';document.getElementById('unit-title').innerText = `正在測試 (${modeText(activeMode)}):${unit}`;document.getElementById('progress').innerText = `進度:${currentIndex + 1} / ${words.length}`;// 1. Setup Question Display86 unmodified linesinput.disabled = true;const target = words[currentIndex];const isSpelling = activeMode === 'spelling';if (userVal.toLowerCase() === target.word.toLowerCase()) {score++;18 unmodified linesasync function checkAnswer(selected, correct, btn) {const btns = document.querySelectorAll('.quiz-btn');btns.forEach(b => b.disabled = true);const isReverse = activeMode === 'reverse';if (selected.word === correct.word) {score++;53 unmodified linesunit: unit,score: score,total: words.length,mode: modeText(activeMode),user_name: currentUser, // Pass user name to backendwrong_words_list: wrongWords})
372 unmodified lines373374375376377378379380372 unmodified linesdef study_mode(unit):return render_template('study.html', unit=unit)@app.route('/quiz/<mode>/<unit>')def quiz_mode(mode, unit):return render_template('quiz.html', mode=mode, unit=unit)@app.route('/import_page')372 unmodified lines373374375376377378379380381372 unmodified linesdef study_mode(unit):return render_template('study.html', unit=unit)@app.route('/quiz/<unit>')@app.route('/quiz/<mode>/<unit>')def quiz_mode(unit, mode=None):return render_template('quiz.html', mode=mode, unit=unit)@app.route('/import_page')
static/style.css+406-86
templates/index.html+51-16
templates/quiz.html+60-9
wordApp_web.py+2-1