Fix non-WASM search with polyfill and optimize minified scripts
This commit is contained in:
parent
fb30f1b416
commit
5521291e5b
7 changed files with 25 additions and 6 deletions
11
package-lock.json
generated
11
package-lock.json
generated
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "gallery.badmanners.xyz",
|
||||
"version": "1.7.8",
|
||||
"version": "1.7.9",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "gallery.badmanners.xyz",
|
||||
"version": "1.7.8",
|
||||
"version": "1.7.9",
|
||||
"hasInstallScript": true,
|
||||
"dependencies": {
|
||||
"@astrojs/check": "^0.9.2",
|
||||
|
@ -20,6 +20,7 @@
|
|||
"github-slugger": "^2.0.0",
|
||||
"marked": "^14.0.0",
|
||||
"pagefind": "^1.1.0",
|
||||
"polywasm": "^0.1.4",
|
||||
"reading-time": "^1.5.0",
|
||||
"sanitize-html": "^2.13.0",
|
||||
"tailwindcss": "^3.4.9",
|
||||
|
@ -5500,6 +5501,12 @@
|
|||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/polywasm": {
|
||||
"version": "0.1.4",
|
||||
"resolved": "https://registry.npmjs.org/polywasm/-/polywasm-0.1.4.tgz",
|
||||
"integrity": "sha512-s+ugIqz8Wy5GGex0JiO6VXzAr+1SybzNSVxopKwDvtETGlNg5Wysa4njLo8f9Qczv7yBj9WZAmk4IM0vJXBusA==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/postcss": {
|
||||
"version": "8.4.39",
|
||||
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.39.tgz",
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "gallery.badmanners.xyz",
|
||||
"type": "module",
|
||||
"version": "1.7.8",
|
||||
"version": "1.7.9",
|
||||
"scripts": {
|
||||
"postinstall": "astro sync",
|
||||
"dev": "astro dev",
|
||||
|
@ -27,6 +27,7 @@
|
|||
"github-slugger": "^2.0.0",
|
||||
"marked": "^14.0.0",
|
||||
"pagefind": "^1.1.0",
|
||||
"polywasm": "^0.1.4",
|
||||
"reading-time": "^1.5.0",
|
||||
"sanitize-html": "^2.13.0",
|
||||
"tailwindcss": "^3.4.9",
|
||||
|
|
|
@ -51,7 +51,7 @@ description = "Generic icons."
|
|||
type = "icons"
|
||||
source = "https://fontawesome.com"
|
||||
license = { name = "CC-BY-4.0", url = "https://creativecommons.org/licenses/by/4.0/" }
|
||||
icons = [
|
||||
items = [
|
||||
"arrow-back",
|
||||
"arrow-up",
|
||||
"book",
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
---
|
||||
---
|
||||
|
||||
<script is:inline>(function (){let b=document,c="#modal-age-restricted",d="true",e=b.querySelector("body > "+c),f="ageVerified",g="searchParams",h=localStorage,i=new URL(b.location),j=history;i[g].get(f)===d&&(h[f]=d,j&&(i[g].delete(f),j.replaceState({},"",i)));e&&(h[f]===d?b.querySelectorAll("a[href][data-age-restricted]").forEach(x=>{let y=new URL(x.href);y[g].set(f,d);x.href=y.href}):((b.body.style.overflow="hidden"),b.querySelectorAll("body > :not("+c+")").forEach(x=>x.setAttribute("inert",d)),(e.style.display="block")))})()</script>
|
||||
<script is:inline>(a=>{let b="body > ",c="#modal-age-restricted",d="true",e="ageVerified",f="searchParams",g=localStorage,h=new URL(a.location),i=x=>a.querySelectorAll(x),j=i(b+c)[0];h[f].get(e)==d&&(g[e]=d,h[f].delete(e),history.replaceState({},"",h));j&&(g[e]==d?i("a[href][data-age-restricted]").forEach(x=>{let y=new URL(x.href);y[f].set(e,d);x.href=y}):((a.body.style.overflow="hidden"),i(b+":not("+c+")").forEach(x=>x.setAttribute("inert",d)),(j.style.display="block")))})(document)</script>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
---
|
||||
---
|
||||
|
||||
<script is:inline>(function (){var b="dark",c="auto",d="colorScheme",e=document.body.classList,f=localStorage,g=f&&f[d];g&&g!==c?g===b&&e.add(b):(f&&(f[d]=c),matchMedia("(prefers-color-scheme: dark)").matches&&e.add(b))})()</script>
|
||||
<script is:inline>(a=>{var b="dark",c="auto",d="colorScheme",e=a.body.classList,f=localStorage,g=f[d];g==c?(f[d]=c,matchMedia("(prefers-color-scheme: dark)").matches&&e.add(b)):g==b&&e.add(b)})(document)</script>
|
||||
|
|
4
src/env.d.ts
vendored
4
src/env.d.ts
vendored
|
@ -1,3 +1,7 @@
|
|||
/// <reference path="../.astro/env.d.ts" />
|
||||
/// <reference path="../.astro/types.d.ts" />
|
||||
/// <reference types="astro/client" />
|
||||
|
||||
declare module "polywasm" {
|
||||
export const WebAssembly: typeof globalThis.WebAssembly;
|
||||
}
|
|
@ -3,6 +3,13 @@ import SearchComponent from "astro-pagefind/components/Search";
|
|||
import GalleryLayout from "../layouts/GalleryLayout.astro";
|
||||
---
|
||||
|
||||
<script>
|
||||
import { WebAssembly } from "polywasm";
|
||||
if (!("WebAssembly" in globalThis)) {
|
||||
globalThis.WebAssembly = WebAssembly;
|
||||
}
|
||||
</script>
|
||||
|
||||
<GalleryLayout pageTitle="Search">
|
||||
<meta slot="head" property="og:description" content="Bad Manners || Search" />
|
||||
<h1 class="m-2 text-2xl font-semibold text-stone-800 dark:text-stone-100">Search</h1>
|
||||
|
|
Loading…
Add table
Reference in a new issue