From 252e1f4414d698a3259d674e38af9ea0fc5350e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bruno=20Ryb=C3=A1rsky?= Date: Tue, 24 Oct 2023 17:33:09 +0200 Subject: [PATCH] Add edupage.js --- edupage.js | 136 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 136 insertions(+) create mode 100644 edupage.js diff --git a/edupage.js b/edupage.js new file mode 100644 index 0000000..8263aa3 --- /dev/null +++ b/edupage.js @@ -0,0 +1,136 @@ +// ==UserScript== +// @name Edupage H4x +// @namespace https://brn.systems +// @version 0.1 +// @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 +// @downloadURL https://userscripts.brn.systems/edupage.js +// @updateURL https://userscripts.brn.systems/edupage.js +// @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 +// @grant none +// ==/UserScript== + +(function() { + 'use strict'; + + let strings = { + 3276: "Ale budeme Ťa otravovať za", + 3275: "Teraz ťa nebudeme chvíľu otravovať", + 3272: "Už kašli na školu, nemá to zmysel", + 3274: "Zabudni na úlohy.", + 1439: "toho čo Ťa zajtra bude čakať", + }; + + // Define your modified function + function modifiedGetLoggedUserType() { + // 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; + } + + // Find and replace the original function + if (typeof EdubarUtils !== 'undefined') { + + if(typeof EdubarUtils.getLoggedUserType === 'function'){ + EdubarUtils.getLoggedUserType = modifiedGetLoggedUserType; + 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') { + 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.isRestrictedEdupage === 'function') { + EdubarUtils.isRestrictedEdupage = justfalse; + console.log('EdubarUtils.isRestrictedEdupage overridden successfully.'); + } else { + console.error('EdubarUtils.isRestrictedEdupage not found or not a function.'); + } + + + 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.getLoggedUserType not found or not a function.'); + } + + if (typeof window.barEncLink === 'function') { + window.barEncLink = modifiedbarEncLink; + console.log("barEncLink overriden successfully."); + } + else { + console.error('barEncLink not found or not a function.'); + } + + 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.'); + } + +})(); \ No newline at end of file