Userscripts/edupage.user.js

248 lines
9.3 KiB
JavaScript
Raw Normal View History

2023-10-24 17:33:09 +02:00
// ==UserScript==
// @name Edupage H4x
// @namespace https://brn.systems
2023-10-25 21:48:14 +02:00
// @version 0.2.17
2023-10-24 17:33:09 +02:00
// @copyright Can be found at https://git.brn.systems/BRNSystems/Userscripts
// @description Gives you a bit more options on EduPage, some are broken
// @author BRNSystems
// @website https://brn.systems
2023-10-24 17:40:04 +02:00
// @downloadURL https://userscripts.brn.systems/edupage.user.js
// @updateURL https://userscripts.brn.systems/edupage.user.js
2023-10-24 17:33:09 +02:00
// @match https://*.edupage.org/*
// @icon64 https://www.google.com/s2/favicons?sz=64&domain=edupage.org
// @icon https://www.google.com/s2/favicons?sz=32&domain=edupage.org
2023-10-24 17:46:32 +02:00
// @require https://gist.github.com/raw/2625891/waitForKeyElements.js
2023-10-24 18:43:21 +02:00
// @require https://openuserjs.org/src/libs/sizzle/GM_config.min.js
// @grant GM_getValue
// @grant GM_setValue
// @grant GM.getValue
// @grant GM.setValue
2023-10-24 18:48:43 +02:00
// @grant GM_registerMenuCommand
// @grant GM.registerMenuCommand
2023-10-24 17:33:09 +02:00
// ==/UserScript==
2023-10-24 17:44:57 +02:00
2023-10-24 19:19:12 +02:00
( function() {
2023-10-24 17:33:09 +02:00
'use strict';
2023-10-24 19:19:12 +02:00
let gmc = new GM_config(
{
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)'
},
2023-10-25 21:38:10 +02:00
modify_agent: {
label: 'Fake mobile app',
type: 'checkbox',
default: false,
title: 'Fakes you as an adult student(you might be able to sign your own grades)'
},
2023-10-24 19:19:12 +02:00
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'
},
},
'events': {
'init': oninit
}
});
2023-10-24 18:41:00 +02:00
2023-10-25 21:48:14 +02:00
function custompost(url, data, success, dataType, eqav, oldpost){
oldpost(url, data, success, dataType, unsafeWindow.maxEqav);
}
2023-10-24 19:19:12 +02:00
function oninit(){
2023-10-24 19:20:12 +02:00
GM_registerMenuCommand('Settings', () => {
gmc.open()
})
2023-10-24 19:19:12 +02:00
let removeintrobtn = gmc.get("modify_startbutton");
let fake_adult_student = gmc.get("modify_adult_student");
let fake_admin = gmc.get("modify_admin_stuff");
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");
2023-10-25 21:38:10 +02:00
let modify_agent = gmc.get("modify_agent");
2023-10-24 19:19:12 +02:00
let strings = {
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,",
};
function deleteNotX (jNode) {
jNode.remove ();
}
2023-10-24 17:33:09 +02:00
2023-10-24 19:19:12 +02:00
// Define your modified function
function modifiedGetLoggedUserType() {
// Your custom code here
return 'Admin'; // Override the return value as needed
}
2023-10-24 17:33:09 +02:00
2023-10-24 19:19:12 +02:00
function justtrue(){
return true;
}
2023-10-24 17:33:09 +02:00
2023-10-24 19:19:12 +02:00
function justfalse(){
return false;
}
2023-10-24 18:48:43 +02:00
2023-10-24 19:19:12 +02:00
function modifiedbarEncLink(url) {
return url;
}
2023-10-24 17:33:09 +02:00
2023-10-24 19:19:12 +02:00
if(removeintrobtn){
//removes intro button
waitForKeyElements ("a.learnMoreBtn", deleteNotX);
}
2023-10-24 18:41:00 +02:00
2023-10-24 19:19:12 +02:00
// 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.');
}
2023-10-24 18:41:00 +02:00
}
2023-10-24 19:19:12 +02:00
if(fake_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.');
}
2023-10-24 18:41:00 +02:00
}
2023-10-24 19:19:12 +02:00
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.');
}
2023-10-24 18:41:00 +02:00
}
2023-10-24 19:19:12 +02:00
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.');
}
2023-10-24 18:41:00 +02:00
}
2023-10-24 17:33:09 +02:00
2023-10-24 18:41:00 +02:00
2023-10-24 19:19:12 +02:00
} else {
console.error('EdubarUtils not found or not a function.');
2023-10-24 17:33:09 +02:00
}
2023-10-24 19:19:12 +02:00
if(disable_encoding){
2023-10-24 19:28:01 +02:00
if (typeof unsafeWindow.barEncLink === 'function') {
unsafeWindow.barEncLink = modifiedbarEncLink;
2023-10-25 21:38:10 +02:00
unsafeWindow.AscMobileAppVersion = "69420";
2023-10-25 21:48:14 +02:00
var edupost = unsafeWindow.$j.post;
function newpost(url, data, success, dataType, eqav){
edupost(url, data, success, dataType, 7);
}
2023-10-25 21:53:16 +02:00
//unsafeWindow.$j.post = newpost;
2023-10-24 19:19:12 +02:00
console.log("barEncLink overriden successfully.");
2023-10-24 18:41:00 +02:00
}
2023-10-24 19:19:12 +02:00
else {
console.error('barEncLink not found or not a function.');
2023-10-24 18:41:00 +02:00
}
2023-10-24 17:33:09 +02:00
}
2023-10-25 21:38:10 +02:00
2023-10-24 19:19:12 +02:00
if(change_strings){
2023-10-24 19:28:01 +02:00
if (typeof unsafeWindow.Langs === 'object') {
2023-10-24 19:19:12 +02:00
for (var key in strings) {
var value = strings[key];
2023-10-24 19:28:01 +02:00
unsafeWindow.Langs[key] = value;
2023-10-24 19:19:12 +02:00
}
console.log("Strings overriden successfully.");
}
else {
2023-10-24 19:28:01 +02:00
console.error('Langs not found or not a function.');
2023-10-24 18:41:00 +02:00
}
2023-10-24 17:33:09 +02:00
}
}
})();