mirror of
https://github.com/imputnet/cobalt.git
synced 2025-07-21 12:48:28 +00:00
Add URL search on frontend
Fixes https://github.com/wukko/cobalt/issues/364 Signed-off-by: lostydust <47502554+lostdusty@users.noreply.github.com>
This commit is contained in:
parent
e6e9f4f099
commit
60a7c48e07
@ -7,7 +7,7 @@ const isSafari = ua.match("safari/");
|
|||||||
const isFirefox = ua.match("firefox/");
|
const isFirefox = ua.match("firefox/");
|
||||||
const isOldFirefox = ua.match("firefox/") && ua.split("firefox/")[1].split('.')[0] < 103;
|
const isOldFirefox = ua.match("firefox/") && ua.split("firefox/")[1].split('.')[0] < 103;
|
||||||
|
|
||||||
const regex = new RegExp(/https:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()!@:%_\+.~#?&\/\/=]*)/);
|
const regex = new RegExp(/[-a-zA-Z0-9@:%_\+.~#?&//=]{2,256}\.[a-z]{2,4}\b(\/[-a-zA-Z0-9@:%_\+.~#?&//=]*)?/g);
|
||||||
const notification = `<div class="notification-dot"></div>`;
|
const notification = `<div class="notification-dot"></div>`;
|
||||||
|
|
||||||
const switchers = {
|
const switchers = {
|
||||||
@ -103,13 +103,13 @@ document.addEventListener("keydown", (event) => {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
function button() {
|
function button() {
|
||||||
let regexTest = regex.test(eid("url-input-area").value);
|
let regexTest = (eid("url-input-area").value).match(regex);
|
||||||
if ((eid("url-input-area").value).length > 0) {
|
if ((eid("url-input-area").value).length > 0) {
|
||||||
eid("url-clear").style.display = "block";
|
eid("url-clear").style.display = "block";
|
||||||
} else {
|
} else {
|
||||||
eid("url-clear").style.display = "none";
|
eid("url-clear").style.display = "none";
|
||||||
}
|
}
|
||||||
regexTest ? changeDownloadButton(1, '>>') : changeDownloadButton(0, '>>');
|
regexTest ? changeDownloadButton(1, '>>') : changeDownloadButton(0, '>>'); eid("url-input-area").value = regexTest[0];
|
||||||
}
|
}
|
||||||
function clearInput() {
|
function clearInput() {
|
||||||
eid("url-input-area").value = '';
|
eid("url-input-area").value = '';
|
||||||
|
Loading…
Reference in New Issue
Block a user