Update edupage.user.js

This commit is contained in:
Bruno Rybársky 2024-01-28 23:31:49 +01:00
parent 86eae77703
commit 956dffb3f8

@ -26,6 +26,10 @@
( function() {
'use strict';
//from https://addons.mozilla.org/en-US/firefox/addon/edupage-addons/
let darkmodecss = '.userTopDiv,.userRozvrh,.user-novyPrvok,.userHomeOther,.hwHeroDiv,.skgdFixedHeader,#skin_Div_10,#skin_Div_11,.messageViewerHeader,div.messageViewerReplies.messageViewerReplies1.messageViewerReplyText>form>div>div>textarea,.ui-dialog-titlebar,.etest-meditor-test-item.selected{background-color:#040404 !important;box-shadow:none}div.messageViewerReplies.messageViewerReplies1.messageViewerReplyText>form>div>div>textarea{outline:none;caret-color:#fff;color:#fff}body,html,.userContentInner,.bgDiv,#jw4298a4ab_md,.edubarSidebar,.usercalendarTitle>h1,.zsvFilterElem,.zsvHeaderTitle,.zsvHeaderTabs,.diplomy-st-contet-outer,.print-nobreak,#fitheight>div:nth-child(2)>div>div>div:nth-child(2)>div:nth-child(1)>div>div,#fitheight>div:nth-child(2)>div>div>div:nth-child(2)>div:nth-child(1)>div>div>div,#fitheight>div:nth-child(2)>div>div>div:nth-child(2)>div:nth-child(2)>div>div:nth-child(1)>div,#fitheight>div:nth-child(2)>div>div>div:nth-child(2)>div:nth-child(2)>div>div:nth-child(1),#fitheight>div:nth-child(1)>span,#fitheight>div:nth-child(1),#fitheight,#fitheight>div:nth-child(2)>div>div>div:nth-child(2)>div:nth-child(2)>div>div:nth-child(2)>div:nth-child(1)>div:nth-child(1),#fitheight>div:nth-child(2)>div>div>div:nth-child(2)>div:nth-child(2)>div>div:nth-child(2)>div:nth-child(3)>div:nth-child(1),#fitheight>div:nth-child(2)>div>div>div:nth-child(2)>div:nth-child(2)>div>div:nth-child(2)>div:nth-child(5)>div:nth-child(1),#fitheight>div:nth-child(2)>div>div>div:nth-child(2)>div:nth-child(2)>div>div:nth-child(2)>div:nth-child(7)>div:nth-child(1),#fitheight>div:nth-child(2)>div>div>div:nth-child(2)>div:nth-child(2)>div>div:nth-child(2)>div:nth-child(9)>div:nth-child(1),#fitheight>div:nth-child(2)>div>div>div:nth-child(2)>div:nth-child(2)>div>div:nth-child(2)>div:nth-child(11)>div:nth-child(1),#fitheight>div:nth-child(2)>div>div>div:nth-child(2)>div:nth-child(2)>div>div:nth-child(2)>div:nth-child(13)>div:nth-child(1),div.mvtMainScroller.replies>div.messageViewerReplies.messageViewerReplies0>ul>li>div.messageReakciaInner,.edubarHeader,.edubarProfilebox .display,.profilemenu{background-color:#1d1d1d !important;color:#fff !important}.edubarSmartLink span,.edubarMenuitem a span,.ribbon-button span,.hwWeekItem,.zsvHeaderTitle>h1,td>span>span,td>a,td>div>a,.expandMonthBtn,#home_Heading_2,.messageViewerConfirmationItem{color:#fff !important}.edubarSmartLink:hover,.edubarMenuitem.active a,.edubarMenuitem a:hover,.edubarMenulist a:hover,.hwmenuElem .selected,.hwWeekItem,#fitheight>div:nth-child(2)>div:nth-child(3)>div:nth-child(1),#fitheight>div:nth-child(2)>div:nth-child(3),.messageViewerReplyText,.messageViewerConfirmationsHeader,.tmv-userCardsList{background-color:#101010 !important}.hwLoadMoreDiv{opacity:1 !important}.userButton,.edubarMenulist,.calendar>div,.hwmenuElem,.ribbon-section,.toolbarForm,.hwDate,.hwItem,.hwLoadMoreDiv,.hwListElem,.hwsideElem,.ui-datepicker-header,.hwMainListMain,.tmv-userCard,.sgeRestrictedWidth,.sgpTargetsPanel,.etest-meditor-test-list-month,.etest-meditor-tests-obdobie-combo,.etest-meditor-test-list-tabs,.etest-meditor-content,.etest-meditor-search-results-toolbar{background-color:#181818 !important;color:#fff !important}.messageReplies,.mvtMainScroller{background-color:#181818 !important}.hwItem{margin:0 !important}.callout{display:none}.edubarSidebar .edubarMenulist{background-color:#1d1d1d !important}.userButtonLast{background-color:#1a1a1a !important;color:#fff}ul.edubarMenulist.level0>li:hover>a,ul.edubarMenulist.level0>li.v2:hover>a{background-color:#101010 !important}.messageViewerUser,.messageViewerText,.messageViewerClosePart,.tml-replies-actions,.messageRepliesTitle,.ui-dialog-content,.ui-dialog,.sgeNavPanel,.signin-playaction-hero,.etest-meditor-searchdiv-inner3,.hwDetails{background-color:#101010 !important;color:#fff !important}th,.fixedCell,td{background-color:#101010 !important;color:#fff !important;border:none !important}.header th,.sgpQuestionElem{background-color:#0b0b0b !important}.sgpTargetItem.confirmed{background-color:#5bba6f !important}#fitheight>div:nth-child(2)>div>div>div:nth-child(2)>div:nth-child(1)>div>div:nth-child(1)>div::after{content:"dark mode v0.1 beta"}.tt-cell,.tt-cell+div+div+div span{filter:brightness(80%)}/*# sourceMappingURL=darkmode.css.map */';
let gmc = new GM_config(
{
id: 'edupage_h4x_cnf',
@ -43,12 +47,6 @@
default: false,
title: 'Fakes you as an adult student(you might be able to sign your own grades)'
},
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)'
},
modify_admin_stuff: {
label: 'Fake admin',
type: 'checkbox',
@ -79,6 +77,18 @@
default: false,
title: 'Disables ?eqa=gibberish'
},
autologin: {
label: 'Autologin',
type: 'checkbox',
default: false,
title: 'Logs you in automatically'
},
darkmode: {
label: 'Dark mode',
type: 'checkbox',
default: false,
title: 'Makes Edupage dark'
},
},
'events': {
'init': oninit
@ -98,7 +108,8 @@
let fake_logged_in = gmc.get("modify_logged_in");
let disable_encoding = gmc.get("modify_encoding");
let change_strings = gmc.get("modify_strings");
let modify_agent = gmc.get("modify_agent");
let darkmode = gmc.get("darkmode");
let autologin = gmc.get("autologin");
let strings = {
3276: "budeme Ťa otravovať za",
@ -252,6 +263,54 @@
console.error('Langs not found or not a function.');
}
}
// If Dark Mode is enabled, apply the styles
if (darkmode) {
const style = document.createElement('style');
style.textContent = darkmodecss;
document.head.appendChild(style);
}
if (autologin) {
(async function() {
// Function to get value using postMessage
async function getValue(k) {
return new Promise((resolve) => {
window.addEventListener("message", (e) => {
console.log(e);
if (e.data.message === "getValueResponse") {
resolve(e.data.value);
}
});
window.postMessage({ message: "getValue", key: k }, "*");
});
}
// Wait for the DOM to be ready
await new Promise(resolve => {
if (document.readyState === 'complete') {
resolve();
} else {
window.addEventListener('load', resolve);
}
});
// Select elements
const userField = document.querySelector("#home_Login_1e1");
const passField = document.querySelector("#home_Login_1e2");
// Check if userField exists and host matches
if (userField && location.host === (await getValue("autologin_host")) + ".edupage.org") {
// Populate fields with autologin credentials
userField.value = await getValue("autologin_username");
passField.value = await getValue("autologin_password");
// Click the submit button
}
})();
}
}
})();