feat: add demo search input

This commit is contained in:
Troy 2025-03-06 23:00:05 +00:00
parent 79bdf70ea3
commit 313d34fe11
Signed by: troy
GPG key ID: DFC06C02ED3B4711
4 changed files with 41 additions and 3 deletions

16
package-lock.json generated
View file

@ -8,6 +8,7 @@
"name": "unduck",
"version": "0.0.0",
"dependencies": {
"prettier": "^3.5.3",
"vite-plugin-pwa": "^0.21.1"
},
"devDependencies": {
@ -3262,6 +3263,21 @@
"node": "^10 || ^12 || >=14"
}
},
"node_modules/prettier": {
"version": "3.5.3",
"resolved": "https://registry.npmjs.org/prettier/-/prettier-3.5.3.tgz",
"integrity": "sha512-QQtaxnoDJeAkDvDKWCLiwIXkTgRhwYDEQCghU9Z6q03iyek/rxRh/2lC3HB7P8sWT2xC/y5JDctPLBIGzHKbhw==",
"license": "MIT",
"bin": {
"prettier": "bin/prettier.cjs"
},
"engines": {
"node": ">=14"
},
"funding": {
"url": "https://github.com/prettier/prettier?sponsor=1"
}
},
"node_modules/pretty-bytes": {
"version": "6.1.1",
"license": "MIT",

View file

@ -7,10 +7,13 @@
"dev": "vite",
"build": "tsc && vite build",
"preview": "vite preview",
"format:check": "prettier --check .",
"format:write": "prettier --write .",
"update": "npx npm-check-updates -u && npm install"
},
"devDependencies": {
"npm-check-updates": "^17.1.15",
"prettier": "^3.5.3",
"typescript": "~5.8.2",
"vite": "^6.2.0"
},

View file

@ -1,5 +1,7 @@
:root {
font-family: system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
font-family:
system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif,
"Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
font-synthesis: none;
text-rendering: optimizeLegibility;
-webkit-font-smoothing: antialiased;

View file

@ -8,7 +8,7 @@ function noSearchDefaultPageRender() {
<div style="display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100vh;">
<div class="content-container">
<h1>Und*ck</h1>
<p>DuckDuckGo's bang redirects are too slow. Add the following URL as a custom search engine to your browser. Enables <a href="https://duckduckgo.com/bang.html" target="_blank">all of DuckDuckGo's bangs.</a></p>
<p>DuckDuckGo's bang redirects are too slow. Add the following URL as a custom search engine to your browser. Enables <a href="https://duckduckgo.com/bangs" target="_blank">all of DuckDuckGo's bangs.</a></p>
<div class="url-container">
<input
type="text"
@ -20,6 +20,23 @@ function noSearchDefaultPageRender() {
<p>Copy</p>
</button>
</div>
<details style="margin-top: 16px;">
<summary>Demo search</summary>
<p>Added so that some browsers treat this page as a search engine</p>
<form class="url-container">
<input
type="text"
name="q"
class="url-input"
placeholder="doom on typescript types !yt"
role="searchbox"
/>
<button type="submit" class="copy-button">
<p>Search</p>
</button>
</form>
</details>
</div>
</div>
<footer class="footer">
<a href="https://github.com/troylusty/unduck" target="_blank">github</a>
@ -68,7 +85,7 @@ function getBangredirectUrl() {
const searchUrl = selectedBang?.u.replace(
"{{{s}}}",
// Replace %2F with / to fix formats like "!ghr+t3dotgg/unduck"
encodeURIComponent(cleanQuery).replace(/%2F/g, "/")
encodeURIComponent(cleanQuery).replace(/%2F/g, "/"),
);
if (!searchUrl) return null;