add fun easter egg
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 5.6 MiB |
@@ -1392,3 +1392,33 @@ menu.addEventListener("click", async (e) => {
|
||||
});
|
||||
|
||||
loadCurrentUser();
|
||||
|
||||
// console easter egg
|
||||
(function () {
|
||||
const consoleimg = {
|
||||
load: function (src, { size = 320, color = "transparent" } = {}) {
|
||||
const reader = new FileReader();
|
||||
reader.addEventListener("load", function () {
|
||||
const style =
|
||||
"background: url('" + reader.result + "') left top no-repeat; font-size: " +
|
||||
size +
|
||||
"px; background-size: contain; background-color:" +
|
||||
color;
|
||||
console.log("%c ", style);
|
||||
}, false);
|
||||
fetch(src)
|
||||
.then((r) => r.blob())
|
||||
.then((blob) => {
|
||||
if (blob.type.indexOf("image") === 0) {
|
||||
if (blob.size > 8192 && navigator.userAgent.indexOf("Firefox") > 0)
|
||||
throw new Error("Image size too big to be displayed in Firefox.");
|
||||
return blob;
|
||||
}
|
||||
throw new Error("Valid image not found.");
|
||||
})
|
||||
.then((blob) => reader.readAsDataURL(blob))
|
||||
.catch((err) => console.warn(err.message));
|
||||
},
|
||||
};
|
||||
consoleimg.load("/assets/console.gif", { size: 320, color: "transparent" });
|
||||
})();
|
||||
|
||||
@@ -23,5 +23,6 @@ export function mimeType(path: string) {
|
||||
if (path.endsWith(".png")) return "image/png";
|
||||
if (path.endsWith(".jpg") || path.endsWith(".jpeg")) return "image/jpeg";
|
||||
if (path.endsWith(".webp")) return "image/webp";
|
||||
if (path.endsWith(".gif")) return "image/gif";
|
||||
return "application/octet-stream";
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ function assetCacheControl(relativePath: string): string {
|
||||
if (relativePath.endsWith(".min.js") || relativePath.endsWith(".min.css")) {
|
||||
return STATIC_ASSET_CACHE;
|
||||
}
|
||||
if (/\.(ico|png|jpg|jpeg|webp|woff2?|ttf|eot|svg)$/.test(relativePath)) {
|
||||
if (/\.(ico|png|jpg|jpeg|gif|webp|woff2?|ttf|eot|svg)$/.test(relativePath)) {
|
||||
return STATIC_ASSET_CACHE;
|
||||
}
|
||||
return MUTABLE_ASSET_CACHE;
|
||||
|
||||
Reference in New Issue
Block a user