Some small fixes
This commit is contained in:
parent
46e69ad87b
commit
c75b19630d
6 changed files with 28 additions and 21 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1 +1,2 @@
|
|||
package-lock.json
|
||||
node_modules
|
|
@ -4,10 +4,12 @@ import { type } from "./utils.js"
|
|||
const input = document.querySelector("#go-input")
|
||||
|
||||
input.addEventListener("keydown", (event) => {
|
||||
if (event.code == "Space") {
|
||||
if (event.keyCode == "32") {
|
||||
event.preventDefault()
|
||||
type("-")
|
||||
} else if (!/^[-a-z0-9]+$/i.test(event.key)) event.preventDefault()
|
||||
return type("-")
|
||||
}
|
||||
if (event.keyCode === 13) return (location.href = input.value)
|
||||
if (!/^[-a-z0-9]+$/i.test(event.key)) event.preventDefault()
|
||||
})
|
||||
|
||||
const setHref = () =>
|
||||
|
|
|
@ -13,11 +13,17 @@ const yourName = localStorage.getItem("name")
|
|||
if (yourName) nameDisplay.innerText = yourName
|
||||
else login.classList.remove("done")
|
||||
|
||||
if (nameButton)
|
||||
nameButton.addEventListener("click", () => {
|
||||
if (!nameInput.value) return (nameInput.required = true)
|
||||
document.querySelector("#login").classList.add("done")
|
||||
localStorage.setItem("name", nameInput.value)
|
||||
nameDisplay.innerText = nameInput.value
|
||||
socket.emit("name-change", nameInput.value)
|
||||
})
|
||||
const validate = () => {
|
||||
if (!nameInput.value) return (nameInput.required = true)
|
||||
document.querySelector("#login").classList.add("done")
|
||||
localStorage.setItem("name", nameInput.value)
|
||||
nameDisplay.innerText = nameInput.value
|
||||
socket.emit("name-change", nameInput.value)
|
||||
}
|
||||
|
||||
if (nameButton) nameButton.addEventListener("click", validate)
|
||||
if (nameInput)
|
||||
nameInput.addEventListener(
|
||||
"keydown",
|
||||
(event) => event.keyCode == "13" && validate()
|
||||
)
|
||||
|
|
|
@ -36,8 +36,6 @@ myPeer.on("open", async (id) => {
|
|||
)
|
||||
return showNoVideoPrompt()
|
||||
|
||||
console.log(error.name)
|
||||
|
||||
throw error
|
||||
}
|
||||
|
||||
|
|
|
@ -18,14 +18,14 @@
|
|||
<button class="button-circle" id="name">
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="16"
|
||||
height="16"
|
||||
width="25"
|
||||
height="25"
|
||||
fill="currentColor"
|
||||
class="bi bi-pencil"
|
||||
class="bi bi-check-circle-fill"
|
||||
viewBox="0 0 16 16"
|
||||
>
|
||||
<path
|
||||
d="M12.146.146a.5.5 0 0 1 .708 0l3 3a.5.5 0 0 1 0 .708l-10 10a.5.5 0 0 1-.168.11l-5 2a.5.5 0 0 1-.65-.65l2-5a.5.5 0 0 1 .11-.168l10-10zM11.207 2.5 13.5 4.793 14.793 3.5 12.5 1.207 11.207 2.5zm1.586 3L10.5 3.207 4 9.707V10h.5a.5.5 0 0 1 .5.5v.5h.5a.5.5 0 0 1 .5.5v.5h.293l6.5-6.5zm-9.761 5.175-.106.106-1.528 3.821 3.821-1.528.106-.106A.5.5 0 0 1 5 12.5V12h-.5a.5.5 0 0 1-.5-.5V11h-.5a.5.5 0 0 1-.468-.325z"
|
||||
d="M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0zm-3.97-3.03a.75.75 0 0 0-1.08.022L7.477 9.417 5.384 7.323a.75.75 0 0 0-1.06 1.06L6.97 11.03a.75.75 0 0 0 1.079-.02l3.992-4.99a.75.75 0 0 0-.01-1.05z"
|
||||
/>
|
||||
</svg>
|
||||
</button>
|
||||
|
|
|
@ -61,14 +61,14 @@
|
|||
<button class="button-circle">
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="16"
|
||||
height="16"
|
||||
width="25"
|
||||
height="25"
|
||||
fill="currentColor"
|
||||
class="bi bi-pencil"
|
||||
class="bi bi-check-circle-fill"
|
||||
viewBox="0 0 16 16"
|
||||
>
|
||||
<path
|
||||
d="M12.146.146a.5.5 0 0 1 .708 0l3 3a.5.5 0 0 1 0 .708l-10 10a.5.5 0 0 1-.168.11l-5 2a.5.5 0 0 1-.65-.65l2-5a.5.5 0 0 1 .11-.168l10-10zM11.207 2.5 13.5 4.793 14.793 3.5 12.5 1.207 11.207 2.5zm1.586 3L10.5 3.207 4 9.707V10h.5a.5.5 0 0 1 .5.5v.5h.5a.5.5 0 0 1 .5.5v.5h.293l6.5-6.5zm-9.761 5.175-.106.106-1.528 3.821 3.821-1.528.106-.106A.5.5 0 0 1 5 12.5V12h-.5a.5.5 0 0 1-.5-.5V11h-.5a.5.5 0 0 1-.468-.325z"
|
||||
d="M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0zm-3.97-3.03a.75.75 0 0 0-1.08.022L7.477 9.417 5.384 7.323a.75.75 0 0 0-1.06 1.06L6.97 11.03a.75.75 0 0 0 1.079-.02l3.992-4.99a.75.75 0 0 0-.01-1.05z"
|
||||
/>
|
||||
</svg>
|
||||
</button>
|
||||
|
|
Reference in a new issue