diff --git a/manifest.json b/manifest.json
index 5801847..33d2550 100644
--- a/manifest.json
+++ b/manifest.json
@@ -2,7 +2,7 @@
"manifest_version": 3,
"name": "StuHack",
- "version": "0.5.0",
+ "version": "0.5.1",
"description": "Banner remover, filter pass & document downloader",
"icons": {
"16": "img/icon16.png",
diff --git a/remove-banner.js b/remove-banner.js
index fe13ed6..5bbc73f 100644
--- a/remove-banner.js
+++ b/remove-banner.js
@@ -6,8 +6,10 @@ window.addEventListener('load', function(){
banners[0].parentNode.removeChild(banners[0]);
}
}
- var premiumButton = document.getElementById('header-position-handle').childNodes[0].childNodes[1].childNodes[0].childNodes[1];
- premiumButton.parentNode.removeChild(premiumButton);
+ var premiumButton = document.getElementById('header-position-handle')?.childNodes[0]?.childNodes[1]?.childNodes[0]?.childNodes[1];
+ if(premiumButton != null){
+ premiumButton.parentNode.removeChild(premiumButton);
+ }
/* Mobile */
if (window.innerWidth <= 990){
diff --git a/version-check.js b/version-check.js
index 442a9c8..6a10df5 100644
--- a/version-check.js
+++ b/version-check.js
@@ -1,17 +1,21 @@
window.addEventListener('load', function(){
- version = chrome.runtime.getManifest().version;
+ try {
+ version = chrome.runtime.getManifest().version;
- const up_buttons = document.getElementsByClassName("fa-cloud-arrow-up");
-
- button_cv = document.createElement("button");
- button_cv.classList.add("github-button");
- button_cv.classList.add("tooltip-bottom");
+ const up_buttons = document.getElementsByClassName("fa-cloud-arrow-up");
- button_cv.innerHTML = 'v.'+version+'Check for newer releases';
- button_cv.onclick = function() {location.href="https://github.com/isanchop/stuhack/releases/" }
-
- up_buttons[0].parentNode.parentNode.insertBefore(button_cv, up_buttons[0].parentNode.parentElement.children[3]);
-
- var logo = document.querySelector('[aria-label="Studocu Logo"]').parentNode;
- logo.innerHTML = '';
+ button_cv = document.createElement("button");
+ button_cv.classList.add("github-button");
+ button_cv.classList.add("tooltip-bottom");
+
+ button_cv.innerHTML = 'v.'+version+'Check for newer releases';
+ button_cv.onclick = function() {location.href="https://github.com/isanchop/stuhack/releases/" }
+
+ up_buttons[0].parentNode.parentNode.insertBefore(button_cv, up_buttons[0].parentNode.parentElement.children[3]);
+
+ var logo = document.querySelector('[aria-label="Studocu Logo"]').parentNode;
+ logo.innerHTML = '';
+ } catch (error) {
+ console.log(error);
+ }
});
\ No newline at end of file