Skip to content

Commit

Permalink
Merge pull request #396 from astralevolution/main
Browse files Browse the repository at this point in the history
option to disable ab cloaking in settings
  • Loading branch information
xbubbo authored Jan 24, 2024
2 parents 91e2c45 + b51674b commit afaa7fd
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 17 deletions.
34 changes: 19 additions & 15 deletions static/assets/scripts/home.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,27 @@ try {
} catch (e) {
inFrame = true
}

var ab = localStorage.getItem('ab')
if (!inFrame && !navigator.userAgent.includes('Firefox')) {
const popup = open('about:blank', '_blank')
if (!popup || popup.closed) alert('Please allow popups and redirects.')
else {
popup.document.write(`
<iframe src="${
location.href
}" style="position:fixed;top:0;left:0;width:100%;height:100%;outline:none;border:none;"></iframe>
<title>${localStorage.getItem('name') || 'My Drive - Google Drive'}</title>
<link rel="icon" href="${
localStorage.getItem('icon') ||
'https://ssl.gstatic.com/assets/media/branding/product/1x/drive_2020q4_32dp.png'
}">
`)
if (ab == 'true' || ab == undefined) {
const popup = open('about:blank', '_blank')
if (!popup || popup.closed) {
alert('Please allow popups and redirects.');
}
else {
popup.document.write(`
<iframe src="${
location.href
}" style="position:fixed;top:0;left:0;width:100%;height:100%;outline:none;border:none;"></iframe>
<title>${localStorage.getItem('name') || 'My Drive - Google Drive'}</title>
<link rel="icon" href="${
localStorage.getItem('icon') ||
'https://ssl.gstatic.com/assets/media/branding/product/1x/drive_2020q4_32dp.png'
}">
`)

location.replace(localStorage.getItem('panicLink') || 'https://classroom.google.com')
location.replace(localStorage.getItem('panicLink') || 'https://classroom.google.com')
}
}
}

Expand Down
12 changes: 12 additions & 0 deletions static/assets/scripts/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,4 +165,16 @@ function AB() {
location.replace('https://classroom.google.com')
}
}
}
function toggleAB() {
ab = localStorage.getItem('ab')
if (ab == null) {
localStorage.setItem('ab', 'false')
}
else if (ab == 'true') {
localStorage.setItem('ab', 'false')
}
else {
localStorage.setItem('ab', 'true')
}
}
7 changes: 5 additions & 2 deletions static/settings.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,11 @@
<div class="settings-container">
<div class="settings-card">
<h3>About:Blank</h3>
<p>Cloak the site in an about:blank page.</p>
<button onclick="AB()">Open Popup</button>
<p>Cloak the site in an about:blank page and toggle about:blank on startup (enabled by default)</p>
<button onclick="AB()" class="key-button">Open Popup</button>
<button class="key-button" onclick="toggleAB()">Toggle automatic about:blank</button>


</div>
<div class="settings-card">
<h3>Set Panic Key</h3>
Expand Down

0 comments on commit afaa7fd

Please sign in to comment.