117 lines
3.1 KiB
HTML
117 lines
3.1 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<title>QuestPDF Previewer</title>
|
|
|
|
<style>
|
|
html {
|
|
background-color: #333;
|
|
}
|
|
|
|
body {
|
|
margin: 0;
|
|
}
|
|
|
|
embed {
|
|
border: none;
|
|
|
|
position: absolute;
|
|
|
|
left: 0;
|
|
top: 0;
|
|
|
|
width: 100%;
|
|
height: 100%;
|
|
}
|
|
|
|
.alert {
|
|
position: absolute;
|
|
top: 0;
|
|
left: 0;
|
|
right: 0;
|
|
width: 100%;
|
|
padding: 8px 16px;
|
|
color: #FFFA;
|
|
font-family: sans-serif;
|
|
font-size: 14px;
|
|
line-height: 1.5;
|
|
box-shadow: 0 5px 5px -3px rgba(0,0,0,.2),0 8px 10px 1px rgba(0,0,0,.14),0 3px 14px 2px rgba(0,0,0,.12) !important;
|
|
}
|
|
|
|
#recommended-alert {
|
|
background-color: #616161;
|
|
}
|
|
|
|
#recommended-alert .close {
|
|
color: #FFF;
|
|
cursor: pointer;
|
|
}
|
|
|
|
#connection-issue-alert {
|
|
visibility: hidden;
|
|
background-color: #B71C1C;
|
|
color: white;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
|
|
<embed id="previewer" src="/render#toolbar=0&scrollbar=0" />
|
|
|
|
<div id="recommended-alert" class="alert">
|
|
The recommended browser for this previewer is Microsoft Edge. It does preserve document scroll position when refreshing document, giving better overall experience.
|
|
<a class="close" onclick="closeRecommendation()">Click to close</a>
|
|
</div>
|
|
|
|
<div id="connection-issue-alert" class="alert">
|
|
Cannot connect to QuestPDF previewer host. Possibly your debugging session has ended. Please close this browser.
|
|
</div>
|
|
|
|
<script>
|
|
const recommendationAlert = document.getElementById("recommended-alert");
|
|
const connectionIssueAlert = document.getElementById("connection-issue-alert");
|
|
|
|
function closeRecommendation() {
|
|
recommendationAlert.parentElement.removeChild(recommendationAlert);
|
|
localStorage.setItem("show-recommendation-alert", 'false');
|
|
}
|
|
|
|
function refreshRecommendation() {
|
|
const showRecommendation = localStorage.getItem("show-recommendation-alert");
|
|
|
|
if (showRecommendation !== 'false')
|
|
return;
|
|
|
|
recommendationAlert.parentElement.removeChild(recommendationAlert);
|
|
}
|
|
|
|
function changeConnectionIssueAlertVisibility(show) {
|
|
connectionIssueAlert.style.setProperty("visibility", show ? "visible" : "hidden");
|
|
}
|
|
|
|
async function refreshDocumentLoop() {
|
|
window.addEventListener("change", () => reloading = true);
|
|
|
|
while (true) {
|
|
try {
|
|
const response = await fetch('/listen');
|
|
const value = await response.text();
|
|
|
|
if (value === "true")
|
|
window.location.reload();
|
|
|
|
changeConnectionIssueAlertVisibility(false);
|
|
}
|
|
catch {
|
|
changeConnectionIssueAlertVisibility(true);
|
|
}
|
|
}
|
|
}
|
|
|
|
refreshRecommendation();
|
|
refreshDocumentLoop();
|
|
</script>
|
|
|
|
</body>
|
|
</html> |