-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathtest.html
More file actions
324 lines (290 loc) · 9.17 KB
/
test.html
File metadata and controls
324 lines (290 loc) · 9.17 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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Proofly Test Page - All Editable Elements</title>
<script>
(function () {
const prefersDark =
window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches;
const theme = prefersDark ? 'dark' : 'light';
if (theme === 'dark') {
document.documentElement.setAttribute('data-theme', 'dark');
} else {
document.documentElement.removeAttribute('data-theme');
}
})();
</script>
<style>
:root {
/* light theme variables */
--bg: #f5f5f5;
--card: #ffffff;
--text: #333333;
--muted: #666666;
--accent: #1976d2;
--input-border: #dddddd;
--placeholder: #999999;
--info-bg: #e3f2fd;
--info-text: #1976d2;
}
[data-theme='dark'] {
/* dark theme variables */
--bg: #0f1720;
--card: #0b1220;
--text: #e6eef8;
--muted: #9aa8bf;
--accent: #60a5fa;
--input-border: #233042;
--placeholder: #7b8aa3;
--info-bg: #07263b;
--info-text: #8fc2ff;
}
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
max-width: 800px;
margin: 0 auto;
padding: 20px;
background: var(--bg);
color: var(--text);
}
.section {
background: var(--card);
padding: 20px;
margin-bottom: 20px;
border-radius: 8px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.06);
}
h1 {
color: var(--text);
text-align: center;
/* removed grid layout from h1 - header will handle layout */
margin: 0;
}
.page-header {
display: grid;
justify-items: center;
gap: 10px;
grid-template-columns: auto 1fr auto;
align-items: center;
margin-bottom: 20px;
}
h1 img {
grid-column: 1;
}
h1 span {
grid-column: 2;
}
.theme-controls {
grid-column: 3;
display: flex;
gap: 8px;
align-items: center;
}
.theme-toggle {
width: 40px;
height: 40px;
border: 2px solid var(--input-border);
border-radius: 4px;
background: var(--card);
}
.visually-hidden {
position: absolute !important;
height: 1px;
width: 1px;
overflow: hidden;
clip: rect(1px, 1px, 1px, 1px);
white-space: nowrap;
border: 0;
padding: 0;
margin: -1px;
}
h2 {
color: var(--muted);
margin-top: 0;
font-size: 16px;
text-transform: uppercase;
letter-spacing: 1px;
}
input[type='text'],
input[type='email'],
textarea {
width: 100%;
padding: 12px;
font-size: 16px;
border: 2px solid var(--input-border);
border-radius: 4px;
font-family: inherit;
box-sizing: border-box;
color: var(--text);
background: var(--card);
}
textarea {
min-height: 150px;
resize: vertical;
}
[contenteditable] {
width: 100%;
min-height: 150px;
padding: 12px;
font-size: 16px;
border: 2px solid var(--input-border);
border-radius: 4px;
background: var(--card);
box-sizing: border-box;
color: var(--text);
}
[contenteditable]:focus {
outline: none;
border-color: var(--accent);
}
input:focus,
textarea:focus {
outline: none;
border-color: var(--accent);
}
.placeholder {
color: var(--placeholder);
}
.info {
background: var(--info-bg);
padding: 12px;
border-radius: 4px;
margin-top: 30px;
font-size: 14px;
color: var(--info-text);
}
</style>
</head>
<body>
<header class="page-header">
<h1>Proofly Test Page</h1>
<div class="theme-controls" aria-hidden="false">
<button
id="theme-toggle"
class="theme-toggle"
aria-pressed="false"
aria-label="Toggle dark mode"
title="Toggle dark / light"
>
🌙
</button>
</div>
</header>
<div class="section">
<h2>1. Input Field (text)</h2>
<label for="test-input" class="visually-hidden">Input Field</label>
<input
id="test-input"
type="text"
placeholder="Type something with speling mistakes here..."
value="This are a radnom test with typicla errors"
/>
</div>
<div class="section">
<h2>2. Textarea Element</h2>
<label for="test-textarea" class="visually-hidden">Textarea element</label>
<textarea
id="test-textarea"
placeholder="Type or paste text with grammar and speling mistakes..."
>This are a radnom text with a few classic common, and typicla typso and grammar issus. the Proofreader API hopefuly finds them all. Knocking at wood and crossed.</textarea>
</div>
<div class="section">
<h2>3. ContentEditable Div</h2>
<div
id="test-contenteditable-div"
contenteditable="plaintext-only"
role="textbox"
data-placeholder="Click here to type with speling and grammer mistakes..."
>This are another test with some obvius mistakes and typicla errors that should be detected by the proofreading systm.</div>
</div>
<div class="section">
<h2>4. Email Input (ignored)</h2>
<label for="test-email" class="visually-hidden">Email Input</label>
<input
id="test-email"
type="email"
inputmode="email"
autocomplete="email"
placeholder="Type an email with mistakes..."
value="prooffly-user@exampl,com"
/>
</div>
<div class="section">
<h2>5. Spellcheck Disabled Input (ignored)</h2>
<label for="test-spellcheck-disabled" class="visually-hidden">Spellcheck Disabled Input</label>
<input
id="test-spellcheck-disabled"
type="text"
spellcheck="false"
placeholder="Spellcheck is disabled here..."
value="This field shoud not be proofred"
/>
</div>
<div class="info">
<strong>Testing Instructions:</strong>
<ol style="margin: 10px 0; padding-left: 20px">
<li>Make sure the Proofly extension is loaded in Chrome and you've completed your onboarding</li>
<li>Type or edit text in each field above</li>
<li>Wait 1.5 seconds for proofreading to trigger</li>
<li>Verify highlights appear correctly on all editable elements except the email field</li>
<li>Click on highlights to see issue cards</li>
<li>Test applying corrections</li>
<li>Update extension settings and see your preference reactively reflect on this page</li>
</ol>
</div>
<script>
// Add placeholder behavior for contenteditable
const contentEditable = document.querySelector('[contenteditable]');
const placeholder = contentEditable.getAttribute('data-placeholder');
if (contentEditable.textContent.trim() === '') {
contentEditable.innerHTML = `<span class="placeholder">${placeholder}</span>`;
}
contentEditable.addEventListener('focus', function () {
if (this.querySelector('.placeholder')) {
this.textContent = '';
}
});
contentEditable.addEventListener('blur', function () {
if (this.textContent.trim() === '') {
this.innerHTML = `<span class="placeholder">${placeholder}</span>`;
}
});
</script>
<script>
// Theme management: respects system preference, allows override via toggle, and persists choice in localStorage
(function () {
const toggleBtn = document.getElementById('theme-toggle');
const prefersDarkMQ = window.matchMedia('(prefers-color-scheme: dark)');
function applyTheme(theme) {
if (theme === 'dark') {
document.documentElement.setAttribute('data-theme', 'dark');
} else {
document.documentElement.removeAttribute('data-theme');
}
toggleBtn.setAttribute('aria-pressed', String(theme === 'dark'));
toggleBtn.textContent = theme === 'dark' ? '☀️' : '🌙';
}
function init() {
applyTheme(prefersDarkMQ.matches ? 'dark' : 'light');
if (typeof prefersDarkMQ.addEventListener === 'function') {
prefersDarkMQ.addEventListener('change', (e) => {
applyTheme(e.matches ? 'dark' : 'light');
});
}
toggleBtn.addEventListener('click', () => {
const currentIsDark = document.documentElement.getAttribute('data-theme') === 'dark';
const next = currentIsDark ? 'light' : 'dark';
applyTheme(next);
});
}
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', init);
} else {
init();
}
})();
</script>
</body>
</html>