This commit is contained in:
Bruno Rybársky 2023-10-24 19:19:12 +02:00
parent 18db61e7ed
commit 4572eaf977

@ -1,7 +1,7 @@
// ==UserScript== // ==UserScript==
// @name Edupage H4x // @name Edupage H4x
// @namespace https://brn.systems // @namespace https://brn.systems
// @version 0.2.12 // @version 0.2.13
// @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
@ -23,201 +23,207 @@
( async function() { ( function() {
'use strict'; 'use strict';
GM_config.init({ let gmc = new GM_config(
id: 'edupage_h4x_cnf', {
title: GM_info.script.name + ' Settings', id: 'edupage_h4x_cnf',
fields: { title: GM_info.script.name + ' Settings',
modify_startbutton: { fields: {
label: 'Hides the intro button', modify_startbutton: {
type: 'checkbox', label: 'Hides the intro button',
default: false, type: 'checkbox',
title: 'Hides the intro button' default: false,
}, title: 'Hides the intro button'
modify_adult_student: { },
label: 'Fake adult student', modify_adult_student: {
type: 'checkbox', label: 'Fake adult student',
default: false, type: 'checkbox',
title: 'Fakes you as an adult student(you might be able to sign your own grades)' default: false,
}, title: 'Fakes you as an adult student(you might be able to sign your own grades)'
modify_admin_stuff: { },
label: 'Fake admin', modify_admin_stuff: {
type: 'checkbox', label: 'Fake admin',
default: false, type: 'checkbox',
title: 'Fakes isUcitelOrAdmin, isAdmin, getLoggedUserType, hasUserRight, isWebpageAdmin. Some functionality still does not work(Server protection)' default: false,
}, title: 'Fakes isUcitelOrAdmin, isAdmin, getLoggedUserType, hasUserRight, isWebpageAdmin. Some functionality still does not work(Server protection)'
modify_restricted: { },
label: 'Fake not restricted', modify_restricted: {
type: 'checkbox', label: 'Fake not restricted',
default: false, type: 'checkbox',
title: 'Fakes EduPage as not restricted(I do not know what this does)' default: false,
}, title: 'Fakes EduPage as not restricted(I do not know what this does)'
modify_logged_in: { },
label: 'Fake logged in', modify_logged_in: {
type: 'checkbox', label: 'Fake logged in',
default: false, type: 'checkbox',
title: 'Fakes EduPage portal logged in(I do not know what this does)' default: false,
}, title: 'Fakes EduPage portal logged in(I do not know what this does)'
modify_strings: { },
label: 'Patch strings', modify_strings: {
type: 'checkbox', label: 'Patch strings',
default: false, type: 'checkbox',
title: 'Patch strings to more cool ones' default: false,
}, title: 'Patch strings to more cool ones'
modify_encoding: { },
label: 'Disable encoded links', modify_encoding: {
type: 'checkbox', label: 'Disable encoded links',
default: false, type: 'checkbox',
title: 'Disables ?eqa=gibberish' default: false,
}, title: 'Disables ?eqa=gibberish'
} },
}) },
'events': {
'init': oninit
}
});
GM_registerMenuCommand('Settings', () => { GM_registerMenuCommand('Settings', () => {
GM_config.open() GM_config.open()
}) })
let strings = { function oninit(){
3276: "budeme Ťa otravovať za", let removeintrobtn = gmc.get("modify_startbutton");
3275: "Teraz ťa nebudeme chvíľu otravovať, ale", let fake_adult_student = gmc.get("modify_adult_student");
3272: "Už kašli na školu, nemá to zmysel a", let fake_admin = gmc.get("modify_admin_stuff");
3274: "Zabudni na úlohy,", let fake_not_restricted = gmc.get("modify_restricted");
}; let fake_logged_in = gmc.get("modify_logged_in");
let disable_encoding = gmc.get("modify_encoding");
let change_strings = gmc.get("modify_strings");
function deleteNotX (jNode) { let strings = {
jNode.remove (); 3276: "budeme Ťa otravovať za",
} 3275: "Teraz ťa nebudeme chvíľu otravovať, ale",
3272: "Už kašli na školu, nemá to zmysel a",
3274: "Zabudni na úlohy,",
};
// Define your modified function function deleteNotX (jNode) {
function modifiedGetLoggedUserType() { jNode.remove ();
// Your custom code here
return 'Admin'; // Override the return value as needed
}
function justtrue(){
return true;
}
function justfalse(){
return false;
}
function modifiedbarEncLink(url) {
return url;
}
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);
}
// Find and replace the original function
if (typeof EdubarUtils !== 'undefined') {
if(fake_admin){
if(typeof EdubarUtils.getLoggedUserType === 'function'){
EdubarUtils.getLoggedUserType = modifiedGetLoggedUserType;
console.log('EdubarUtils.getLoggedUserType overridden successfully.');
}
if (typeof EdubarUtils.isWebpageAdmin === 'function') {
EdubarUtils.isWebpageAdmin = justtrue;
console.log('EdubarUtils.isWebpageAdmin overridden successfully.');
} else {
console.error('EdubarUtils.isWebpageAdmin not found or not a function.');
}
if (typeof EdubarUtils.hasUserRight === 'function') {
EdubarUtils.hasUserRight = justtrue;
console.log('EdubarUtils.hasUserRight overridden successfully.');
} else {
console.error('EdubarUtils.hasUserRight not found or not a function.');
}
if (typeof EdubarUtils.isAdmin === 'function') {
EdubarUtils.isAdmin = justtrue;
console.log('EdubarUtils.isAdmin overridden successfully.');
} else {
console.error('EdubarUtils.isAdmin not found or not a function.');
}
if (typeof EdubarUtils.isUcitelOrAdmin === 'function') {
EdubarUtils.isUcitelOrAdmin = justtrue;
console.log('EdubarUtils.isUcitelOrAdmin overridden successfully.');
} else {
console.error('EdubarUtils.isUcitelOrAdmin not found or not a function.');
}
} }
if(fake_adult_student){ // Define your modified function
if (typeof EdubarUtils.isAdultStudent === 'function') { function modifiedGetLoggedUserType() {
EdubarUtils.isAdultStudent = justtrue; // Your custom code here
console.log('EdubarUtils.isAdultStudent overridden successfully.'); return 'Admin'; // Override the return value as needed
} else { }
console.error('EdubarUtils.isAdultStudent not found or not a function.');
function justtrue(){
return true;
}
function justfalse(){
return false;
}
function modifiedbarEncLink(url) {
return url;
}
if(removeintrobtn){
//removes intro button
waitForKeyElements ("a.learnMoreBtn", deleteNotX);
}
// Find and replace the original function
if (typeof EdubarUtils !== 'undefined') {
if(fake_admin){
if(typeof EdubarUtils.getLoggedUserType === 'function'){
EdubarUtils.getLoggedUserType = modifiedGetLoggedUserType;
console.log('EdubarUtils.getLoggedUserType overridden successfully.');
}
if (typeof EdubarUtils.isWebpageAdmin === 'function') {
EdubarUtils.isWebpageAdmin = justtrue;
console.log('EdubarUtils.isWebpageAdmin overridden successfully.');
} else {
console.error('EdubarUtils.isWebpageAdmin not found or not a function.');
}
if (typeof EdubarUtils.hasUserRight === 'function') {
EdubarUtils.hasUserRight = justtrue;
console.log('EdubarUtils.hasUserRight overridden successfully.');
} else {
console.error('EdubarUtils.hasUserRight not found or not a function.');
}
if (typeof EdubarUtils.isAdmin === 'function') {
EdubarUtils.isAdmin = justtrue;
console.log('EdubarUtils.isAdmin overridden successfully.');
} else {
console.error('EdubarUtils.isAdmin not found or not a function.');
}
if (typeof EdubarUtils.isUcitelOrAdmin === 'function') {
EdubarUtils.isUcitelOrAdmin = justtrue;
console.log('EdubarUtils.isUcitelOrAdmin overridden successfully.');
} else {
console.error('EdubarUtils.isUcitelOrAdmin not found or not a function.');
}
} }
if (typeof EdubarUtils.isParentOrAdultStudent === 'function') { if(fake_adult_student){
EdubarUtils.isParentOrAdultStudent = justtrue; if (typeof EdubarUtils.isAdultStudent === 'function') {
console.log('EdubarUtils.isParentOrAdultStudent overridden successfully.'); EdubarUtils.isAdultStudent = justtrue;
} else { console.log('EdubarUtils.isAdultStudent overridden successfully.');
console.error('EdubarUtils.isParentOrAdultStudent not found or not a function.'); } 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(fake_not_restricted){
if (typeof EdubarUtils.isRestrictedEdupage === 'function') {
EdubarUtils.isRestrictedEdupage = justfalse;
console.log('EdubarUtils.isRestrictedEdupage overridden successfully.');
} else {
console.error('EdubarUtils.isRestrictedEdupage not found or not a function.');
}
}
if(fake_logged_in){
if (typeof EdubarUtils.isLoggedToPortal === 'function') {
EdubarUtils.isLoggedToPortal = justtrue;
console.log('EdubarUtils.isLoggedToPortal overridden successfully.');
} else {
console.error('EdubarUtils.isLoggedToPortal not found or not a function.');
}
}
} else {
console.error('EdubarUtils not found or not a function.');
}
if(disable_encoding){
if (typeof window.barEncLink === 'function') {
window.barEncLink = modifiedbarEncLink;
console.log("barEncLink overriden successfully.");
}
else {
console.error('barEncLink not found or not a function.');
} }
} }
if(change_strings){
if(fake_not_restricted){ if (typeof window.Langs === 'object') {
if (typeof EdubarUtils.isRestrictedEdupage === 'function') { for (var key in strings) {
EdubarUtils.isRestrictedEdupage = justfalse; var value = strings[key];
console.log('EdubarUtils.isRestrictedEdupage overridden successfully.'); window.Langs[key] = value;
} else { }
console.error('EdubarUtils.isRestrictedEdupage not found or not a function.'); console.log("Strings overriden successfully.");
} }
} else {
console.error('window.Langs not found or not a function.');
if(fake_logged_in){
if (typeof EdubarUtils.isLoggedToPortal === 'function') {
EdubarUtils.isLoggedToPortal = justtrue;
console.log('EdubarUtils.isLoggedToPortal overridden successfully.');
} else {
console.error('EdubarUtils.isLoggedToPortal not found or not a function.');
} }
} }
} else {
console.error('EdubarUtils not found or not a function.');
}
if(disable_encoding){
if (typeof window.barEncLink === 'function') {
window.barEncLink = modifiedbarEncLink;
console.log("barEncLink overriden successfully.");
}
else {
console.error('barEncLink not found or not a function.');
}
}
if(change_strings){
if (typeof window.Langs === 'object') {
for (var key in strings) {
var value = strings[key];
window.Langs[key] = value;
}
console.log("Strings overriden successfully.");
}
else {
console.error('window.Langs not found or not a function.');
}
} }
})(); })();