-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
154 lines (138 loc) · 7.26 KB
/
Copy pathindex.html
File metadata and controls
154 lines (138 loc) · 7.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>AI Math Tutor</title>
<!-- SEO / social-sharing meta tags -->
<meta name="description" content="An AI-powered Socratic math tutor for middle and high school students. Get step-by-step guidance on any math problem." />
<meta property="og:title" content="AI Math Tutor" />
<meta property="og:description" content="Step-by-step math guidance powered by AI. Ask any math question and get guided to the answer." />
<meta property="og:type" content="website" />
<!-- Math-themed favicon (π symbol) — inline SVG data URI, no extra file needed -->
<link rel="icon" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Ctext y='.9em' font-size='90'%3E%CF%80%3C/text%3E%3C/svg%3E" />
<link rel="stylesheet" href="styles.css" />
<!-- KaTeX for math notation rendering -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.16.22/dist/katex.min.css" crossorigin="anonymous" />
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.22/dist/katex.min.js" crossorigin="anonymous"></script>
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.22/dist/contrib/auto-render.min.js" crossorigin="anonymous"></script>
</head>
<body>
<!-- Loading overlay shown while auto-login is in progress -->
<div id="loading-overlay" class="loading-overlay" style="display: none;" aria-live="polite">
<div class="loading-spinner" role="status" aria-label="Loading"></div>
<p class="loading-text">Loading…</p>
</div>
<!-- Login overlay -->
<div id="login-overlay" class="login-overlay">
<div class="login-card">
<h1>AI Math Tutor</h1>
<p class="login-subtitle">Enter your class password to get started.</p>
<form id="login-form" class="login-form">
<input
type="password"
id="login-password"
class="login-input"
placeholder="Class password"
required
autocomplete="off"
/>
<button type="submit" class="button login-button">Log In</button>
<div id="login-error" class="login-error" aria-live="polite"></div>
</form>
</div>
</div>
<!-- Main app (hidden until logged in) -->
<div class="container" id="app-container" style="display: none;">
<header class="header">
<div class="header-top">
<h1>AI Math Tutor</h1>
<button
id="dark-toggle"
class="icon-button"
title="Toggle dark mode"
aria-label="Toggle dark mode"
>🌙</button>
</div>
<p class="subtitle">
A Socratic math tutor that helps students think through problems step by step.
</p>
</header>
<main class="card">
<section id="chat" class="chat" aria-live="polite" aria-label="Chat conversation">
<!-- Initial welcome message rendered by JS -->
</section>
<form id="chat-form" class="chat-form">
<label for="user-input" class="label">Ask a math question</label>
<div class="math-toolbar" id="math-toolbar" role="toolbar" aria-label="Math symbol toolbar">
<button type="button" data-insert="^" title="Exponent" aria-label="Insert exponent">xⁿ</button>
<button type="button" id="subscript-toggle" title="Subscript mode: next number typed becomes subscript" aria-label="Toggle subscript mode">x₋</button>
<button type="button" data-insert="√()" data-cursor-offset="-1" title="Square root" aria-label="Insert square root">√</button>
<button type="button" data-insert="/" title="Fraction / division" aria-label="Insert fraction">½</button>
<button type="button" data-insert="π" title="Pi" aria-label="Insert pi">π</button>
<button type="button" data-insert="log()" data-cursor-offset="-1" title="Logarithm" aria-label="Insert logarithm">log</button>
<button type="button" data-insert="ln()" data-cursor-offset="-1" title="Natural log" aria-label="Insert natural log">ln</button>
<button type="button" data-insert="sin()" data-cursor-offset="-1" title="Sine" aria-label="Insert sine">sin</button>
<button type="button" data-insert="cos()" data-cursor-offset="-1" title="Cosine" aria-label="Insert cosine">cos</button>
<button type="button" data-insert="tan()" data-cursor-offset="-1" title="Tangent" aria-label="Insert tangent">tan</button>
<button type="button" data-insert="±" title="Plus-minus" aria-label="Insert plus-minus">±</button>
<button type="button" data-insert="≤" title="Less than or equal" aria-label="Insert less than or equal">≤</button>
<button type="button" data-insert="≥" title="Greater than or equal" aria-label="Insert greater than or equal">≥</button>
<button type="button" data-insert="∞" title="Infinity" aria-label="Insert infinity">∞</button>
<button type="button" data-insert="×" title="Multiplication" aria-label="Insert multiplication">×</button>
<button type="button" data-insert="÷" title="Division" aria-label="Insert division">÷</button>
<!-- Image / screenshot upload button -->
<button
type="button"
id="image-upload-btn"
class="upload-btn"
title="Upload an image or screenshot of a math problem"
aria-label="Upload image or screenshot of a math problem"
>📷</button>
</div>
<!-- Hidden file input for image upload -->
<input
type="file"
id="image-file-input"
accept="image/png,image/jpeg,image/gif,image/webp"
style="display: none;"
aria-hidden="true"
tabindex="-1"
/>
<textarea
id="user-input"
class="textarea"
rows="4"
placeholder="Example: How do I solve 2x + 5 = 11? (Ctrl/Cmd+Enter to send, or drag & drop / paste an image)"
></textarea>
<!-- Image preview shown after a file is selected -->
<div
id="image-preview-container"
class="image-preview-container"
style="display: none;"
aria-label="Selected image preview"
>
<img id="image-preview" class="image-preview-thumb" alt="Selected image preview" />
<button
type="button"
id="remove-image-btn"
class="remove-image-btn"
aria-label="Remove selected image"
>✕</button>
</div>
<div class="button-row">
<button type="submit" id="send-button" class="button">Send</button>
<button type="button" id="clear-button" class="button secondary">New Chat</button>
<button type="button" id="download-button" class="button secondary">Download Chat</button>
</div>
</form>
<div id="status" class="status" aria-live="polite"></div>
</main>
</div>
<!-- D3.js (required by Function Plot) -->
<script src="https://cdn.jsdelivr.net/npm/d3@7"></script>
<!-- Function Plot for graphing -->
<script src="https://cdn.jsdelivr.net/npm/function-plot@1/dist/function-plot.js"></script>
<script src="script.js"></script>
</body>
</html>