Update index.js
This commit is contained in:
parent
ee39897e60
commit
501f95a6fa
1 changed files with 2 additions and 2 deletions
4
index.js
4
index.js
|
|
@ -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;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue