Some improvements
This commit is contained in:
parent
82dd6fd398
commit
46e69ad87b
6 changed files with 134 additions and 69 deletions
|
@ -1,6 +1,15 @@
|
|||
import { v4 as uuidv4 } from "https://jspm.dev/uuid"
|
||||
import { type } from "./utils.js"
|
||||
|
||||
const input = document.querySelector("#go-input")
|
||||
|
||||
input.addEventListener("keydown", (event) => {
|
||||
if (event.code == "Space") {
|
||||
event.preventDefault()
|
||||
type("-")
|
||||
} else if (!/^[-a-z0-9]+$/i.test(event.key)) event.preventDefault()
|
||||
})
|
||||
|
||||
const setHref = () =>
|
||||
(document.querySelector("#go").href = input.value || uuidv4())
|
||||
|
||||
|
|
Reference in a new issue