From be663ae90266aab3a0ae4f51543d2076c6d994cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bruno=20Ryb=C3=A1rsky?= Date: Tue, 24 Oct 2023 19:12:16 +0200 Subject: [PATCH] update --- edupage.user.js | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/edupage.user.js b/edupage.user.js index 70e5bfd..459bcb9 100644 --- a/edupage.user.js +++ b/edupage.user.js @@ -23,7 +23,7 @@ -(function() { +( async function() { 'use strict'; GM_config.init({ @@ -108,7 +108,15 @@ return url; } - if(GM_config.getValue("modify_startbutton")){ + let removeintrobtn = await GM_config.getValue("modify_startbutton"); + let fake_adult_student = await GM_config.getValue("modify_adult_student"); + let fake_admin = await GM_config.getValue("modify_admin_stuff"); + let fake_not_restricted = await GM_config.getValue("modify_restricted"); + let fake_logged_in = await GM_config.getValue("modify_logged_in"); + let disable_encoding = await GM_config.getValue("modify_encoding"); + let change_strings = await GM_config.getValue("modify_strings"); + + if(removeintrobtn){ //removes intro button waitForKeyElements ("a.learnMoreBtn", deleteNotX); } @@ -116,7 +124,7 @@ // Find and replace the original function if (typeof EdubarUtils !== 'undefined') { - if(GM_config.getValue("modify_admin_stuff")){ + if(fake_admin){ if(typeof EdubarUtils.getLoggedUserType === 'function'){ EdubarUtils.getLoggedUserType = modifiedGetLoggedUserType; console.log('EdubarUtils.getLoggedUserType overridden successfully.'); @@ -151,7 +159,7 @@ } } - if(GM_config.getValue("modify_adult_student")){ + if(fake_adult_student){ if (typeof EdubarUtils.isAdultStudent === 'function') { EdubarUtils.isAdultStudent = justtrue; console.log('EdubarUtils.isAdultStudent overridden successfully.'); @@ -167,7 +175,7 @@ } } - if(GM_config.getValue("modify_restricted")){ + if(fake_not_restricted){ if (typeof EdubarUtils.isRestrictedEdupage === 'function') { EdubarUtils.isRestrictedEdupage = justfalse; console.log('EdubarUtils.isRestrictedEdupage overridden successfully.'); @@ -176,7 +184,7 @@ } } - if(GM_config.getValue("modify_logged_in")){ + if(fake_logged_in){ if (typeof EdubarUtils.isLoggedToPortal === 'function') { EdubarUtils.isLoggedToPortal = justtrue; console.log('EdubarUtils.isLoggedToPortal overridden successfully.'); @@ -190,7 +198,7 @@ console.error('EdubarUtils not found or not a function.'); } - if(GM_config.getValue("modify_encoding")){ + if(disable_encoding){ if (typeof window.barEncLink === 'function') { window.barEncLink = modifiedbarEncLink; console.log("barEncLink overriden successfully."); @@ -199,8 +207,7 @@ console.error('barEncLink not found or not a function.'); } } - console.log(GM_config.getValue("modify_strings")); - if(GM_config.getValue("modify_strings")){ + if(change_strings){ if (typeof window.Langs === 'object') { for (var key in strings) { var value = strings[key];