-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathembed-example.html
More file actions
76 lines (70 loc) · 2.19 KB
/
Copy pathembed-example.html
File metadata and controls
76 lines (70 loc) · 2.19 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>BLIP Embed Example</title>
<style>
body { font-family: monospace; background: #1a1a1a; color: #ccc; padding: 20px; }
h1 { color: #00FF94; }
.embed-container { margin: 20px 0; border: 1px solid #333; }
pre { background: #111; padding: 16px; overflow-x: auto; font-size: 13px; line-height: 1.6; }
code { color: #00FF94; }
.log { margin-top: 20px; padding: 12px; background: #111; border: 1px solid #333; min-height: 100px; font-size: 12px; }
.log p { margin: 4px 0; color: #888; }
</style>
</head>
<body>
<h1>BLIP Embed Demo</h1>
<p>Below is a BLIP chat widget embedded via iframe.</p>
<div class="embed-container">
<iframe
src="https://blip-blip.vercel.app/embed"
width="400"
height="600"
style="border: none;"
allow="clipboard-write"
></iframe>
</div>
<h2>Usage</h2>
<pre><code><iframe
src="https://blip-blip.vercel.app/embed"
width="400"
height="600"
style="border: none;"
allow="clipboard-write"
></iframe>
<script>
window.addEventListener('message', (e) => {
if (e.origin !== 'https://blip-blip.vercel.app') return;
const { type, roomId, shareUrl } = e.data;
switch (type) {
case 'blip:ready':
console.log('BLIP widget loaded');
break;
case 'blip:room-created':
console.log('Room created:', roomId);
console.log('Share URL:', shareUrl);
break;
case 'blip:room-joined':
console.log('Joined room:', roomId);
break;
case 'blip:room-destroyed':
console.log('Room destroyed:', roomId);
break;
}
});
</script></code></pre>
<h2>Events Log</h2>
<div class="log" id="log"></div>
<script>
const log = document.getElementById('log');
window.addEventListener('message', (e) => {
if (!e.data || !e.data.type || !e.data.type.startsWith('blip:')) return;
const p = document.createElement('p');
p.textContent = `[${new Date().toLocaleTimeString()}] ${JSON.stringify(e.data)}`;
log.prepend(p);
});
</script>
</body>
</html>