Add select all button to modals

This commit is contained in:
Gabe Kangas
2021-01-20 22:05:16 -08:00
parent f3d4d095ae
commit 98b122f8c5
3 changed files with 34 additions and 7 deletions

10
web/utils/urls.ts Normal file
View File

@@ -0,0 +1,10 @@
// Stolen from https://stackoverflow.com/a/5717133
export function isValidUrl(url: string): boolean {
var pattern = new RegExp('^(https?:\\/\\/)?'+ // protocol
'((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|'+ // domain name
'((\\d{1,3}\\.){3}\\d{1,3}))'+ // OR ip (v4) address
'(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*'+ // port and path
'(\\?[;&a-z\\d%_.~+=-]*)?'+ // query string
'(\\#[-a-z\\d_]*)?$','i'); // fragment locator
return !!pattern.test(url);
}