From 69eaf8d58c10c950a8f2eaab683568960fc9b87b Mon Sep 17 00:00:00 2001 From: thonk <101288516+VillainsRule@users.noreply.github.com> Date: Mon, 18 Dec 2023 17:30:25 -0500 Subject: [PATCH 1/2] Redo iframe opening --- static/assets/scripts/home.js | 35 ++++++++++------------------------- 1 file changed, 10 insertions(+), 25 deletions(-) diff --git a/static/assets/scripts/home.js b/static/assets/scripts/home.js index 16438ad8b..20397f1ee 100644 --- a/static/assets/scripts/home.js +++ b/static/assets/scripts/home.js @@ -6,32 +6,17 @@ try { inFrame = true; }; -if (!inFrame && !navigator.userAgent.includes("Firefox")) { - const popup = open("about:blank", "_blank") - if (!popup || popup.closed) alert("Please allow popups and redirects.") - else { - const doc = popup.document - const iframe = doc.createElement("iframe") - const style = iframe.style - const link = doc.createElement("link") +if (!inFrame && !navigator.userAgent.includes('Firefox')) { + const popup = open('about:blank', '_blank') + if (!popup || popup.closed) return alert('Please allow popups and redirects.'); - const name = localStorage.getItem("name") || "My Drive - Google Drive"; - const icon = localStorage.getItem("icon") || "https://ssl.gstatic.com/assets/media/branding/product/1x/drive_2020q4_32dp.png"; - - doc.title = name; - link.rel = "icon"; - link.href = icon; - - iframe.src = location.href - style.position = "fixed" - style.top = style.bottom = style.left = style.right = 0 - style.border = style.outline = "none" - style.width = style.height = "100%" - - doc.head.appendChild(link); - doc.body.appendChild(iframe); - location.replace(localStorage.getItem('panicLink') || 'https://www.nasa.gov/'); - }; + popup.document.write(` + + ${localStorage.getItem('name') || 'My Drive - Google Drive'} + + `); + + location.replace(localStorage.getItem('panicLink') || 'https://classroom.google.com'); }; document.addEventListener("DOMContentLoaded", function(event) { From d5858113099c32b60794d7f4d53ca31de0c55cbd Mon Sep 17 00:00:00 2001 From: thonk <101288516+VillainsRule@users.noreply.github.com> Date: Mon, 18 Dec 2023 17:34:57 -0500 Subject: [PATCH 2/2] illegal return statement my *** --- static/assets/scripts/home.js | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/static/assets/scripts/home.js b/static/assets/scripts/home.js index 20397f1ee..c523dcd64 100644 --- a/static/assets/scripts/home.js +++ b/static/assets/scripts/home.js @@ -8,15 +8,16 @@ try { if (!inFrame && !navigator.userAgent.includes('Firefox')) { const popup = open('about:blank', '_blank') - if (!popup || popup.closed) return alert('Please allow popups and redirects.'); - - popup.document.write(` - - ${localStorage.getItem('name') || 'My Drive - Google Drive'} - - `); + if (!popup || popup.closed) alert('Please allow popups and redirects.'); + else { + popup.document.write(` + + ${localStorage.getItem('name') || 'My Drive - Google Drive'} + + `); - location.replace(localStorage.getItem('panicLink') || 'https://classroom.google.com'); + location.replace(localStorage.getItem('panicLink') || 'https://classroom.google.com'); + }; }; document.addEventListener("DOMContentLoaded", function(event) {