Skip to content

Instantly share code, notes, and snippets.

@Krisztiaan
Created May 24, 2022 18:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Krisztiaan/8c699edc7d24ebbda000b706066b7821 to your computer and use it in GitHub Desktop.
Save Krisztiaan/8c699edc7d24ebbda000b706066b7821 to your computer and use it in GitHub Desktop.
Neptun PowerUp! de ki lehet szűrni az opcionális tárgyakat.
// ==UserScript==
// @name Neptun PowerUp!
// @namespace http://example.org
// @description Felturbózza a Neptun-odat
// @version 2.3.0
// @downloadURL https://github.com/solymosi/npu/releases/latest/download/npu.user.js
// @include https://*neptun*/*hallgato*/*
// @include https://*neptun*/*Hallgatoi*/*
// @include https://*neptun*/*oktato*/*
// @include https://*hallgato*.*neptun*/*
// @include https://*oktato*.*neptun*/*
// @include https://netw*.nnet.sze.hu/hallgato/*
// @include https://nappw.dfad.duf.hu/hallgato/*
// @include https://host.sdakft.hu/*
// @include https://neptun.ejf.hu/ejfhw/*
// @grant GM.xmlHttpRequest
// @grant GM.getValue
// @grant GM.setValue
// @grant GM.info
// @require https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js
// ==/UserScript==
/******/ (() => {
// webpackBootstrap
/******/ var __webpack_modules__ = {
/***/ 616: /***/ (
module,
__unused_webpack_exports,
__webpack_require__
) => {
const utils = __webpack_require__(555);
// Enhance advance list style
function fixAdvanceList() {
utils.injectCss(`
#h_advance_gridSubjects_bodytable tr:not(.gridrow_blue):not(.gridrow_green) td,
#h_advance_NonCurrTemp_bodytable tr:not(.gridrow_blue):not(.gridrow_green) td {
background-color: #F8EFB1 !important;
font-weight: bold;
color: #525659;
}
#h_advance_gridSubjects_bodytable tr.gridrow_green td,
#h_advance_NonCurrTemp_bodytable tr.gridrow_green td {
background-color: #D5EFBA !important;
font-weight: bold;
color: #525659;
}
#h_advance_gridSubjects_bodytable tr.gridrow_blue td,
#h_advance_NonCurrTemp_bodytable tr.gridrow_blue td {
background-color: none !important;
color: #525659;
}
`);
}
module.exports = {
shouldActivate: () =>
utils.isLoggedIn() && utils.isPageId("0222", "h_advance"),
initialize: () => {
fixAdvanceList();
},
};
/***/
},
/***/ 318: /***/ (
module,
__unused_webpack_exports,
__webpack_require__
) => {
const $ = window.jQuery;
const utils = __webpack_require__(555);
const storage = __webpack_require__(75);
// Returns users with stored credentials
function getLoginUsers() {
const users = [];
const list = storage.get("users", utils.getDomain());
if (!list) {
return users;
}
Object.keys(list).forEach((user) => {
if (
typeof list[user].password === "string" &&
list[user].password !== ""
) {
users.push(user);
}
});
return users;
}
function initUserSelect() {
const users = getLoginUsers();
$(".login_left_side .login_input").css("text-align", "left");
const selectField = $(
'<select id="user_sel" class="bevitelimezo" name="user_sel"></select>'
).hide();
users.forEach((user) => {
$('<option class="neptun_kod"></option>')
.attr("id", user)
.attr("value", user)
.text(user)
.appendTo(selectField);
});
selectField.append(
'<option disabled="disabled" class="user_separator">&nbsp;</option>'
);
selectField.append(
'<option id="other_user" value="__OTHER__">Más felhasználó...</option>'
);
selectField.append(
'<option id="edit_list" value="__DELETE__">Tárolt kód törlése...</option>'
);
$("td", selectField).css("position", "relative");
selectField
.css("font-weight", "bold")
.css("font-family", "consolas, courier new, courier, monospace")
.css("font-size", "1.5em");
$("option[class!=neptun_kod]", selectField)
.css("font-size", "0.8em")
.css("font-family", "tahoma")
.css("font-weight", "normal")
.css("color", "#666")
.css("font-style", "italic");
$("option.user_separator", selectField).css("font-size", "0.5em");
selectField.bind("mousedown focus change", function() {
abortLogin();
});
$("#pwd, #Submit, #btnSubmit").bind(
"mousedown focus change",
function() {
abortLogin();
}
);
selectField.bind("change", function() {
clearLogin();
if ($(this).val() === "__OTHER__") {
hideSelect();
return false;
}
if ($(this).val() === "__DELETE__") {
$("#user_sel").val(users[0]).trigger("change");
const itemToDelete = unsafeWindow.prompt(
"Írd be a törlendő neptun kódot. Az összes törléséhez írd be: MINDEGYIKET",
["mindegyiket", ...users].join(" / ")
);
if (!itemToDelete) {
return false;
}
let deleted = false;
users.forEach((user) => {
if (
user === itemToDelete.toUpperCase() ||
itemToDelete.toUpperCase() === "MINDEGYIKET"
) {
storage.set("users", utils.getDomain(), user, "password", null);
deleted = true;
}
});
if (!deleted) {
if (
confirm(
"A megadott neptun kód nincs benne a tárolt listában. Megpróbálod újra?"
)
) {
$("#user_sel").val("__DELETE__").trigger("change");
}
return false;
}
if (itemToDelete.toUpperCase() === "MINDEGYIKET") {
alert(
"Az összes tárolt neptun kód törölve lett a bejelentkezési listából."
);
window.location.reload();
return false;
}
alert(
`A(z) ${itemToDelete} felhasználó törölve lett a bejelentkezési listából.`
);
window.location.reload();
return false;
}
$("#user").val(users[$(this).get(0).selectedIndex]);
$("#pwd").val(
atob(
storage.get(
"users",
utils.getDomain(),
users[$(this).get(0).selectedIndex],
"password"
)
)
);
});
$("input[type=button].login_button")
.attr("onclick", "")
.bind("click", function(e) {
e.preventDefault();
if ($("#user_sel").val() === "__OTHER__") {
if (
$("#user").val().trim() === "" ||
$("#pwd").val().trim() === ""
) {
return;
}
const foundUser = users.find(
(user) => user === $("#user").val().toUpperCase()
);
if (!foundUser) {
if (
confirm(
"Szeretnéd menteni a beírt adatokat, hogy később egy kattintással be tudj lépni erről a számítógépről?"
)
) {
storage.set(
"users",
utils.getDomain(),
$("#user").val().toUpperCase(),
"password",
btoa($("#pwd").val())
);
}
submitLogin();
return;
} else {
$("#user_sel").val(foundUser);
}
}
if ($("#user_sel").val() === "__DELETE__") {
return;
}
if (
$("#pwd").val() !==
atob(
storage.get(
"users",
utils.getDomain(),
users[$("#user_sel").get(0).selectedIndex],
"password"
)
)
) {
if (
confirm(
`Szeretnéd megváltoztatni a(z) ${$("#user")
.val()
.toUpperCase()} felhasználó tárolt jelszavát a most beírt jelszóra?`
)
) {
storage.set(
"users",
utils.getDomain(),
users[$("#user_sel").get(0).selectedIndex],
"password",
btoa($("#pwd").val())
);
}
}
submitLogin();
return;
});
$("#user").parent().append(selectField);
showSelect();
selectField.trigger("change");
}
let loginTimer;
let loginButtonText;
function initAutoLogin() {
const users = getLoginUsers();
if (users.length < 1) {
return;
}
const submit = $("#Submit, #btnSubmit");
let loginCount = 3;
loginButtonText = submit.attr("value");
submit.attr("value", `${loginButtonText} (${loginCount})`);
$(".login_button_td").append(
'<div id="abortLogin" style="text-align: center; margin: 23px 0 0 128px"><a href="#" class="abort_login">Megszakít</a></div>'
);
$(".login_button_td a.abort_login").click(function(e) {
e.preventDefault();
abortLogin();
});
loginTimer = window.setInterval(() => {
loginCount--;
submit.attr("value", `${loginButtonText} (${loginCount})`);
if (loginCount <= 0) {
submitLogin();
abortLogin();
submit.attr("value", `${loginButtonText}...`);
}
}, 1000);
}
// Abort the auto login countdown
function abortLogin() {
window.clearInterval(loginTimer);
$("#Submit, #btnSubmit").attr("value", loginButtonText);
$("#abortLogin").remove();
}
// Clears the login form
function clearLogin() {
$("#user").val("");
$("#pwd").val("");
}
// Display user select field
function showSelect() {
$("#user").hide();
$("#user_sel").show().focus();
utils.runEval(' Page_Validators[0].controltovalidate = "user_sel" ');
}
// Hide user select field and display original textbox
function hideSelect() {
$("#user_sel").hide();
$("#user").show().focus();
utils.runEval(' Page_Validators[0].controltovalidate = "user" ');
}
// Submit the login form
function submitLogin() {
unsafeWindow.docheck();
}
module.exports = {
shouldActivate: () => utils.isLoginPage(),
initialize: () => {
initUserSelect();
initAutoLogin();
},
};
/***/
},
/***/ 374: /***/ (
module,
__unused_webpack_exports,
__webpack_require__
) => {
const $ = window.jQuery;
const utils = __webpack_require__(555);
// Automatically press submit button on course list page
function initCourseAutoList() {
utils.runEval(function() {
const manager = window.Sys.WebForms.PageRequestManager.getInstance();
let courseListLoading = false;
manager.add_beginRequest(function() {
courseListLoading = true;
});
manager.add_endRequest(function() {
courseListLoading = false;
});
window.setInterval(() => {
if (
!courseListLoading &&
$("#h_addsubjects_gridSubjects_gridmaindiv").size() === 0
) {
$("#upFilter_expandedsearchbutton").click();
}
}, 250);
});
const updateTable = function() {
$("#upFunction_h_addsubjects_upGrid").html("");
};
$("body").on("change", "#upFilter_chkFilterCourses", updateTable);
$("body").on(
"change",
"#upFilter_rbtnSubjectType input[type=radio]",
updateTable
);
}
module.exports = {
shouldActivate: () =>
utils.isLoggedIn() && utils.isPageId("0303", "h_addsubjects"),
initialize: () => {
initCourseAutoList();
},
};
/***/
},
/***/ 977: /***/ (
module,
__unused_webpack_exports,
__webpack_require__
) => {
const $ = window.jQuery;
const utils = __webpack_require__(555);
// Enhance course list style and functionality
function fixCourseList() {
utils.injectCss(`
#h_addsubjects_gridSubjects_bodytable tr.Row1_Bold td,
#Addsubject_course1_gridCourses_bodytable tr.Row1_sel td,
#Addsubject_course1_gridCourses_grid_body_div tr.Row1_sel td,
#Addsubject_course1_gridCourses_bodytable tr.Row1_Bold_sel td,
#Addsubject_course1_gridCourses_grid_body_div tr.Row1_Bold_sel td,
#h_addsubjects_gridSubjects_bodytable tr.context_selectedrow td {
background-color: #F8EFB1 !important;
font-weight: bold; color: #525659;
}
#h_addsubjects_gridSubjects_bodytable tr,
#Addsubject_course1_gridCourses_bodytable tr,
#Addsubject_course1_gridCourses_grid_body_div tr {
cursor: pointer;
}
#h_addsubjects_gridSubjects_bodytable tr.npu_completed td,
#h_addsubjects_gridSubjects_bodytable tr.context_selectedrow[data-completed] td {
background-color: #D5EFBA !important;
font-weight: bold;
color: #525659;
}
#h_addsubjects_gridSubjects_bodytable tr.context_selectedrow {
border: 0 none !important;
border-bottom: 1px solid #D3D3D3 !important;
}
`);
$("body").on(
"click",
"#Addsubject_course1_gridCourses_bodytable tbody td, #Addsubject_course1_gridCourses_grid_body_div tbody td",
function(e) {
if (
$(e.target).closest("input[type=checkbox]").size() === 0 &&
$(e.target).closest("td[onclick]").size() === 0
) {
const checkbox = $(
"input[type=checkbox]",
$(this).closest("tr")
).get(0);
checkbox.checked = !checkbox.checked;
if (utils.getAjaxInstance(this)) {
utils
.getAjaxInstance(this)
.Cv(
$("input[type=checkbox]", $(this).closest("tr")).get(0),
"1"
);
}
e.preventDefault();
return false;
}
}
);
$("body").on(
"click",
"#h_addsubjects_gridSubjects_bodytable tbody td",
function(e) {
if (
$(e.target).closest("td[onclick], span.link").size() === 0 &&
$(e.target)
.closest("td.contextcell_sel, td.contextcell")
.size() === 0
) {
utils.runEval(
$("td span.link", $(this).closest("tr")).attr("onclick")
);
e.preventDefault();
return false;
}
}
);
window.setInterval(() => {
const table = $("#h_addsubjects_gridSubjects_bodytable");
if (table.attr("data-painted") !== "1") {
table.attr("data-painted", "1");
$("tbody tr", table).each(function() {
if ($('td[n="Completed"] img', this).size() !== 0) {
$(this).addClass("npu_completed").attr("data-completed", "1");
}
});
}
}, 250);
}
module.exports = {
shouldActivate: () =>
utils.isLoggedIn() && utils.isPageId("0303", "h_addsubjects"),
initialize: () => {
fixCourseList();
},
};
/***/
},
/***/ 104: /***/ (
module,
__unused_webpack_exports,
__webpack_require__
) => {
const $ = window.jQuery;
const utils = __webpack_require__(555);
const storage = __webpack_require__(75);
let courses;
function loadCourses() {
courses = {
...storage.getForUser("courses", "_legacy"),
...storage.getForUser("courses", utils.getTraining()),
};
}
function refreshScreen() {
$("#h_addsubjects_gridSubjects_bodytable").attr(
"data-choices-displayed",
"0"
);
$("#Addsubject_course1_gridCourses_bodytable").attr(
"data-inner-choices-displayed",
"0"
);
$("#Addsubject_course1_gridCourses_grid_body_div").attr(
"data-inner-choices-displayed",
"0"
);
}
// Initialize course choice storage and mark subject and course lines with stored course choices
function initCourseStore() {
utils.injectCss(`
#h_addsubjects_gridSubjects_bodytable tr td.npu_choice_mark,
#Addsubject_course1_gridCourses_bodytable tr td.npu_choice_mark,
#Addsubject_course1_gridCourses_grid_body_div tr td.npu_choice_mark {
background: #C00 !important;
}
`);
loadCourses();
window.setInterval(() => {
const table = $("#h_addsubjects_gridSubjects_bodytable");
if (
table.size() > 0 &&
table.attr("data-choices-displayed") !== "1"
) {
table.attr("data-choices-displayed", "1");
const filterEnabled = storage.getForUser("filterCourses");
const filterOptionalEnabled = storage.getForUser("filterOptionalCourses");
$("tbody tr", table).each(function() {
const subjectCode = $("td:nth-child(3)", this)
.text()
.trim()
.toUpperCase();
const subjectType = $("td:nth-child(8)", this)
.text()
.trim()
.toUpperCase();
const choices = courses[subjectCode.trim().toUpperCase()];
if (filterOptionalEnabled && subjectType === "Szabadon választható") {
$(this).css("display", "none");
} else if (
typeof choices !== "undefined" &&
choices !== null &&
choices.length > 0
) {
$("td:first-child", this).addClass("npu_choice_mark");
$(this).css("display", "table-row");
} else {
$("td:first-child", this).removeClass("npu_choice_mark");
$(this).css("display", filterEnabled ? "none" : "table-row");
}
});
if (
$(
"#h_addsubjects_gridSubjects_gridmaindiv .grid_pagertable .grid_pagerpanel"
).size() === 0
) {
$(
'<td class="grid_pagerpanel"><table align="right"><tbody><tr></tr></tbody></table></td>'
).insertBefore(
"#h_addsubjects_gridSubjects_gridmaindiv .grid_pagertable .grid_pagerrow_right"
);
}
const pager = $(
"#h_addsubjects_gridSubjects_gridmaindiv .grid_pagertable .grid_pagerpanel table tr"
);
if ($("#npu_clear_courses").size() === 0) {
const clearAll = $(
'<td id="npu_clear_courses"><a style="color: #C00; line-height: 17px; margin-right: 30px" href="">Tárolt kurzusok törlése</a></td>'
);
$("a", clearAll).click(function(e) {
e.preventDefault();
if (
confirm(
`${utils.getNeptunCode()} felhasználó összes tárolt kurzusa törölve lesz ezen a képzésen. Valóban ezt szeretnéd?`
)
) {
storage.setForUser("courses", utils.getTraining(), {});
storage.setForUser("courses", "_legacy", {});
storage.setForUser("filterCourses", false);
loadCourses();
refreshScreen();
}
});
pager.prepend(clearAll);
}
if ($("#npu_filter_courses").size() === 0) {
const filterCell = $(
`<td id="npu_filter_courses" style="padding-right: 30px; line-height: 17px">` +
`<input type="checkbox" id="npu_filter_field" style="vertical-align: middle" />&nbsp;&nbsp;` +
`<label for="npu_filter_field">Csak a tárolt kurzusok megjelenítése</label>` +
`</td>`
);
$("input", filterCell).change(function() {
storage.setForUser("filterCourses", $(this).get(0).checked);
refreshScreen();
});
pager.prepend(filterCell);
}
$("#npu_filter_field").get(0).checked = filterEnabled;
if ($("#npu_filter_optional_courses").size() === 0) {
const filterCell = $(
`<td id="npu_filter_optional_courses" style="padding-right: 30px; line-height: 17px">` +
`<input type="checkbox" id="npu_filter_optional_field" style="vertical-align: middle" />&nbsp;&nbsp;` +
`<label for="npu_filter_optional_field">Szabadon választhatók elrejtése</label>` +
`</td>`
);
$("input", filterCell).change(function() {
storage.setForUser(
"filterOptionalCourses",
$(this).get(0).checked
);
refreshScreen();
});
pager.prepend(filterCell);
}
$("#npu_filter_optional_field").get(0).checked = filterOptionalEnabled;
}
const innerTable = $(
"#Addsubject_course1_gridCourses_bodytable:visible, #Addsubject_course1_gridCourses_grid_body_div:visible"
).first();
if (
innerTable.size() > 0 &&
innerTable.attr("data-inner-choices-displayed") !== "1"
) {
innerTable.attr("data-inner-choices-displayed", "1");
if ($("th.headerWithCheckbox", innerTable).size() === 0) {
const objName = utils.getAjaxInstanceId(this);
$(
`<th id="head_chk" class="headerWithCheckbox headerDisabled" colname="chk" title="Válasszon ki legalább egyet!" align="center">` `<label class="hiddenforlabel" for="Addsubject_course1_gridCourses_bodytable_chk_chkall">Összes kijelölése</label> `<span></span> `<input aria-disabled="false" role="checkbox" id="Addsubject_course1_gridCourses_bodytable_chk_chkall" `onclick="${objName}.AllCheckBox(this.checked,'chk',true,1,this)" type="checkbox" `<span></spa `</th>`
).appendTo("#Addsubject_course1_gridCourses_headerrow");
$("tbody tr", innerTable).each(fuction () {
const id = $(this).attr("id").substring(4);
const text = $("td:nth-child(2)", this).text().trim();
$(
`<td t="chks" n="chk" class="aligncenter `<label class="hiddenforlabel" for="chk${id}">${text}</labe `<input id="chk${id}" aria-disabled="false" role="checkbox" onclick="${objName}.Cv(this,'1');" type="checkbox `</td>`
).appendTo(this);
});
}
$("tbody tr", innerTable).each(fuction () {
$("input[type=checkbox]", this).removeAttr("disabled");
});
const subjectText = $(
"#Subject_data_for_schedule_ctl00:visible > div > div > h2"
).html();
if (subjectText !== null) {
const part = subjectText.split("<br>")[0];
const subjectCode = utils.parseSubjectCode(part);
if (subjectCode) {
const choices = courses[subjectCode.trim().toUpperCase()];
const hasChoices = choices && choices.length > 0;
if (hasChoices) {
$("tbody tr", innerTable).each(fuction () {
const courseCode = $("td:nth-child(2)", this)
.text()
.trim()
.toUpperCase();
if (choices.includes(courseCode)) {
$("td:first-child", this).addClass("npu_choice_mark");
} else {
$("td:first-child", this).removeClass("npu_choice_mark");
}
});
} else {
$("tbody tr td:first-child", innerTable).removeClass(
"npu_choice_mark"
);
}
if ($(".npu_course_choice_actions").size() === 0) {
let header = $(
"#Addsubject_course1_gridCourses_gridmaindiv .grid_functiontable_top .functionitem"
);
let footer = $(
"#Addsubject_course1_gridCourses_tablebottom .grid_functiontable_bottom .functionitem"
);
const canSave = header.size() > 0;
if (header.size() === 0) {
$(
`<table class="grid_functiontable_top" align="left"><tbody><t `<td class="functionitem" nowrap=""></t `</tr></tbody></table>`
).appendTo(
"#Addsubject_course1_gridCourses_gridmaindiv .grid_topfunctionpanel"
);
header = $(header.selector);
}
if (footer.size() === 0) {
$(
`<table class="grid_functiontable_bottom" align="right"><tbody>< `<td class="functionitem" nowrap=""></ `</tr></tbody></table>`
).appendTo(
"#Addsubject_course1_gridCourses_tablebottom .grid_bottomfunctionpanel"
);
footer = $(footer.selector);
}
const loadAndSaveHtml = canSave
? '<input type="button" value="Betöltés és Mentés" class="gridbutton npu_course_choice_apply" style="display: none">'
: "";
const buttonBarExtensions = $(
`<span class="npu_course_choice_actions" style="margin: 0 20p `<span class="FunctionCommandTitle">Tárolt kurzusok:</sp `<input type="button" value="Tárolás" class="gridbutton npu_course_choice_sav `<input type="button" value="Betöltés" class="gridbutton npu_course_choice_load" style="display: no `${loadAndSaveH `<input type="button" value="Törlés" class="gridbutton npu_course_choice_delete" style="display: none"></span>`
);
header.append(buttonBarExtensions);
footer.prepend(buttonBarExtensions.clone());
$(".npu_course_choice_actions .npu_course_choice_save").click(
unction () {
const selectedCourses = [];
$("tbody tr", innerTable).each(unction () {
const courseCode = $("td:nth-child(2)", this)
.text()
.trim()
.toUpperCase();
const checkbox = $("input[type=checkbox]", this).get(0);
if (checkbox.checked) {
selectedCourses.push(courseCode);
}
});
if (selectedCourses.length === 0) {
alert(
"A tároláshoz előbb válaszd ki a tárolandó kurzusokat."
);
} else {
storage.setForUser(
"courses",
utils.getTraining(),
subjectCode.trim().toUpperCase(),
selectedCourses
);
loadCourses();
refreshScreen();
}
}
);
$(".npu_course_choice_actions .npu_course_choice_load").click(
unction () {
$("tbody tr", innerTable).each(unction () {
const courseCode = $("td:nth-child(2)", this)
.text()
.trim()
.toUpperCase();
const checkbox = $("input[type=checkbox]", this).get(0);
checkbox.checked =
courses[subjectCode.trim().toUpperCase()].includes(
courseCode
);
if (utils.getAjaxInstance(this)) {
utils.getAjaxInstance(this).Cv(checkbox, "1");
}
});
}
);
$(
".npu_course_choice_actions .npu_course_choice_apply"
).click(unction () {
utils.runEval(unction () {
$(
".npu_course_choice_actions .npu_course_choice_load"
).trigger("click");
});
if (utils.getAjaxInstance(this)) {
utils.getAjaxInstance(this).SelectFunction("update");
}
});
$(
".npu_course_choice_actions .npu_course_choice_delete"
).click(unction () {
if (
confirm("Valóban törölni szeretnéd a tárolt kurzusokat?")
) {
storage.setForUser(
"courses",
utils.getTraining(),
subjectCode.trim().toUpperCase(),
null
);
storage.setForUser(
"courses",
"_legacy",
subjectCode.trim().toUpperCase(),
null
);
loadCourses();
refreshScreen();
}
});
}
$(
".npu_course_choice_load, .npu_course_choice_apply, .npu_course_choice_delete",
$(".npu_course_choice_actions")
).css("display", hasChoices ? "inline" : "none");
}
}
}
}, 1000);
}
module.exports = {
shouldActivate: () =>
utils.isLoggedIn() && utils.isPageId("0303", "h_addsubjects"),
initialize: () => {
initCourseStore();
},
};
/***/
},
/***/ 230: /***/ (
module,
__unused_webpack_exports,
__webpack_require__
) => {
const $ = window.jQuery;
const utils = __webpack_require__(555);
const storage = __webpack_require__(75);
let examListTerm;
let examListSubject;
let examListSubjectValue;
let examSubjectFilterCache;
// Enhance exam list style and functionality
function fixExamList() {
utils.injectCss(`
#h_exams_gridExamList_bodytable tr.gridrow_blue td {
background-color: #F8EFB1 !important;
font-weight: bold;
color: #525659 !important;
}
#h_exams_gridExamList_bodytable tr.npu_completed td {
background-color: #D5EFBA !important;
}
#h_exams_gridExamList_bodytable tr.npu_failed td {
background-color: #F2A49F !important;
color: #3A3C3E !important;
}
#h_exams_gridExamList_bodytable tr.npu_hidden {
display: none;
}
#h_exams_gridExamList_bodytable tr {
cursor: pointer;
}
#upFilter_cmbSubjects option[value="0"] {
font-size: 13px;
font-weight: bold;
text-decoration: underline;
}
#upFilter_cmbSubjects option.npu_hidden {
display: none;
}
#upFilter_cmbSubjects option.npu_subscribed {
background-color: #F8EFB1 !important;
font-weight: bold;
}
#upFilter_cmbSubjects option.npu_completed {
background-color: #D5EFBA !important;
}
#upFilter_cmbSubjects option.npu_failed {
background-color: #F2A49F !important;
color: #3A3C3E !important;
}
`);
$("body").on(
"click",
"#h_exams_gridExamList_bodytable tbody td",
unction (e) {
if (
$(e.target)
.closest("td[onclick], td.contextcell_sel, td.contextcell")
.size() === 0
) {
utils.runEval(() => {
$(
"td.contextcell, td.contextcell_sel",
$(this).closest("tr")
).trigger("click");
});
e.preventDefault();
return false;
}
}
);
// Exam classes listed from most important to least important
const classPrecedence = [
"npu_subscribed",
"npu_failed",
"npu_completed",
"npu_regular",
].reverse();
// Selects the class with the higher precedence from the two provided classes
const selectImportantClass = unction (one, two) {
// Invalid classes have an index of -1 so they are never selected in favor of a valid one
return classPrecedence.indexOf(one) > classPrecedence.indexOf(two)
? one
: two;
};
window.setInterval(() => {
const table = $("#h_exams_gridExamList_bodytable");
const filterCompleted = storage.getForUser("filterExams");
const filterNonSubscribed = storage.getForUser(
"filterSubscribedExams"
);
if (table.attr("data-processed") !== "1") {
table.attr("data-processed", "1");
$("tbody tr[id*=tr__]", table).each(unction () {
const row = $(this);
const courseCode = $("td:nth-child(3)", row)
.clone()
.children()
.remove()
.end()
.text();
const rowId = row.attr("id").replace(/^tr__/, "");
const subRow = $(`#trs__${rowId}`, row.closest("tbody"));
const markRows = $(".subtable > tbody > tr", subRow);
row.add(markRows).removeClass(classPrecedence.join(" "));
markRows.each(unction () {
const grade = $("td:nth-child(4)", this).text().trim();
if (utils.isPassingGrade(grade)) {
$(this).addClass("npu_completed");
}
if (utils.isFailingGrade(grade)) {
$(this).addClass("npu_failed");
}
});
let rowClass = row.hasClass("gridrow_blue")
? "npu_subscribed"
: "npu_regular";
if (markRows.size() > 0) {
const lastMark = markRows.last();
const grade = $("td:nth-child(4)", lastMark).text().trim();
// The class 'npu_subscribed' has a higher precedence than these, so it will not get overwritten
rowClass = selectImportantClass(
rowClass,
utils.isPassingGrade(grade) && "npu_completed"
);
rowClass = selectImportantClass(
rowClass,
utils.isFailingGrade(grade) && "npu_failed"
);
if (rowClass === "npu_completed") {
row
.add( [filterCompleted ? "addClass" : "removeC "npu_ );
}
}
if (rowClass !== "npu_subscribed" && filterNonSubscribed) {
row.addClass("npu_hidden");
}
row.addClass(rowClass);
if (
!$("#upFilter_cmbSubjects").val() ||
$("#upFilter_cmbSubjects").val() === "0"
) {
examSubjectFilterCache = examSubjectFilterCache || {};
// Only overwrite the class if it has a higher precedence than the previous one
examSubjectFilterCache[courseCode] = selectImportantClass(
examSubjectFilterCache[courseCode],
rowClass
);
}
});
if (examSubjectFilterCache) {
$("#upFilter_cmbSubjects > option").each(unction () {
$(this).removeClass(`npu_hidden ${classPrecedence.join(" ")}`);
const subjectCode = utils.parseSubjectCode(
$(this).text().trim()
);
const rowClass = examSubjectFilterCache[subjectCode];
const enabled = storage.getForUser("filterExams");
if (subjectCode) {
$(this).addClass(rowClass || "npu_hidden");
}
if (enabled && rowClass === "npu_completed") {
$(this).addClass("npu_hidden");
}
});
}
}
}, 250);
window.setInterval(() => {
const filterCompleted = storage.getForUser("filterExams");
const pager = $(
"#h_exams_gridExamList_gridmaindiv .grid_pagertable .grid_pagerpanel table tr"
);
if ($("#npu_filter_exams").size() === 0) {
const filterCell = $(
`<td id="npu_filter_exams" style="padding-right: 30px; line-height: 17 `<input type="checkbox" id="npu_filter_field" style="vertical-align: middle" />&nbsp;&n `<label for="npu_filter_field">Teljesített tárgyak elrejtése</la `</td>`
);
$("input", filterCell).change(unction () {
storage.setForUser("filterExams", $(this).get(0).checked);
utils.runEval(unction () {
$("#upFilter_expandedsearchbutton").click();
});
});
pager.prepend(filterCell);
}
$("#npu_filter_field").get(0).checked = filterCompleted;
const filterNonSubscribed = storage.getForUser(
"filterSubscribedExams"
);
if ($("#npu_filter_non_subscribed_field").size() === 0) {
const filterSubscribedCell = $(
`<td id="npu_filter_non_subscribed_exams" style="padding-right: 30px; line-height: 17 `<input type="checkbox" id="npu_filter_non_subscribed_field" style="vertical-align: middle" />&nbsp;&n `<label for="npu_filter_non_subscribed_field">Csak a jelentkezett vizsgák megjelenítése</la `</td>`
);
$("input", filterSubscribedCell).change(unction () {
storage.setForUser(
"filterSubscribedExams",
$(this).get(0).checked
);
utils.runEval(unction () {
$("#upFilter_expandedsearchbutton").click();
});
});
pager.prepend(filterSubscribedCell);
}
$("#npu_filter_non_subscribed_field").get(0).checked =
filterNonSubscribed;
}, 500);
}
// Automatically list exams on page load and subject change
function initExamAutoList() {
utils.injectCss(`
#upFilter_bodytable tr.nostyle {
display: none;
}
`);
$("body").on("change", "#upFilter_cmbSubjects", unction () {
examListSubjectValue = $(this).val();
});
window.setInterval(() => {
const panel = $("#upFilter_panFilter table.searchpanel");
const termChanged =
examListTerm !==
$("#upFilter_cmbTerms option[selected]").attr("value");
const subjectChanged = examListSubject !== examListSubjectValue;
if (
panel.attr("data-listing") !== "1" &&
(termChanged || subjectChanged)
) {
panel.attr("data-listing", "1");
if (termChanged) {
examSubjectFilterCache = null;
}
examListTerm = $("#upFilter_cmbTerms option[selected]").attr(
"value"
);
examListSubject = examListSubjectValue;
utils.runEval(unction () {
$("#upFilter_expandedsearchbutton").click();
});
}
}, 100);
}
module.exports = {
shouldActivate: () =>
utils.isLoggedIn() && utils.isPageId("0401", "h_exams"),
initialize: () => {
fixExamList();
initExamAutoList();
},
};
/***/
},
/***/ 340: /***/ (
module,
__unused_webpack_exports,
__webpack_require__
) => {
const $ = window.jQuery;
const utils = __webpack_require__(555);
// Hide page header to save vertical space
function hideHeader() {
$("#panHeader, #panCloseHeader").hide();
$("table.top_menu_wrapper")
.css("margin-top", "5px")
.css("margin-bottom", "8px");
$("#form1 > fieldset").css("border", "0 none");
$("#span_changeproject").parent().hide();
}
module.exports = {
shouldActivate: () => utils.isLoggedIn(),
initialize: () => {
hideHeader();
},
};
/***/
},
/***/ 232: /***/ (
module,
__unused_webpack_exports,
__webpack_require__
) => {
const $ = window.jQuery;
const utils = __webpack_require__(555);
// Hide popup notifying the user about unfilled surveys on every login
function hideSurveyPopup() {
$(
".ui-dialog:has(#startupPopup_lblOpinion) .ui-dialog-titlebar-close"
).click();
}
module.exports = {
shouldActivate: () => utils.isLoggedIn(),
initialize: () => {
hideSurveyPopup();
},
};
/***/
},
/***/ 371: /***/ (
module,
__unused_webpack_exports,
__webpack_require__
) => {
const $ = window.jQuery;
const utils = __webpack_require__(555);
// Hide countdown and send requests to the server to keep the session alive
function initKeepSession() {
const cdt = $("#hfCountDownTime");
let timeout = 120;
if (cdt.size() > 0) {
const cdto = parseInt(cdt.val(), 10);
if (cdto > 60) {
timeout = cdto;
}
}
const keepAlive = unction() {
window.setTimeout(() => {
const pages = ["inbox", "0303", "0401", "0203", "0206"];
const page = pages[Math.floor(Math.random() * pages.length)];
$.ajax({
url: `main.aspx?ismenuclick=true&ctrl=${page}`,
});
keepAlive();
}, timeout * 1000 - 30000 - Math.floor(Math.random() * 30000));
};
keepAlive();
window.setInterval(() => {
utils.runEval(() => {
window.ShowModal = unct ion() { };
clearTimeout(window.timerID);
clearTimeout(window.timerID2);
window.sessionEndDate = null;
});
if ($("#npuStatus").size() === 0) {
$("#upTraining_lblRemainingTime").html(
`<span font-weight: norm ef="https://github.com/solymosi/npu" target="_blank">Neptun PowerUp!< `v${ GM.info.script.vers`</span>`
);
}
}, 1000);
ports = {
shouldActivate: () => utils.isLoggedIn(),
initialize: () => {
initKeepSession();
},
};
/***/
516: /***/ (
module,
__unused_webpack_exports,
__webpack_require__
=> {
const $ = window.jQuery;
nst utils = __webpack_require__(555);
/ Use custom loading indicator for async requests
function initProgressIndicator() {
const color = $("#lbtnQuit").css("color");
utils.injectCss(`
#npu_loading {
position: fixed;
width: 150px;
margin-left: -75px;
left: 50%;
top: 0;
background: ${color};
color: white;
font-size: 1.2em;
font-weight: bold;
padding: 8px 10px;
text-align: center;
z-index: 1000;
display: none;
-webkit-border-bottom-right-radius: 5px;
-webkit-border-bottom-left-radius: 5px;
-moz-border-radius-bottomright: 5px;
-moz-border-radius-bottomleft: 5px;
border-bottom-right-radius: 5px;
border-bottom-left-radius: 5px;
-webkit-box-shadow: 0px 0px 3px 0px black;
-moz-box-shadow: 0px 0px 3px 0px black;
x-shadow: 0px 0px 3px 0px black;
`);
#progress, #customtextprogress").css("visibility", "hidden");
'<div id="npu_loading">Kis türelmet...</div>').appendTo("body");
unEval(() => {
const manager = window.Sys.WebForms.PageRequestManager.getInstance();
nager.add_beginRequest(() => {
$("#npu_loading").show();
});
manager.add_endRequest(() => {
$("#npu_loading").hide();
});
});
exports = {
shouldActivate: () => utils.isLoggedIn(),
initialize: () => {
initProgressIndicator();
},
};
/***/
606: /***/ (
module,
__unused_webpack_exports,
__webpack_require__
=> {
const $ = window.jQuery;
nst utils = __webpack_require__(555);
Display Neptun PowerUp! version on login page
function showLoginBanner() {
const color = $("#lblModuleType").css("color");
utils.injectCss(`
#div_login_right_side .login_info_version span {
display: block;
margin-bottom: 5px;
}
#div_login_right_side .login_info_version span > a {
color: ${color};
text-decoration: none;
}
#div_login_right_side .login_info_version span > a:hover,
#div_login_right_side .login_info_version span > a:focus {
xt-decoration: underline;
;
$(
`< span id = "npuStatus" style = "font-weight: norm `<a href="https://github.com/soly m osi/npu" target="_blank" > `v${GM. `</span>`
).appendTo("#div_login_right_side .login_info_version");
exports = {
shouldActivate: () => utils.isLoginPage(),
initialize: () => {
showLoginBanner();
},
};
/***/
245: /***/ (
module,
__unused_webpack_exports,
__webpack_require__
=> {
nst utils = __webpack_require__(555);
configure server full wait dialog parameters
nction fixWaitDialog() {
safeWindow.maxtrynumber = 1e6;
xport the patched starttimer function into the security context of the page in order to avoid an "access denied" error on Firefox.
etails: https://blog.mozilla.org/addons/2014/04/10/changes-to-unsafewindow-for-the-add-on-sdk
nst timerFunction = () => {
unsafeWindow.login_wait_timer = unsafeWindow.setInterval(
unsafeWindow.docheck,
5000
);
};
exportFunction(timerFunction, unsafeWindow, {
defineAs: "npu_starttimer",
});
unsafeWindow.starttimer = unsafeWindow.npu_starttimer;
exports = {
shouldActivate: () => utils.isLoginPage(),
initialize: () => {
fixWaitDialog();
},
};
/***/
974: /***/ (
module,
__unused_webpack_exports,
__webpack_require__
=> {
const $ = window.jQuery;
nst utils = __webpack_require__(555);
/ Fix opening in new tab and add shortcuts
function fixMenu() {
const color = $("#lbtnQuit").css("color");
utils.injectCss(`
ul.menubar, .top_menu_wrapper {
cursor: default !important;
}
#mb1 li.menu-parent {
color: #525659 !important;
}
#mb1 li.menu-parent.has-target {
color: ${color} !important;
}
#mb1 li.menu-parent.has-target:hover {
lor: #000 !important;
#mb1_Tanulmanyok")
.attr("targeturl", "main.aspx?ctrl=0206&ismenuclick=true")
.attr("hoverid", "#mb1_Tanulmanyok_Leckekonyv");
"#mb1_Targyak")
.attr("targeturl", "main.aspx?ctrl=0303&ismenuclick=true")
.attr("hoverid", "#mb1_Targyak_Targyfelvetel");
$("#mb1_Vizsgak")
.attr("targeturl", "main.aspx?ctrl=0401&ismenuclick=true")
.attr("hoverid", "#mb1_Vizsgak_Vizsgajelentkezes");
const orarend = $(`
< li aria - haspopup="false" tabindex = "0" role = "menuitem"
class= "menu-parent has-target"
id = "mb1_Orarend"
rgeturl = "main.aspx?ctrl=0203&amp;ismenuclick=true" >
arend
</li >
"#mb1_Targyak").before(orarend);
$("#mb1_Tanulmanyok_Órarend").remove();
if (!$("#upChooser_chooser_kollab").hasClass("KollabChooserSelected")) {
$(`
<li aria-haspopup="false" tabindex="0" role="menuitem"
class="menu-parent has-target"
id="mb1_MeetStreet"
targeturl="javascript:__doPostBack('upChooser$btnKollab','')">
Meet Street
>
`).appendTo("#mb1");
}
if (!$("#upChooser_chooser_neptun").hasClass("NeptunChooserSelected")) {
$(`
<li aria-haspopup="false" tabindex="0" role="menuitem"
class="menu-parent has-target"
id="mb1_TanulmanyiRendszer"
targeturl="javascript:__doPostBack('upChooser$btnNeptun','')">
Neptun
li>
endTo("#mb1");
li[trgeturl]")
ss("position", "relative")
.each(unction () {
$(this).addClass("has-target");
const target = (this).attr("targeturl");
nst a = $(`
f = "${target}" style = "display: block; position: absolute; left: 0; top: 0; width: 100%; height: 100%" ></a >
a.click(unction(e) {
("ul.menu").css("visibility", "hidden");
e.stopPropagation();
hoverid = $(this).attr("hoverid");
hoverid) {
hover(
=> {
$(hoverid).addClass("menu-hover");
},
() => {
$(hoverid).removeClass("menu-hover");
}
);
$(this).appen odule.export shouldActivate: () => utils.isLoggedIn(),
initialize: () fixMe;
},
/***/
/***/ 73: /***/ (module, __unused_webpack_exports, __webpack_require__) const utils = __webpack_require__(555);
// Enhance mark list style
function fixMarkList() {
utils.inject #h_markbook_gridIndexEntry_bodytable tr.SubjectCompletedRow td {
background - color: #D5EFBA!impor module.export shouldActivate: utils.isLoggedIn() && utils.isPageId("0206", "h_markbook"),
initialize: () fixMarkLi;
},
/***/ 802: /* mo __unused_webpack_exports,
__webpack_requ ) const $ = window.jQ const utils = __webpack_require__( / Allow user to dismiss the 'you have an official message' function fixOfficialMessagePopu const dismiss = () const e = $(
"[aria-describedby=upRequiredMessageReader_upmodal_RequiredMessageReader_divpopup] .ui-dialog-con e.dialog("clo window.setInterval(() const popup "#upRequiredMessageReader_upmodal_RequiredMessageReader_divpopup:vis ).closest(".ui-dial popup.size() > $("#upFunction_c_messages_upMain_upGrid").size() utils.runEval(dism if (popup.size() > 0 && popup.is(":not([data-npu-enhanced]) popup.attr("data-npu-enhanced", "tr $("input[commandnae=Tovabb]", popup).val("Elolvasom");
const dismissBtn = $(
'<input value="Most nem érdek _dismiss ui-button ui-widget fault ui-corner-all ui-but y" t n">'
);
dismissBtn.click(unction () { ls.runEval(dismiss) });
ui-dialog-footerbar > div", popup).append(di
}
0);
}
module.exp {
sho e: () => utils.is In(),
initialize: () => {
xOfficialMessagePopu
};
/***/
/***/ 674: /***/ (
module,
ed_webpack_exports,
__webpack_require__ => {
const $ = Query;
const utils = __webpack_r(555);
// Add curren e to the window title
function fixTitle() {
const origi document.title;
window.setInter const p #upMenuCaption_menucaption").text().toString();
if ti originalTi
document.title(pageTitle === "" ? "" : `${pageTi ) + originalTitle;
}, e.expo = {
shouldActivate: utils.i dIn(),
initialize: {
fixTitl
};
/***/
/***/ 564: /***/ (
module,
ed_webpack_exports,
__webpack_require_) => {
const $ = wind y;
const utils = __we ire__(555);
// Set all paginators to 500 i age
function fixPginat window.setInter lect = $(".grid_pagerpanel select");
ach(unction() {
const e = $(this);
$(".link_pagesize", e.closest(" ;
if(e.attr("data-listing") !== "1" && 00") {
a - listing", "1").val("500");
ns t ribu onchange" if (onChange) {
utils.runEval(onChange.value);
}
}
;
}, 100)
}
module.exports = {
shouldActivate: () = s.isLogg,
initialize: () = fixPaginatio
};
/***/
/***/ 893: /***/ (
module,
ed_webpack_exports,
__webpack_require__
) const $ = window.jQuery;
st utils = __webpack_require__(555);
// Enhance signed exam list style and functionality
function fixSignedExamList() {
utils.injectCss(`
#h_signedexams_gridExamList_bodytable tr.npu_missed td {
background-color: #F8EFB1 !important;
color: #525659 !important;
}
#h_signedexams_gridExamList_bodytable tr.npu_completed td {
background-color: #D5EFBA !important;
}
#h_sig _gridExamList_bodytable tr. td {
background-color: #F2A49F !important;
col E !important;
}
`);
window.se => {
const table = $("#h_ gridExamList_bodytable");
table.attr("data-processed") !== "1") {
table.attr(sed", "1"); const resultCellIndex "#h_signedexams_gridExamList_headerrow th[id ^= head_ExamRes ).ind ltCellIndex) {
// Bail because wehave cell has the exam res return;
}
$("tbody tr:not(.N e).each(unction ( const row = $(this);
row.removeClass("npu_completed npu_failed npu_ const attended =
$("td[n=Attended]", row)[0].attributes.checked.v "true" ||
$("td[n=JustifiedMissing]" ibtes.checked.v "true";
con row).eq(resultCellIndex).text(ded) {
if (utils.is)) {
row.a pl if (utils.isFailingGrade(row.np ");
} else row.addClass ed");
}
});
}
}, 25
}
module.ex shouldActivat
ut Logged && utils.isPageId("0402", nedexams initialize: () => {
fixSignedExamLis
};
/***/
/***/ 654: /***/ (
module,
sed_webpack_exports,
__webpack_requi) => {
const $ = window.jQuery;
st utils = __webpack_requir;
const storage = __webpack_require__(75);
// Replace term drop-down list with buttons
function fixTermSelect() {
utils.injectCss(`
.termSelect {
list-style: none;
padding: 0;
}
.termSelect li {
display: inline-block;
vertical-align: middle;
margin: 0 15px 0 0;
line-height: 250%;
}
.termSelect li a {
padding: 5px;
.termSelect li a.button {
FF;
no -decoration: none;
ault;
}
`);
ermSelect = () => {
urn $(
[
ter_cmbTerms "#upFilter_cmb_m_cmb",
rmal",
er_cmbTerms_m b", "#c_common_ti bTermsNo "#cmbT
n(", ")
irst();
const blankl "h_addsubject ",
"h_exams",
" "h_transactionlist",
"1406", h_gradin,
const clickEx = () => {
if (blanklist.includes(ut eId(eturn;
}
ut l(() => {
$("#upFilter_ex chbutton").click();
});
};
lectTerm = (term) => {
const termSelec Select();
t ermSelect a[data - value= ${ term }]`);
el.size() === 0 || el.hasClass("button")) {
turn false;
} termSelect.val(el.attr("data-value"));
$(".termSel n").removeClass( el.addClass("b const onChange = termSelec ibut ha if (on {
utils.runAsync(() => {
utils.runEval(onChange.value);
;
}
return tru ;
se () => {
const termSelec Select();
if (ter :disabled")) {
return;
}
ermSelect.is(":visible")) {
$(".termSelect").remove(); const select = $(' ermSelect"></ul>');
let ge.getFo ect", utils.getPageId());
le lse;
const match = $("#lblTrainingName")
.text()
.match(/:(\d{}\/\d ]\/);
const admissionSeme String(m on", termSelect).each(unction () {
if ($(this).at "-1") {
}
if (admission this).text() < er) {
return;
}
$(this).attr("value");
lass =
t.val() === $(this).attr("value") ? "button" : "";
const labe ml( const item = $(
`< li > <a href="# value}" class= ab );
if stored ("value") === stored found = true;
}
em.bind("click", unctio e.preventDefault(onst term = $(t e");
if (selectTerm(term)) {
t stored = term tFor ct", utils.getPageId( }
clickExecuteButt
}
select.append(item);
termSelect.parent().append(se termSelect.hide();
if (!ter itialized")) {
ect.data("initialized" if (found && termSelect.val() !== stored selectTerm(stored) te
} else if ($("pagertable").size() {
clickExecuteButton();
}
}
}
}, 500)
}
module.exports = {
shouldActivate: () => utils.isLoggedIn(),
initialize: () => {
ermSelect();
},
;
/***/
},
/***/ 46: /*** ule, __unused_webpack_exports, __we require__) => {
cons ndow.jQuery;
const ut bpack_require__(555);
// Enhance timetable func function fixTimetble() dow.setInterval(() => {
if ($("#gridcon "dta-bound") ! utils.runEval(unction () {
= $("#gridcontainer").BcalGetOp();
{
$("#gridcontainer).attr );
const callback = options.onAfterRequ options.onAfterRequestData = unction (n) if ttr("data-called") !== "1") {
$("#gr data-called", "1");
"#upFu tim ab y"
.trigger( "); }
callback(n);
};
}
});
}
}, 100);
module.exports shouldActivat
ut Logged && utils.isPageId("0203", "c_common_timetable"),
initialize: () => {
Timetable();
},
};
/ },
/*** /***/ (module, _ d_webpack_exports, __webpack_require {
const utils = __webpa re__(5 // Stored data
let data = {};
// Load a from lcal s to async function initi ) { try {
data = JSON.par it GM.getValue("da {};
} cat ch(e) { }
await upgrade();
}
// Save all data to local storage
function save() {
GM.setValue("data", JSON.stringify(da // Gets the value at the specified key function get(...keys) {
turn utils.deepGetProp(data, keys) }
// Sets the value pecified key path
function set(.dValue) value = keysAndValue.pop();
const keys = keysAndValue; utils.deepSetProp(data, keys ;
sa
}
the specified prope data of the current us unction(...keys n g "users",
utils.getDomain(),
tils.getNeptunCode(),
"data", ...keys
}
ets the specified p the current user
setForUs AndValue) {
rn "users",
utils.getDomain(),
u etNeptunCode(),
"data", ...keysAndValue
);
}
// Upgrade the data sche e latest async fun adeSchema() const f data.version !== "undefined" ? data.version : 0;
1.3
if (
let users;
users = JSON.par tValu ));
) { }
if (ers)) {
use ) => {
s.ge
user[0].e(),
"password",
btoa(user[1])
}); let courses;
try {
ourses = JSON.parse(await GM.getValue("ne );
} cat ch(e) { }
if (typeof ect") ect.keys( user) => {
course subject) => set(
s",
.getDomain(),
"cou _l su co use ject]
data = 1;
e();
}
module.exports = {
in ze,
get,
s getForUser,
setForUser,
}; /***/
},
/***/ * / (module) => {
const $ = window.jQuery;
// Verify t ar ed on a Neptun page
function isNeptunP {
return document oLowerCase().indexOf("neptun.net") !== -1;
}
// Returns whether we are on the login p function isLoginPage return $("td.login_le e") ) > 0;
}
// Returns whether we are authentica function isLoggedIn() { return !!getNeptunCode();
}
/ nd returns the Neptun code of the current user
tion getNeptunCode() {
if ($("#upTraining_topname").size {
input = $("#upTraining_topname").text();
retur t.substring(input.index) + 3).toUpperCase();
}
} // Parses and he first-level domain of the site
function getDomain() {
cons atio it( const tlds "at co com edu eu gov hu hr info int mil rs sk si ua uk".split(
);
let domain = for (let i = host.length - 1; i >= 0; i--) {
d`$ i]} ain}`;
if (!tlds.includes(host[i])) {
retur in.substr(0, domain.lengt }
}
}
// returns the sanitized name o t traini ction getTraining() {
i bl ngN size() > 0) {
return $("#lbl ngName")
.t.replace(/[^a-zA-Z0-9]/g, "");
}
}
/ s the ID of the current page
ion geId() {
const result = /ctrl=([a-zA-Z0-9_]+)/g.indow.location.href);
esult ? result[1] : null;
}
/ R whether the specified ID is the curre e
function isPageId(...ctrls) return ctrls.includes(getPageId());
}
Get the current AJAX grid instance
function getAjaxInsta eme const instanceId = getAjaxInst lement);
return instanceId && unsafeWindow[getAjaxI d(element)];
}
function getAjaxInstanceId(element) {
co axGrid = $(element).closest("div[type=ajaxgrid]");
return a d.size() > 0 && ajaxGrid.f ttr("instanceid");
}
// function asynchronously to fix proble certain cases
functio nc(func) {
window.setTimeout(func, 0);
}
// Evaluat in the page context
function runEval(source const value = typeof source === "function" ? `(${so ;` : source;
const s document.createElement("script");
cript.setAttribute("type", "applica ava ");
script.textContent = value;
document.body.appe d(script);
document.b veChild(scr }
// Rea ue at the provided pa eply nested object
function deepGe {
o; hile (s.le const n = t() if (!(c instanceof Object && n in c)) {
retur }
c = c[n];
retu }
// Set at the provided path y nested object
pSetProp(o, s, v) c = o;
ength) {
t n = s.sh gth === === null) {
delete c[n];
else {
}
rn if (!(typeof c === "object" n c)) {
c[n] = ect();
}
c = c[n];
}
}
// Injects a style tag into the page
function injectCss(css) {
$("<style></style>").html(css).appen d");
}
// Pars ject code that is in parentheses at the en ing
funct ubjectCode(source) {
const str = sou if (str.charAt(st ) === ")") {
let depth for (let i = str.length - 2; i >= 0; i--) { c .charAt(i);
if (depth === 0 ") {
return str.substring(i + 1, str.l ;
depth == depth + 1 : depth;
depth = c === "(" && depth depth - 1 : depth;
}
}
ll;
// Returns if strin or a pas
func singGrade(str) { eturn [
s",
ellent",
"jó "good",
özepes",
isfactory", "elégséges"
"kiválóan megfelelt",
"exce "me t",
"average",
].some(unction (item) {
return str.toLowerCase().ind m) !== -1 });
}
eturns i n string stands fo g grade
func lingGrade(str) {
urn [
"e
"fail", "nem felelt meg", "unsatisfacory",
m jelent meg",
"did not attend",
em v ott "did not att ].some(u item) {
urn str.toLo ).indexOf(item)
}) }
modu ts = {
ptunPage,
isLoginPage,
ggedIn,
get de,
ain,
raining,
ageId,
Id,
Instance,
nstanceId,
ync,
run epGetP
deepSetProp,
injectCss,
parseSubjectCode,
isPassingGrade,
isFailingGrade,
};
/***/
},
/******/
};
/************************************************************************/
/******/ // The module cache
/******/ var __webpack_module_cache__ = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ var c odule = _ pack_module_cache__[moduleId];
/******/ if (cachedModule !== undefined) {
/******/ return cachedModule.exports;
/******/
}
/******/ // Create a new module (and put it into the cache)
/******/ var module = (__webp dule_cach moduleId] = {
/******/ // no module.id needed
/******/ // no module.loaded needed
/**** ports: { /******/
/******/
/**** // Execute the module function
/******/ __webpack_modules__[moduleId](
module,
module orts,
_ebpack_reire__
);
/******/
/******/ // Return the exports of the module
/******/ return module.expor;
/******/
}
/******/
/************************************************************************/
va__webpack orts__ = {};
// This entry need to be ped in an IIFE because it need to be isola against other modu the chunk.
{
const utils = __web equire__(555);
const s = __webpack_require__(75); const modules = [
// page
__webpack_requi 18),
__webpack_requi 45),
__webpack_requi 06),
// All authent pages
__webpack_req (340),
__webpack_req (674),
__webpack_req (974),
__webpack_req (654),
__webpack_requ 564),
__webp quire__(802),
__webp quire__(232),
ebpack_require__(371),
ebpack_require__
// Timetable page
_webpack_require__(46) // Markbook page
ack_require__(73),
ance page
__webpack_r __(616),
ourse signup page
__w _require__(977),
bpack_require__(374),
webp require__(104), // Exams page
__webpa uire__(230),
// Signed ge
ack_require__(893),
];
c () => {
await storage.initialize();
.for le) => {
if ( e.sh Activa() &&
(uti ls.isNeptunPage() || module.runOutsideNeptun)
) {
module.initialize();
}
});
})();
})();
/******/
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment