feat: add demo search input
This commit is contained in:
parent
79bdf70ea3
commit
313d34fe11
4 changed files with 41 additions and 3 deletions
16
package-lock.json
generated
16
package-lock.json
generated
|
@ -8,6 +8,7 @@
|
||||||
"name": "unduck",
|
"name": "unduck",
|
||||||
"version": "0.0.0",
|
"version": "0.0.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"prettier": "^3.5.3",
|
||||||
"vite-plugin-pwa": "^0.21.1"
|
"vite-plugin-pwa": "^0.21.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
@ -3262,6 +3263,21 @@
|
||||||
"node": "^10 || ^12 || >=14"
|
"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": {
|
"node_modules/pretty-bytes": {
|
||||||
"version": "6.1.1",
|
"version": "6.1.1",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
|
|
@ -7,10 +7,13 @@
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
"build": "tsc && vite build",
|
"build": "tsc && vite build",
|
||||||
"preview": "vite preview",
|
"preview": "vite preview",
|
||||||
|
"format:check": "prettier --check .",
|
||||||
|
"format:write": "prettier --write .",
|
||||||
"update": "npx npm-check-updates -u && npm install"
|
"update": "npx npm-check-updates -u && npm install"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"npm-check-updates": "^17.1.15",
|
"npm-check-updates": "^17.1.15",
|
||||||
|
"prettier": "^3.5.3",
|
||||||
"typescript": "~5.8.2",
|
"typescript": "~5.8.2",
|
||||||
"vite": "^6.2.0"
|
"vite": "^6.2.0"
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
:root {
|
: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;
|
font-synthesis: none;
|
||||||
text-rendering: optimizeLegibility;
|
text-rendering: optimizeLegibility;
|
||||||
-webkit-font-smoothing: antialiased;
|
-webkit-font-smoothing: antialiased;
|
||||||
|
|
21
src/main.ts
21
src/main.ts
|
@ -8,7 +8,7 @@ function noSearchDefaultPageRender() {
|
||||||
<div style="display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100vh;">
|
<div style="display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100vh;">
|
||||||
<div class="content-container">
|
<div class="content-container">
|
||||||
<h1>Und*ck</h1>
|
<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">
|
<div class="url-container">
|
||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
|
@ -20,6 +20,23 @@ function noSearchDefaultPageRender() {
|
||||||
<p>Copy</p>
|
<p>Copy</p>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</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>
|
</div>
|
||||||
<footer class="footer">
|
<footer class="footer">
|
||||||
<a href="https://github.com/troylusty/unduck" target="_blank">github</a>
|
<a href="https://github.com/troylusty/unduck" target="_blank">github</a>
|
||||||
|
@ -68,7 +85,7 @@ function getBangredirectUrl() {
|
||||||
const searchUrl = selectedBang?.u.replace(
|
const searchUrl = selectedBang?.u.replace(
|
||||||
"{{{s}}}",
|
"{{{s}}}",
|
||||||
// Replace %2F with / to fix formats like "!ghr+t3dotgg/unduck"
|
// Replace %2F with / to fix formats like "!ghr+t3dotgg/unduck"
|
||||||
encodeURIComponent(cleanQuery).replace(/%2F/g, "/")
|
encodeURIComponent(cleanQuery).replace(/%2F/g, "/"),
|
||||||
);
|
);
|
||||||
if (!searchUrl) return null;
|
if (!searchUrl) return null;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue