-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.html
More file actions
113 lines (107 loc) · 3.33 KB
/
index.html
File metadata and controls
113 lines (107 loc) · 3.33 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
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Ceres - Custom Document Renderer</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
display: flex;
justify-content: center;
align-items: flex-start; /* Align to top */
min-height: 100vh;
}
html {
overflow-x: hidden;
}
@media print {
html,
body {
min-height: auto !important;
overflow: visible !important;
}
body {
padding: 0 !important;
margin: 0 !important;
background-color: transparent !important;
display: block !important;
align-items: stretch !important;
}
}
.error-message {
color: red;
text-align: center;
}
.loading-message {
text-align: center;
color: #555;
}
</style>
<script>
if (!window.location.search) {
window.location.replace("?devMode=1");
}
</script>
</head>
<body>
<div id="documentOutput" class="loading-message">
Trying to load document...
</div>
<script>
// Minimal bootstrap: Load vendor deps + main renderer
Promise.all([
fetch("./vendor-manifest.json").then(function (r) {
if (!r.ok)
throw new Error("Failed to fetch vendor manifest: " + r.status);
return r.json();
}),
fetch("./main-manifest.json").then(function (r) {
if (!r.ok)
throw new Error("Failed to fetch main manifest: " + r.status);
return r.json();
}),
])
.then(function (results) {
var vendorManifest = results[0];
var mainManifest = results[1];
if (
!vendorManifest.handlebars ||
!vendorManifest.handlebars.js ||
!vendorManifest.handlebars.js.trim()
) {
throw new Error("Vendor manifest missing handlebars entry");
}
if (!mainManifest.js || !mainManifest.js.trim()) {
throw new Error(
"Renderer JS not found in main manifest or empty entry",
);
}
// Load Handlebars first (templates depend on window.Handlebars)
return new Promise(function (resolve, reject) {
var hbScript = document.createElement("script");
hbScript.src = "./" + vendorManifest.handlebars.js;
hbScript.onload = resolve;
hbScript.onerror = function () {
reject(new Error("Failed to load Handlebars vendor bundle"));
};
document.head.appendChild(hbScript);
}).then(function () {
// Then load the main renderer
var script = document.createElement("script");
script.src = "./" + mainManifest.js;
script.onerror = function () {
document.getElementById("documentOutput").innerHTML =
"Error: Failed to load renderer script";
};
document.head.appendChild(script);
});
})
.catch(function (err) {
document.getElementById("documentOutput").innerHTML =
"Error: " + err.message;
});
</script>
</body>
</html>