Adicionar opção para carregamento delayed (apos n segundos)
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
(() => {
|
||||
const params = new URLSearchParams(location.search);
|
||||
const destUrl = params.get('url');
|
||||
const loadDelay = params.get('load_delay'); // seconds, or null
|
||||
|
||||
if (!destUrl) {
|
||||
document.querySelector('.label').textContent = 'No URL provided.';
|
||||
@@ -17,7 +18,13 @@
|
||||
function navigate() {
|
||||
if (navigated) return;
|
||||
navigated = true;
|
||||
location.replace(destUrl);
|
||||
if( destUrl.indexOf('chrome://')==0 ) {
|
||||
document.querySelector('.ring').style.display = 'none';
|
||||
document.querySelector('.label').textContent = 'Cant load url';
|
||||
}
|
||||
else {
|
||||
location.replace(destUrl);
|
||||
}
|
||||
}
|
||||
|
||||
// "Load now" button — immediate bypass
|
||||
@@ -36,4 +43,8 @@
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if( loadDelay!=null ) {
|
||||
setTimeout(navigate, loadDelay*1000);
|
||||
}
|
||||
})();
|
||||
|
||||
Reference in New Issue
Block a user