Create constants.js

This commit is contained in:
foxster-mp4
2023-08-14 19:54:25 -07:00
parent 0600fea618
commit 4c0a10419b
8 changed files with 23 additions and 11 deletions

12
js/constants.js Normal file
View File

@@ -0,0 +1,12 @@
//
// constants.js
// altsource-viewer (https://github.com/therealFoxster/altsource-viewer)
//
// Copyright (c) 2023 Foxster.
// MIT License.
//
export const urlSearchParams = new URLSearchParams(window.location.search);
export const sourceURL = urlSearchParams.get('source')?.replaceAll("+", "%2B");
// https://stackoverflow.com/a/8943487
export const urlRegex = /(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig;