This commit is contained in:
Bruno Rybársky 2023-10-24 19:12:16 +02:00
parent 59d5ce70a5
commit be663ae902

@ -23,7 +23,7 @@
(function() { ( async function() {
'use strict'; 'use strict';
GM_config.init({ GM_config.init({
@ -108,7 +108,15 @@
return url; 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 //removes intro button
waitForKeyElements ("a.learnMoreBtn", deleteNotX); waitForKeyElements ("a.learnMoreBtn", deleteNotX);
} }
@ -116,7 +124,7 @@
// Find and replace the original function // Find and replace the original function
if (typeof EdubarUtils !== 'undefined') { if (typeof EdubarUtils !== 'undefined') {
if(GM_config.getValue("modify_admin_stuff")){ if(fake_admin){
if(typeof EdubarUtils.getLoggedUserType === 'function'){ if(typeof EdubarUtils.getLoggedUserType === 'function'){
EdubarUtils.getLoggedUserType = modifiedGetLoggedUserType; EdubarUtils.getLoggedUserType = modifiedGetLoggedUserType;
console.log('EdubarUtils.getLoggedUserType overridden successfully.'); 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') { if (typeof EdubarUtils.isAdultStudent === 'function') {
EdubarUtils.isAdultStudent = justtrue; EdubarUtils.isAdultStudent = justtrue;
console.log('EdubarUtils.isAdultStudent overridden successfully.'); 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') { if (typeof EdubarUtils.isRestrictedEdupage === 'function') {
EdubarUtils.isRestrictedEdupage = justfalse; EdubarUtils.isRestrictedEdupage = justfalse;
console.log('EdubarUtils.isRestrictedEdupage overridden successfully.'); 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') { if (typeof EdubarUtils.isLoggedToPortal === 'function') {
EdubarUtils.isLoggedToPortal = justtrue; EdubarUtils.isLoggedToPortal = justtrue;
console.log('EdubarUtils.isLoggedToPortal overridden successfully.'); console.log('EdubarUtils.isLoggedToPortal overridden successfully.');
@ -190,7 +198,7 @@
console.error('EdubarUtils not found or not a function.'); console.error('EdubarUtils not found or not a function.');
} }
if(GM_config.getValue("modify_encoding")){ if(disable_encoding){
if (typeof window.barEncLink === 'function') { if (typeof window.barEncLink === 'function') {
window.barEncLink = modifiedbarEncLink; window.barEncLink = modifiedbarEncLink;
console.log("barEncLink overriden successfully."); console.log("barEncLink overriden successfully.");
@ -199,8 +207,7 @@
console.error('barEncLink not found or not a function.'); console.error('barEncLink not found or not a function.');
} }
} }
console.log(GM_config.getValue("modify_strings")); if(change_strings){
if(GM_config.getValue("modify_strings")){
if (typeof window.Langs === 'object') { if (typeof window.Langs === 'object') {
for (var key in strings) { for (var key in strings) {
var value = strings[key]; var value = strings[key];