diff --git a/content.js b/content.js
index d694927..8dba9fc 100644
--- a/content.js
+++ b/content.js
@@ -7,6 +7,12 @@ const tweaks = {
} else {
if (!items.hideAUSHeader) {
$('').prependTo('body');
+ if (items.blockAUSImages) {
+ setTimeout(() => {
+ let frame = $(document.getElementsByName('topFrame')[0].contentWindow.document);
+ $(frame).find('img').attr('src', 'data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==');
+ }, 350)
+ }
}
}
},
@@ -81,10 +87,27 @@ const tweaks = {
blockAUSImages: () => {
if (document.getElementsByName('mainFrame')[0] !== undefined) {
let frame = $(document.getElementsByName('mainFrame')[0].contentWindow.document);
- $(frame).attr('src', 'data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==');
+ $(frame).find('img').attr('src', 'data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==');
} else {
$('img').attr('src', 'data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==');
}
+
+ if (document.getElementsByName('topFrame')[0] !== undefined) {
+ let frame = $(document.getElementsByName('topFrame')[0].contentWindow.document);
+ $(frame).find('img').attr('src', 'data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==');
+ }
+ },
+ disableAutoRefresh: () => {
+ return true;
+ },
+ preventInactive: () => {
+ if (document.getElementsByName('mainFrame')[0] !== undefined) {
+ console.error('Prevent Inactive Login is not supported without Persistent Login enabled.');
+ } else {
+ setTimeout(() => {
+ location.reload();
+ }, 300000)
+ }
}
}
diff --git a/manifest.json b/manifest.json
index 521fd23..9a9a4f1 100644
--- a/manifest.json
+++ b/manifest.json
@@ -2,7 +2,7 @@
"manifest_version": 2,
"name": "BannerPlus",
"description": "Makes banner better.",
- "version": "0.1",
+ "version": "1.2",
"icons": {
"128": "assets/icons/128.png"
},
diff --git a/popup.html b/popup.html
index 468ffc4..7e9bd89 100644
--- a/popup.html
+++ b/popup.html
@@ -15,6 +15,10 @@
height: 100%;
}
+ html {
+ overflow: auto;
+ }
+
.mainTitle {
padding: none;
font-size: 40px;
@@ -202,7 +206,7 @@
- Banner+
+ Banner+
Tweaks
@@ -210,6 +214,10 @@ Tweaks
Persistent Login
+
+ Prevent Inactive Logout
+
+
Big Titles
@@ -250,6 +258,12 @@
Auto Login
Password:
+
+ Settings
+
+ Disable Auto Refresh
+
+
diff --git a/popup.js b/popup.js
index 26d296b..9f719c8 100644
--- a/popup.js
+++ b/popup.js
@@ -34,7 +34,7 @@ function checkAutoLogin(value, cb) {
}
}
-function clickSwitch(name, currentValue) {
+function clickSwitch(name, currentValue, tab) {
if (name == 'autoLogin') {
checkAutoLogin(currentValue, () => {
@@ -51,12 +51,22 @@ function clickSwitch(name, currentValue) {
let data = {};
data[name] = currentValue;
chrome.storage.local.set(data);
+
+ chrome.storage.local.get(['disableAutoRefresh'], (result) => {
+ if (result.disableAutoRefresh !== true) {
+ chrome.tabs.reload(tab.id, {
+ bypassCache: true
+ });
+ }
+ })
+
}
}
function initializeSwitches(tab) {
$('.checkbox-switch').each((i, item) => {
let name = $(item).attr('name');
+
if (name == 'autoLogin') {
chrome.storage.sync.get(['username', 'password'], (result) => {
$('[name="username"]').val(result.username);
@@ -70,7 +80,7 @@ function initializeSwitches(tab) {
size: 'default',
checked: true,
onChange: (value) => {
- clickSwitch(name, value);
+ clickSwitch(name, value, tab);
}
});
} else {
@@ -78,7 +88,7 @@ function initializeSwitches(tab) {
size: 'default',
checked: false,
onChange: (value) => {
- clickSwitch(name, value);
+ clickSwitch(name, value, tab);
}
});
}
@@ -90,11 +100,16 @@ function checkForUpdates() {
fetch(chrome.extension.getURL('version.json'))
.then((response) => {
response.json().then((json) => {
+ //Set current version
+ $('version').text("(v" + json.version + ")");
+
fetch('https://raw.githubusercontent.com/DeadPackets/BannerPlus/master/version.json')
.then((responseGit) => {
responseGit.json().then((jsonGit) => {
if (parseFloat(jsonGit.version) > parseFloat(json.version)) {
- let content = jsonGit.changelog.map((item) => {return (" - " + item);})
+ let content = jsonGit.changelog.map((item) => {
+ return (" - " + item);
+ })
content = content.join("\n");
swal({
title: `New Update! (v${jsonGit.version})`,
@@ -103,7 +118,7 @@ function checkForUpdates() {
}).then((value) => {
//If they picked to update
if (value) {
- window.open('https://github.com/DeadPackets/BannerPlus/releases/latest');
+ window.open('https://github.com/DeadPackets/BannerPlus/releases/latest');
}
})
}
@@ -113,11 +128,36 @@ function checkForUpdates() {
});
}
+function displayDisclaimer(cb) {
+ chrome.storage.local.get(['agreeToServeSatan'], (result) => {
+ if (result.agreeToServeSatan) {
+ cb();
+ } else {
+ swal({
+ title: `Disclaimer`,
+ text: `By using BannerPlus, you acknowledge that you are fully responsible for the usage of this extension and all actions that may entail using it.`,
+ type: 'warning',
+ buttons: ['No thanks', 'I understand']
+ }).then((value) => {
+ //If they picked to update
+ if (value) {
+ chrome.storage.local.set({agreeToServeSatan: true})
+ cb();
+ } else {
+ window.close();
+ }
+ })
+ }
+ })
+}
+
document.addEventListener('DOMContentLoaded', () => {
getCurrentTabUrl((tab) => {
if (tab.url.indexOf('banner.aus.edu') > -1) {
- initializeSwitches(tab);
- checkForUpdates();
+ displayDisclaimer(() => {
+ initializeSwitches(tab);
+ checkForUpdates();
+ })
} else {
swal({
title: 'Sorry!',
diff --git a/version.json b/version.json
index 1dad1c2..002e95a 100644
--- a/version.json
+++ b/version.json
@@ -1,4 +1,4 @@
{
- "version": "1.0",
- "changelog": ["Added an actual logo", "Fixed incorrect titles", "Huge improvement on blocking images (still in beta though)"]
+ "version": "1.2",
+ "changelog": ["Added auto refresh for tweaks", "Added a tweak to prevent auto logout from banner", "Fixed blocking tweaks not working properly on windows", "Added disclaimer note"]
}
\ No newline at end of file