forked from reviewjs/annotate
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
367 lines (343 loc) · 17.2 KB
/
Copy pathindex.html
File metadata and controls
367 lines (343 loc) · 17.2 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
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Annotate + Sync — remote sync backends for annotate.js</title>
<meta name="description" content="Pluggable remote-sync backends for annotate.js: Google Sheets and Hono. Push annotations to a shared sheet or your own API." />
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link href="https://fonts.googleapis.com/css2?family=Geist:wght@400;500;600;700;800&family=Geist+Mono:wght@400;500;600&display=swap" rel="stylesheet" />
<style>
:root {
--bg: #faf8f5;
--bg-2: #f2efe8;
--card: #ffffff;
--ink: #1a1a1a;
--muted: #6b6560;
--muted-2: #8c8680;
--line: #e8e3da;
--yellow: #f5c842;
--yellow-d: #e0b32e;
--green: #22c55e;
--green-bg: #eafbf0;
--violet: #7c3aed;
--violet-bg: #f5f0ff;
--amber: #f59e0b;
--amber-bg: #fff8eb;
--radius: 10px;
--maxw: 960px;
--font: "Geist", system-ui, -apple-system, "Segoe UI", sans-serif;
--mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
font-family: var(--font);
background: var(--bg);
color: var(--ink);
line-height: 1.6;
-webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
::selection { background: var(--yellow); color: var(--ink); }
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 28px; width: 100%; }
/* nav */
nav {
position: sticky; top: 0; z-index: 50;
background: rgba(250,248,245,.88);
backdrop-filter: saturate(180%) blur(14px);
-webkit-backdrop-filter: saturate(180%) blur(14px);
border-bottom: 1px solid var(--line);
}
.nav-in {
height: 68px; display: flex; align-items: center; justify-content: space-between;
max-width: var(--maxw); margin: 0 auto; padding: 0 28px;
}
.logo { font-size: 20px; font-weight: 800; letter-spacing: -0.02em; display: flex; align-items: center; gap: 10px; }
.logo .mark {
width: 34px; height: 34px; border-radius: 8px;
background: var(--ink); color: var(--yellow);
display: inline-flex; align-items: center; justify-content: center;
font-size: 15px; font-weight: 800;
}
.logo .sub { font-size: 12px; font-weight: 500; color: var(--muted-2); margin-left: 2px; }
.nav-links { display: flex; align-items: center; gap: 24px; font-size: 14px; font-weight: 600; color: var(--muted); }
.nav-links a:hover { color: var(--ink); }
.btn {
display: inline-flex; align-items: center; gap: 8px;
font-weight: 700; font-size: 14px; border-radius: 8px;
padding: 11px 20px; cursor: pointer;
border: 1px solid transparent;
transition: background .18s, border-color .18s, transform .12s;
white-space: nowrap; font-family: inherit;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--yellow); color: var(--ink); }
.btn-primary:hover { background: var(--yellow-d); }
.btn-ghost { background: var(--card); color: var(--ink); border-color: #d5cec2; }
.btn-ghost:hover { background: var(--bg-2); }
/* hero */
.hero { padding: 80px 0 60px; text-align: center; }
.hero .eyebrow {
display: inline-flex; align-items: center; gap: 8px;
font-family: var(--mono); font-size: 12px; font-weight: 700;
letter-spacing: .14em; text-transform: uppercase; color: var(--violet);
}
.hero h1 { font-size: 48px; line-height: 1.08; font-weight: 800; margin: 18px 0 0; letter-spacing: -0.02em; }
.hero h1 mark { background: linear-gradient(transparent 58%, rgba(245,200,66,.55) 58%); color: inherit; padding: 0 3px; }
.hero .sub { font-size: 18px; line-height: 1.6; color: var(--muted); margin: 16px auto 0; max-width: 560px; }
.hero .sub code { font-family: var(--mono); font-size: 14px; color: var(--ink); background: var(--bg-2); padding: 2px 6px; border-radius: 4px; }
/* fork banner */
.fork-banner {
background: #fff8eb; border-top: 1px solid #fde68a; border-bottom: 1px solid #fde68a;
padding: 14px 0; margin-bottom: 8px;
}
.fork-banner .wrap {
display: flex; align-items: flex-start; gap: 10px;
font-size: 14px; color: #92400e; line-height: 1.55;
}
.fork-banner svg { flex: none; margin-top: 1px; color: #f59e0b; }
.fork-banner a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.fork-banner a:hover { color: #78350f; }
/* cards section */
.sec { max-width: var(--maxw); margin: 0 auto; padding: 0 28px 80px; }
.sync-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.sync-card {
background: var(--card); border: 1px solid var(--line);
border-radius: var(--radius); padding: 32px;
transition: border-color .18s, box-shadow .18s, transform .18s;
position: relative; overflow: hidden;
}
.sync-card:hover { border-color: #c4b8e8; box-shadow: 0 14px 32px -18px rgba(0,0,0,.18); transform: translateY(-2px); }
.sync-card .icon {
width: 52px; height: 52px; border-radius: 10px;
display: inline-flex; align-items: center; justify-content: center;
font-size: 24px; margin-bottom: 20px;
}
.sync-card.google .icon { background: var(--green-bg); }
.sync-card.hono .icon { background: var(--amber-bg); }
.sync-card .badge {
position: absolute; top: 28px; right: 28px;
font-size: 11px; font-weight: 700; padding: 4px 10px;
border-radius: 999px;
}
.sync-card .badge.live { background: var(--green-bg); color: #15803d; }
.sync-card .badge.soon { background: var(--amber-bg); color: #92400e; }
.sync-card h3 { font-size: 22px; font-weight: 800; margin: 0 0 8px; letter-spacing: -0.01em; }
.sync-card p { font-size: 14.5px; line-height: 1.6; color: var(--muted); margin: 0 0 20px; }
.sync-card .meta {
display: flex; align-items: center; gap: 12px; margin-top: 16px;
font-family: var(--mono); font-size: 12px; color: var(--muted-2);
background: var(--bg-2); border-radius: 6px; padding: 10px 14px;
word-break: break-all;
}
.sync-card .meta .label { font-weight: 700; color: var(--muted); flex: none; }
.sync-card .actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.sync-card.placeholder { opacity: .55; pointer-events: none; }
.sync-card.placeholder:hover { transform: none; box-shadow: none; border-color: var(--line); }
/* how it works */
.how { border-top: 1px solid var(--line); background: var(--bg-2); }
.how-in { max-width: var(--maxw); margin: 0 auto; padding: 72px 28px; }
.how-in h2 { font-size: 32px; font-weight: 800; letter-spacing: -0.01em; margin: 0 0 8px; }
.how-in .lead { font-size: 16px; color: var(--muted-2); max-width: 560px; margin: 0 0 36px; }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.step {
background: var(--card); border: 1px solid var(--line);
border-radius: var(--radius); padding: 24px;
}
.step .n {
width: 32px; height: 32px; border-radius: 8px;
background: var(--ink); color: var(--yellow);
display: inline-flex; align-items: center; justify-content: center;
font-size: 13px; font-weight: 800; margin-bottom: 14px;
}
.step h4 { font-size: 16px; font-weight: 700; margin: 0 0 6px; }
.step p { font-size: 13.5px; line-height: 1.6; color: var(--muted); }
.step code { font-family: var(--mono); font-size: 12px; background: var(--bg-2); padding: 1px 5px; border-radius: 4px; }
/* code demo */
.code-demo { margin-top: 44px; }
.code-demo .tabs { display: flex; gap: 0; margin-bottom: 0; }
.code-demo .tab {
font-size: 13px; font-weight: 600; padding: 9px 18px;
border: 1px solid var(--line); border-bottom: none;
border-radius: 8px 8px 0 0; cursor: pointer;
background: var(--bg-2); color: var(--muted-2);
transition: background .15s, color .15s;
}
.code-demo .tab.active { background: var(--card); color: var(--ink); }
.code-window {
background: #0c0e12; border: 1px solid #2a2d33; border-radius: 0 8px 8px 8px;
padding: 20px 24px; font-family: var(--mono); font-size: 13px;
line-height: 1.8; color: #e6e6ea; overflow-x: auto;
min-height: 84px; position: relative;
}
.code-window .line { white-space: pre; }
.code-window .line .tag { color: #f5c842; }
.code-window .line .attr { color: #93c5fd; }
.code-window .line .val { color: #a5d6a7; }
.code-window .line .cmt { color: #6b7280; font-style: italic; }
.code-window .cursor { display: inline-block; width: 8px; height: 15px; background: #e6e6ea; vertical-align: middle; margin-left: 1px; animation: blink .8s step-end infinite; }
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:0} }
/* footer */
footer { border-top: 1px solid var(--line); background: var(--bg-2); }
.foot { max-width: var(--maxw); margin: 0 auto; padding: 40px 28px; text-align: center; font-size: 13px; color: var(--muted-2); }
.foot a { color: var(--violet); }
.foot a:hover { text-decoration: underline; }
@media (max-width: 720px) {
.sync-grid { grid-template-columns: 1fr; }
.steps { grid-template-columns: 1fr; }
.hero h1 { font-size: 34px; }
.hero .sub { font-size: 16px; }
.nav-links { display: none; }
}
</style>
</head>
<body>
<nav>
<div class="nav-in">
<a class="logo" href="#">
<span class="mark">↗↘</span>
<span>Annotate <span style="font-weight:400;color:var(--muted)">+</span> Sync</span>
</a>
<div class="nav-links">
<a href="#sync">Sync backends</a>
<a href="#how">How it works</a>
</div>
<a class="btn btn-ghost" href="https://github.com/jan5o7o/annotate-sync" target="_blank" rel="noopener">
<svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="M12 2C6.5 2 2 6.6 2 12.3c0 4.5 2.9 8.4 6.8 9.7.5.1.7-.2.7-.5v-1.7c-2.8.6-3.4-1.4-3.4-1.4-.5-1.2-1.1-1.5-1.1-1.5-.9-.6.1-.6.1-.6 1 .1 1.5 1 1.5 1 .9 1.6 2.4 1.1 3 .9.1-.7.4-1.1.6-1.4-2.2-.3-4.6-1.1-4.6-5 0-1.1.4-2 1-2.7-.1-.3-.4-1.3.1-2.7 0 0 .8-.3 2.7 1a9.4 9.4 0 0 1 5 0c1.9-1.3 2.7-1 2.7-1 .5 1.4.2 2.4.1 2.7.6.7 1 1.6 1 2.7 0 3.9-2.4 4.7-4.6 5 .4.3.7.9.7 1.9v2.8c0 .3.2.6.7.5A10.1 10.1 0 0 0 22 12.3C22 6.6 17.5 2 12 2z"/></svg>
GitHub
</a>
</div>
</nav>
<header class="hero">
<div class="wrap">
<div class="eyebrow">annotate.js plugins</div>
<h1>Remote sync <mark>with or without a backend</mark></h1>
<p class="sub">Pluggable sync adapters for <code>annotate.js</code>. Push annotations to Google Sheets or your own Hono API — no server required.</p>
</div>
</header>
<div class="fork-banner">
<div class="wrap">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M6 3v12"/><circle cx="18" cy="6" r="3"/><circle cx="6" cy="18" r="3"/><path d="M18 9a9 9 0 0 1-9 9"/></svg>
<span><strong>Community fork</strong> — not an official feature of <a href="https://github.com/reviewjs/annotate" target="_blank" rel="noopener">reviewjs/annotate</a>. This is an independent project adding remote sync backends.</span>
</div>
</div>
<section class="sec" id="sync">
<div class="sync-grid">
<!-- Google Sheets -->
<div class="sync-card google">
<span class="badge live">Live</span>
<div class="icon">
<svg width="28" height="28" viewBox="0 0 24 24" fill="none" stroke="#15803d" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="3" width="18" height="18" rx="2"/><line x1="3" y1="9" x2="21" y2="9"/><line x1="3" y1="15" x2="21" y2="15"/><line x1="9" y1="3" x2="9" y2="21"/></svg>
</div>
<h3>Google Sheets Sync</h3>
<p>Sync annotations to a shared Google Sheet in real time. Perfect for teams already using Sheets for QA, feedback, or project tracking.</p>
<div class="actions">
<a class="btn btn-primary" href="demo/google-sheet.html">
Open demo
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><path d="M5 12h14M12 5l7 7-7 7"/></svg>
</a>
<a class="btn btn-ghost" href="google-sheet.gs" target="_blank">Apps Script source</a>
</div>
<div class="meta">
<span class="label">Endpoint</span>
<span>script.google.com/macros/s/AKfycbw38Lcoaj7AjR8IOeMIP-ypQ9WtsIXl0YBnXDwSbKN37Bl1vWvTMYX7AoCMV3lGvxxS/exec</span>
</div>
</div>
<!-- Hono -->
<div class="sync-card hono">
<span class="badge live">Live</span>
<div class="icon">
<svg width="28" height="28" viewBox="0 0 24 24" fill="none" stroke="#15803d" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><path d="M12 6v6l4 2"/></svg>
</div>
<h3>Hono Backend Sync</h3>
<p>Push annotations to your own Hono API. Full control over storage, auth, and data flow. Bring your own database.</p>
<div class="actions">
<a class="btn btn-primary" href="demo/hono.html">
Open demo
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><path d="M5 12h14M12 5l7 7-7 7"/></svg>
</a>
</div>
<div class="meta">
<span class="label">Endpoint</span>
<span>annotate-sync-hono.so7o.dev/api/sync</span>
</div>
</div>
</div>
</section>
<section class="how" id="how">
<div class="how-in">
<h2>How it works</h2>
<p class="lead">Three script tags and a URL. That's all it takes to add remote sync to annotate-sync.</p>
<div class="steps">
<div class="step">
<div class="n">1</div>
<h4>Load annotate-sync.js</h4>
<p>Drop the main <code>annotate-sync.js</code> script into your page as usual.</p>
</div>
<div class="step">
<div class="n">2</div>
<h4>Add sync plugins</h4>
<p>Include <code>sync-engine.js</code> and your chosen backend (<code>sync-google-sheet.js</code> or <code>sync-hono.js</code>).</p>
</div>
<div class="step">
<div class="n">3</div>
<h4>Configure the URL</h4>
<p>Set <code>data-google-sheet</code> or <code>data-hono-url</code> on the script tag.</p>
</div>
</div>
<div class="code-demo">
<div class="tabs">
<span class="tab active" onclick="switchTab('gsheet')">Google Sheets</span>
<span class="tab" onclick="switchTab('hono')">Hono</span>
</div>
<div class="code-window" id="codeWin"></div>
</div>
</div>
</section>
<footer>
<div class="foot">
<p>A community fork of <a href="https://github.com/reviewjs/annotate" target="_blank" rel="noopener">reviewjs/annotate</a> · MIT Licensed</p>
</div>
</footer>
<script>
var lines = {
gsheet: [
'<span class="tag"><script</span> <span class="attr">src</span>=<span class="val">"./annotate-sync.js"</span>',
' <span class="attr">data-google-sheet</span>=<span class="val">"<URL>"</span> <span class="attr">defer</span><span class="tag">></script></span>',
'<span class="tag"><script</span> <span class="attr">src</span>=<span class="val">"./sync-engine.js"</span> <span class="attr">defer</span><span class="tag">></script></span> <span class="cmt"><!-- required --></span>',
'<span class="tag"><script</span> <span class="attr">src</span>=<span class="val">"./sync-google-sheet.js"</span> <span class="attr">defer</span><span class="tag">></script></span>',
],
hono: [
'<span class="tag"><script</span> <span class="attr">src</span>=<span class="val">"./annotate-sync.js"</span>',
' <span class="attr">data-hono-url</span>=<span class="val">"https://your-server.com/api/sync"</span> <span class="attr">defer</span><span class="tag">></script></span>',
'<span class="tag"><script</span> <span class="attr">src</span>=<span class="val">"./sync-engine.js"</span> <span class="attr">defer</span><span class="tag">></script></span> <span class="cmt"><!-- required --></span>',
'<span class="tag"><script</span> <span class="attr">src</span>=<span class="val">"./sync-hono.js"</span> <span class="attr">defer</span><span class="tag">></script></span>',
],
};
var current = 'gsheet', charIdx = 0, lineIdx = 0, timer;
function switchTab(t) { current = t; resetType(); document.querySelectorAll('.tab').forEach(function(el,i){ el.classList.toggle('active', i===(t==='gsheet'?0:1)); }); }
function resetType() { clearTimeout(timer); lineIdx=0; charIdx=0; document.getElementById('codeWin').innerHTML=''; typeNext(); }
function typeNext() {
var win = document.getElementById('codeWin');
var list = lines[current];
if (lineIdx >= list.length) return;
var target = list[lineIdx];
if (charIdx === 0) { var div=document.createElement('div'); div.className='line'; win.appendChild(div); }
if (charIdx < target.length) {
var last = win.lastChild;
last.innerHTML = target.substring(0, charIdx+1) + '<span class="cursor"></span>';
charIdx++;
timer = setTimeout(typeNext, charIdx===target.length? 200 : 8+Math.random()*16);
} else {
var last = win.lastChild;
last.innerHTML = target;
charIdx = 0; lineIdx++;
timer = setTimeout(typeNext, 60);
}
}
typeNext();
</script>
</body>
</html>