Cleaned up a ton
This commit is contained in:
30
src/main.ts
30
src/main.ts
@@ -1,4 +1,5 @@
|
||||
import { bangs } from "./bang";
|
||||
import "./global.css";
|
||||
|
||||
const defaultBang = bangs.find((b) => b.t === "g");
|
||||
|
||||
@@ -6,9 +7,36 @@ function noSearchDefaultPageRender() {
|
||||
const app = document.querySelector<HTMLDivElement>("#app")!;
|
||||
app.innerHTML = `
|
||||
<div style="display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100vh;">
|
||||
<h1>Unduck</h1>
|
||||
<div class="content-container">
|
||||
<h1>Unduck</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>
|
||||
<div class="url-container">
|
||||
<input
|
||||
type="text"
|
||||
class="url-input"
|
||||
value="https://unduck.link/search?q={{{s}}}"
|
||||
readonly
|
||||
/>
|
||||
<button class="copy-button">
|
||||
<img src="/clipboard.svg" alt="Copy" />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
|
||||
const copyButton = app.querySelector<HTMLButtonElement>(".copy-button")!;
|
||||
const copyIcon = copyButton.querySelector("img")!;
|
||||
const urlInput = app.querySelector<HTMLInputElement>(".url-input")!;
|
||||
|
||||
copyButton.addEventListener("click", async () => {
|
||||
await navigator.clipboard.writeText(urlInput.value);
|
||||
copyIcon.src = "/clipboard-check.svg";
|
||||
|
||||
setTimeout(() => {
|
||||
copyIcon.src = "/clipboard.svg";
|
||||
}, 2000);
|
||||
});
|
||||
}
|
||||
|
||||
function getBangredirectUrl() {
|
||||
|
Reference in New Issue
Block a user