Update edupage.user.js

This commit is contained in:
Bruno Rybársky 2023-10-24 18:41:00 +02:00
parent 619408e800
commit 7503e8479a

@ -1,7 +1,7 @@
// ==UserScript== // ==UserScript==
// @name Edupage H4x // @name Edupage H4x
// @namespace https://brn.systems // @namespace https://brn.systems
// @version 0.2.3 // @version 0.2.4
// @copyright Can be found at https://git.brn.systems/BRNSystems/Userscripts // @copyright Can be found at https://git.brn.systems/BRNSystems/Userscripts
// @description Gives you a bit more options on EduPage, some are broken // @description Gives you a bit more options on EduPage, some are broken
// @author BRNSystems // @author BRNSystems
@ -15,16 +15,73 @@
// @grant none // @grant none
// ==/UserScript== // ==/UserScript==
//removes intro button
waitForKeyElements ("a.learnMoreBtn", deleteNotX);
function deleteNotX (jNode) {
jNode.remove ();
}
(function() { (function() {
'use strict'; 'use strict';
if(GM_config.get("modify_startbutton")){
//removes intro button
waitForKeyElements ("a.learnMoreBtn", deleteNotX);
}
function deleteNotX (jNode) {
jNode.remove ();
}
GM_config.init({
id: 'edupage_h4x_cnf',
title: GM_info.script.name + ' Settings',
fields: {
modify_startbutton: {
label: 'Hides the intro button',
type: 'checkbox',
default: false,
title: 'Hides the intro button'
},
modify_adult_student: {
label: 'Fake adult student',
type: 'checkbox',
default: false,
title: 'Fakes you as an adult student(you might be able to sign your own grades)'
},
modify_admin_stuff: {
label: 'Fake admin',
type: 'checkbox',
default: false,
title: 'Fakes isUcitelOrAdmin, isAdmin, getLoggedUserType, hasUserRight, isWebpageAdmin. Some functionality still does not work(Server protection)'
},
modify_restricted: {
label: 'Fake not restricted',
type: 'checkbox',
default: false,
title: 'Fakes EduPage as not restricted(I do not know what this does)'
},
modify_logged_in: {
label: 'Fake logged in',
type: 'checkbox',
default: false,
title: 'Fakes EduPage portal logged in(I do not know what this does)'
},
modify_strings: {
label: 'Patch strings',
type: 'checkbox',
default: false,
title: 'Patch strings to more cool ones'
},
modify_encoding: {
label: 'Disable encoded links',
type: 'checkbox',
default: false,
title: 'Disables ?eqa=gibberish'
},
}
})
GM_registerMenuCommand('Settings', () => {
GM_config.open()
})
let strings = { let strings = {
3276: "budeme Ťa otravovať za", 3276: "budeme Ťa otravovať za",
3275: "Teraz ťa nebudeme chvíľu otravovať, ale", 3275: "Teraz ťa nebudeme chvíľu otravovať, ale",
@ -53,25 +110,12 @@ function deleteNotX (jNode) {
// Find and replace the original function // Find and replace the original function
if (typeof EdubarUtils !== 'undefined') { if (typeof EdubarUtils !== 'undefined') {
if(GM_config.get("modify_admin_stuff")){
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.');
} }
if (typeof EdubarUtils.isAdultStudent === 'function') {
EdubarUtils.isAdultStudent = justtrue;
console.log('EdubarUtils.isAdultStudent overridden successfully.');
} else {
console.error('EdubarUtils.isAdultStudent not found or not a function.');
}
if (typeof EdubarUtils.isParentOrAdultStudent === 'function') {
EdubarUtils.isParentOrAdultStudent = justtrue;
console.log('EdubarUtils.isParentOrAdultStudent overridden successfully.');
} else {
console.error('EdubarUtils.isParentOrAdultStudent not found or not a function.');
}
if (typeof EdubarUtils.isWebpageAdmin === 'function') { if (typeof EdubarUtils.isWebpageAdmin === 'function') {
EdubarUtils.isWebpageAdmin = justtrue; EdubarUtils.isWebpageAdmin = justtrue;
console.log('EdubarUtils.isWebpageAdmin overridden successfully.'); console.log('EdubarUtils.isWebpageAdmin overridden successfully.');
@ -99,28 +143,48 @@ function deleteNotX (jNode) {
} else { } else {
console.error('EdubarUtils.isUcitelOrAdmin not found or not a function.'); console.error('EdubarUtils.isUcitelOrAdmin not found or not a function.');
} }
}
if(GM_config.get("modify_adult_student")){
if (typeof EdubarUtils.isAdultStudent === 'function') {
EdubarUtils.isAdultStudent = justtrue;
console.log('EdubarUtils.isAdultStudent overridden successfully.');
} else {
console.error('EdubarUtils.isAdultStudent not found or not a function.');
}
if (typeof EdubarUtils.isParentOrAdultStudent === 'function') {
EdubarUtils.isParentOrAdultStudent = justtrue;
console.log('EdubarUtils.isParentOrAdultStudent overridden successfully.');
} else {
console.error('EdubarUtils.isParentOrAdultStudent not found or not a function.');
}
}
if(GM_config.get("modify_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.');
} else { } else {
console.error('EdubarUtils.isRestrictedEdupage not found or not a function.'); console.error('EdubarUtils.isRestrictedEdupage not found or not a function.');
} }
}
if(GM_config.get("modify_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.');
} else { } else {
console.error('EdubarUtils.isLoggedToPortal not found or not a function.'); console.error('EdubarUtils.isLoggedToPortal not found or not a function.');
} }
}
} else { } else {
console.error('EdubarUtils.getLoggedUserType not found or not a function.'); console.error('EdubarUtils not found or not a function.');
} }
if(GM_config.get("modify_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.");
@ -128,7 +192,9 @@ function deleteNotX (jNode) {
else { else {
console.error('barEncLink not found or not a function.'); console.error('barEncLink not found or not a function.');
} }
}
if(GM_config.get("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];
@ -139,5 +205,6 @@ function deleteNotX (jNode) {
else { else {
console.error('window.Langs not found or not a function.'); console.error('window.Langs not found or not a function.');
} }
}
})(); })();