Repository navigation
Expand file tree
/
Copy pathoutput.html
More file actions
90 lines (86 loc) · 2.55 KB
/
Copy pathoutput.html
File metadata and controls
90 lines (86 loc) · 2.55 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
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Creative Output</title>
<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=Inter:wght@400;500&display=swap" rel="stylesheet" />
<style>
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
background: #000;
overflow: hidden;
font-family: 'Inter', sans-serif;
width: 100vw;
height: 100vh;
}
canvas {
display: block;
width: 100%;
height: 100%;
}
#fullscreen-btn {
position: fixed;
top: 12px;
right: 12px;
z-index: 100;
background: rgba(255,255,255,0.1);
backdrop-filter: blur(10px);
border: 1px solid rgba(255,255,255,0.15);
color: #fff;
padding: 8px 14px;
border-radius: 8px;
cursor: pointer;
font-size: 13px;
font-family: 'Inter', sans-serif;
transition: all 0.2s ease;
opacity: 0;
}
body:hover #fullscreen-btn { opacity: 1; }
#fullscreen-btn:hover {
background: rgba(255,255,255,0.2);
transform: scale(1.05);
}
</style>
</head>
<body>
<canvas id="output-canvas"></canvas>
<button id="fullscreen-btn">⛶ 全屏</button>
<script type="module">
const canvas = document.getElementById('output-canvas');
const ctx = canvas.getContext('2d');
const fsBtn = document.getElementById('fullscreen-btn');
function resize() {
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
}
window.addEventListener('resize', resize);
resize();
// Fullscreen toggle
fsBtn.addEventListener('click', () => {
if (!document.fullscreenElement) {
document.documentElement.requestFullscreen();
} else {
document.exitFullscreen();
}
});
// Listen for render data from parent
window.addEventListener('message', (e) => {
if (e.data && e.data.type === 'render') {
const img = new Image();
img.onload = () => {
ctx.clearRect(0, 0, canvas.width, canvas.height);
ctx.drawImage(img, 0, 0, canvas.width, canvas.height);
};
img.src = e.data.dataUrl;
}
});
// Notify parent we're ready
if (window.opener) {
window.opener.postMessage({ type: 'output-ready', windowId: new URLSearchParams(location.search).get('id') }, '*');
}
</script>
</body>
</html>