This commit is contained in:
foxster-mp4
2023-04-30 00:33:30 -07:00
parent 09c95032fa
commit 660e88e360
13 changed files with 409 additions and 433 deletions

View File

@@ -1,16 +1,17 @@
const textField = document.querySelector("input");
(function main() {
// If source specified, go straight to home page
if (urlSearchParams.has('source') && sourceURL.match(urlRegex))
window.location.replace(`home.html?source=${sourceURL}`);
textField.addEventListener("keypress", function (event) {
// If the user presses the "Enter" key on the keyboard
if (event.key === "Enter") {
event.preventDefault();
const textField = document.querySelector("input");
textField.addEventListener("keypress", function (event) {
if (event.key === "Enter") {
event.preventDefault();
const url = textField.value;
const urlRegex = /(https?:\/\/[^ ]*)/g;
if (!url.match(urlRegex))
alert("Invalid URL.");
else
window.location.replace(`home.html?source=${url}`);
}
});
const url = textField.value;
if (!url.match(urlRegex))
alert("Invalid URL.");
else window.location.replace(`home.html?source=${url}`);
}
});
})();