some updates to page loading performance and general performance.
added a ServiceWorker which caches stuff
This commit is contained in:
@@ -1,47 +1,67 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<html lang="en" style="height:100%;margin:0;">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1.0">
|
||||
<title>Auto Index</title>
|
||||
<script src="../../js/shared/theme.js"></script>
|
||||
<link rel="icon" type="image/x-icon" href="../../css/favicon/favicon.ico">
|
||||
<link rel="stylesheet" href="../../css/indexer.css">
|
||||
|
||||
<!-- Preload + async load -->
|
||||
<link rel="preload" as="style" href="/css/indexer.css" onload="this.rel='stylesheet'">
|
||||
<noscript><link rel="stylesheet" href="/css/indexer.css"></noscript>
|
||||
|
||||
<link rel="icon" href="/css/favicon/favicon.ico" type="image/x-icon">
|
||||
|
||||
<!-- Defer theme toggle -->
|
||||
<script src="/js/shared/theme.js" defer></script>
|
||||
|
||||
<script>
|
||||
console.log("javascript is enabled! good!");
|
||||
document.write('<h1 id="nojs" style="display: flex; align-items: center; cursor: pointer;" onclick="toggleDarkMode();"><img src="../../css/icons/folder.webp" alt="Folder icon" />Index of PyPost</h1>');
|
||||
document.addEventListener("DOMContentLoaded", () => {
|
||||
// Create heading dynamically
|
||||
const h = document.createElement("h1");
|
||||
h.id = "nojs";
|
||||
h.innerHTML = '<img src="/css/icons/folder.webp" width="40" height="40" alt="📁" loading="lazy" style="margin-right:8px;">Index of PyPost';
|
||||
h.onclick = toggleDarkMode;
|
||||
document.body.prepend(h);
|
||||
console.log("JavaScript enabled — index enhanced!");
|
||||
});
|
||||
</script>
|
||||
|
||||
<!-- Register service worker -->
|
||||
<script>
|
||||
if ('serviceWorker' in navigator) {
|
||||
navigator.serviceWorker.register('/js/post/sw.js').catch(console.error);
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<main style="flex:1;">
|
||||
<noscript>
|
||||
<div style="display: inline-flex; align-items: center; flex-wrap: wrap;">
|
||||
<img src="../../css/icons/script.webp" width="45" height="45" alt="Script icon" style="margin-right: 8px;" />
|
||||
<h1 id="nojs" style="margin: 0;">Please enable Javascript!</h1>
|
||||
</div>
|
||||
<p>
|
||||
<i><strong>If you might be wondering, what does the Script do?</strong></i><br/>
|
||||
<ul id="nonenormalul">
|
||||
<li>It strips the .HTML ending from each file you see in the list below</li>
|
||||
<li>It isn't necessary, but visually tweaks the page.</li>
|
||||
<li>It enables the "Back" Function for Headers</li>
|
||||
<li>It enables Searching and Sorting of the Page-Display</li>
|
||||
<li>It is essential for downloading Markdown-Source</li>
|
||||
</ul>
|
||||
<noscript>
|
||||
<div style="display:inline-flex;align-items:center;flex-wrap:wrap;">
|
||||
<img src="/css/icons/script.webp" width="45" height="45" alt="Script icon" style="margin-right:8px;">
|
||||
<h1 style="margin:0;">Please enable JavaScript!</h1>
|
||||
</div>
|
||||
<p>
|
||||
<i><strong>If you might be wondering, what does the Script do?</strong></i><br>
|
||||
<ul>
|
||||
<li>Strips the .HTML ending from filenames</li>
|
||||
<li>Enables search, sorting, and back navigation</li>
|
||||
<li>Allows Markdown source downloads</li>
|
||||
</ul>
|
||||
</p>
|
||||
</noscript>
|
||||
|
||||
<p id="available" style="display:flex;align-items:center;gap:8px;">
|
||||
<img src="/css/icons/available.webp" width="40" height="40" alt="Available" loading="lazy">
|
||||
<span>Available pages:</span>
|
||||
</p>
|
||||
</noscript>
|
||||
|
||||
<p id="available">
|
||||
<img src="../../css/icons/available.webp" width="40" height="40" alt="Available icon" />
|
||||
Available pages:
|
||||
</p>
|
||||
|
||||
<!-- CONTENT -->
|
||||
<!-- CONTENT -->
|
||||
|
||||
|
||||
<!-- load scripts needed for indexer -->
|
||||
<script src="../../js/normal.js"></script>
|
||||
<script src="../../js/search.js" defer></script>
|
||||
<script src="../../js/ulorder.js" defer></script>
|
||||
<!-- Core scripts: async load -->
|
||||
<script src="/js/normal.js" defer></script>
|
||||
<script src="/js/search.js" defer></script>
|
||||
<script src="/js/ulorder.js" defer></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user