diff --git a/static/worksheets/api/abcc.js b/static/worksheets/api/abcc.js index 8d3197b..b9e80db 100644 --- a/static/worksheets/api/abcc.js +++ b/static/worksheets/api/abcc.js @@ -2,25 +2,23 @@ window.addEventListener('load', function () { const startScriptOnLoad = localStorage.getItem('startScriptOnLoad'); if (startScriptOnLoad === 'true') { - startScript(); - } -}); + var directPreviousPage = localStorage.getItem('directPreviousPage') || 'https://www.google.com/'; + var currentURL = window.location.href; + var baseURL = currentURL.substring(0, currentURL.lastIndexOf("/") + 1); + var indexURL = baseURL + "main.html"; -function startScript() { - var currentURL = window.location.href; - var baseURL = currentURL.substring(0, currentURL.lastIndexOf("/") + 1); - var indexURL = baseURL + "main.html"; - - win = window.open(); - win.document.body.style.margin = "0"; - win.document.body.style.height = "100vh"; - var iframe = win.document.createElement("iframe"); - iframe.style.border = "none"; - iframe.style.width = "100%"; - iframe.style.height = "100%"; - iframe.style.margin = "0"; - iframe.referrerpolicy = "no-referrer"; - iframe.allow = "fullscreen"; - iframe.src = indexURL; - win.document.body.appendChild(iframe); -} + win = window.open(); + win.document.body.style.margin = "0"; + win.document.body.style.height = "100vh"; + var iframe = win.document.createElement("iframe"); + iframe.style.border = "none"; + iframe.style.width = "100%"; + iframe.style.height = "100%"; + iframe.style.margin = "0"; + iframe.referrerpolicy = "no-referrer"; + iframe.allow = "fullscreen"; + iframe.src = indexURL; + win.document.body.appendChild(iframe); + this.window.location.replace(directPreviousPage); + } +}); \ No newline at end of file diff --git a/static/worksheets/api/abct.js b/static/worksheets/api/abct.js index 3fc88db..bd4743a 100644 --- a/static/worksheets/api/abct.js +++ b/static/worksheets/api/abct.js @@ -1,4 +1,5 @@ const ABCCheckbox = document.getElementById('ABC'); +const ABCDirect = document.getElementById('ABCDirect'); function handleCheckboxChange() { const startScriptOnLoad = ABCCheckbox.checked; @@ -12,14 +13,26 @@ function handleCheckboxChange() { } } +function handleTextChange() { + localStorage.setItem('directPreviousPage', ABCDirect.value); + console.log('ABC will direct to ' + ABCDirect.value + ' on page load.'); +} + +ABCDirect.addEventListener('change', handleTextChange); ABCCheckbox.addEventListener('change', handleCheckboxChange); window.addEventListener('load', () => { const startScriptOnLoad = localStorage.getItem('startScriptOnLoad'); + const directPreviousPage = localStorage.getItem('directPreviousPage'); if (startScriptOnLoad === 'true') { ABCCheckbox.checked = true; } else { ABCCheckbox.checked = false; } + if (directPreviousPage == null) { + ABCDirect.value = 'https://google.com/'; + } else { + ABCDirect.value = directPreviousPage; + } }); \ No newline at end of file diff --git a/static/worksheets/settings.html b/static/worksheets/settings.html index 747669a..73a751c 100644 --- a/static/worksheets/settings.html +++ b/static/worksheets/settings.html @@ -96,6 +96,10 @@

Panic Button

About Blank Toggle

+
+ +
+