Update index.js

This commit is contained in:
Caracal.js 2022-02-24 14:47:18 -05:00 committed by GitHub
parent ee39897e60
commit 501f95a6fa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -4,7 +4,7 @@ const input = document.querySelector('input');
form.addEventListener('submit', async event => { form.addEventListener('submit', async event => {
event.preventDefault(); event.preventDefault();
window.navigator.serviceWorker.register(__uv$config.sw, { window.navigator.serviceWorker.register(__uv$config.sw, {
scope: '/' scope: __uv$config.prefix
}).then(() => { }).then(() => {
let url = input.value.trim(); let url = input.value.trim();
if (!isUrl(url)) url = 'https://www.google.com/search?q=' + url; if (!isUrl(url)) url = 'https://www.google.com/search?q=' + url;
@ -18,4 +18,4 @@ form.addEventListener('submit', async event => {
function isUrl(val = ''){ function isUrl(val = ''){
if (/^http(s?):\/\//.test(val) || val.includes('.') && val.substr(0, 1) !== ' ') return true; if (/^http(s?):\/\//.test(val) || val.includes('.') && val.substr(0, 1) !== ' ') return true;
return false; return false;
}; };