Advertisement
Guest User

Untitled

a guest
Sep 27th, 2017
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 64.34 KB | None | 0 0
  1. // ==UserScript==
  2. // @name Neptun PowerUp!
  3. // @namespace http://example.org
  4. // @description Felturbózza a Neptun-odat
  5. // @version 1.51.1
  6. // @include https://*neptun*/*hallgato*/*
  7. // @include https://*hallgato*.*neptun*/*
  8. // @include https://netw*.nnet.sze.hu/hallgato/*
  9. // @include https://nappw.dfad.duf.hu/hallgato/*
  10. // @include https://host.sdakft.hu/*
  11. // @include https://neptun.ejf.hu/ejfhw/*
  12. // @grant GM_xmlhttpRequest
  13. // @grant GM_getValue
  14. // @grant GM_setValue
  15. // @grant GM_info
  16. // @require https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js
  17. // @connect npu.herokuapp.com
  18. // ==/UserScript==
  19.  
  20. var npu = {
  21.  
  22. /* == STARTUP == */
  23.  
  24. /* Run features */
  25. init: function() {
  26. if(!this.isNeptunPage()) {
  27. return;
  28. }
  29.  
  30. this.initParameters();
  31. this.initStorage();
  32.  
  33. if(this.isLogin()) {
  34. this.initUserSelect();
  35. this.initAutoLogin();
  36. this.fixWaitDialog();
  37. }
  38. else {
  39. this.hideHeader();
  40. this.fixTitle();
  41. this.fixMenu();
  42. this.fixTermSelect();
  43. this.fixPagination();
  44. this.fixOfficialMessagePopup();
  45. this.initKeepSession();
  46. this.initProgressIndicator();
  47.  
  48. if(this.isPage("0203") || this.isPage("c_common_timetable")) {
  49. this.fixTimetable();
  50. }
  51.  
  52. if(this.isPage("0206") || this.isPage("h_markbook")) {
  53. this.fixMarkList();
  54. }
  55.  
  56. if(this.isPage("0222") || this.isPage("h_advance")) {
  57. this.fixProgressList();
  58. }
  59.  
  60. if(this.isPage("0303") || this.isPage("h_addsubjects")) {
  61. this.fixCourseList();
  62. this.initCourseAutoList();
  63. this.initCourseStore();
  64. }
  65.  
  66. if(this.isPage("0401") || this.isPage("h_exams")) {
  67. this.fixExamList();
  68. this.initExamAutoList();
  69. }
  70.  
  71. if(this.isPage("0402") || this.isPage("h_signedexams")) {
  72. this.fixSignedExamList();
  73. }
  74.  
  75. this.initStat();
  76. }
  77. },
  78.  
  79. /* == USER DATA == */
  80.  
  81. /* Stored data */
  82. data: { },
  83.  
  84. /* Initialize the storage module */
  85. initStorage: function() {
  86. npu.loadData();
  87. },
  88.  
  89. /* Load all data from local storage */
  90. loadData: function() {
  91. try {
  92. npu.data = JSON.parse(GM_getValue("data")) || {};
  93. }
  94. catch(e) { }
  95. npu.upgradeSchema();
  96. },
  97.  
  98. /* Save all data to local storage */
  99. saveData: function() {
  100. this.runAsync(function() {
  101. GM_setValue("data", JSON.stringify(npu.data));
  102. });
  103. },
  104.  
  105. /* Gets the specified property or all data of the specified user or the current user */
  106. getUserData: function(domain, user, key) {
  107. domain = domain ? domain : npu.domain;
  108. user = user ? user : npu.user;
  109. key = Array.prototype.slice.call(arguments).slice(2);
  110. key = key.length == 1 && typeof key[0].length != "undefined" ? key[0] : key;
  111. return npu.getChild(npu.data, ["users", domain, user, "data"].concat(key));
  112. },
  113.  
  114. /* Sets the specified property of the specified user or the current user */
  115. setUserData: function(domain, user, key, value) {
  116. domain = domain ? domain : npu.domain;
  117. user = user ? user : npu.user;
  118. key = Array.prototype.slice.call(arguments).slice(2, arguments.length - 1);
  119. key = key.length == 1 && typeof key[0].length != "undefined" ? key[0] : key;
  120. value = arguments.length > 4 ? arguments[arguments.length - 1] : value;
  121. npu.setChild(npu.data, ["users", domain, user, "data"].concat(key), value);
  122. },
  123.  
  124. /* Upgrade the data schema to the latest version */
  125. upgradeSchema: function() {
  126. var ver = typeof npu.data.version != "undefined" ? npu.data.version : 0;
  127.  
  128. /* < 1.3 */
  129. if(ver < 1) {
  130. try {
  131. var users = JSON.parse(GM_getValue("neptun.users"));
  132. }
  133. catch(e) { }
  134. if(users != null && typeof users.length != "undefined") {
  135. for(var i = 0; i < users.length; i++) {
  136. npu.setChild(npu.data, ["users", npu.domain, users[i][0].toUpperCase(), "password"], npu.encodeBase64(users[i][1]));
  137. }
  138. }
  139. try {
  140. var courses = JSON.parse(GM_getValue("neptun.courses"));
  141. }
  142. catch(e) { }
  143. if(typeof courses == "object") {
  144. for(var user in courses) {
  145. for(var subject in courses[user]) {
  146. npu.setUserData(null, user, ["courses", "_legacy", subject], courses[user][subject]);
  147. }
  148. }
  149. }
  150. npu.data.version = 1;
  151. }
  152.  
  153. npu.saveData();
  154. },
  155.  
  156. /* == LOGIN == */
  157.  
  158. /* Returns users with stored credentials */
  159. getLoginUsers: function() {
  160. var users = [], list = npu.getChild(npu.data, ["users", npu.domain]);
  161. for(var user in list) {
  162. if(typeof list[user].password == "string" && list[user].password != "") {
  163. users.push(user);
  164. }
  165. }
  166. return users;
  167. },
  168.  
  169. /* Load and display user select field */
  170. initUserSelect: function() {
  171. var users = npu.getLoginUsers();
  172.  
  173. $(".login_left_side .login_input").css("text-align", "left");
  174.  
  175. var selectField = $('<select id="user_sel" class="bevitelimezo" name="user_sel"></select>').hide();
  176. for(var i = 0; i < users.length; i++) {
  177. selectField.append('<option id="' + users[i] + '" value="' + users[i] + '" class="neptun_kod">' + users[i] + '</option>');
  178. }
  179.  
  180. selectField.append('<option disabled="disabled" class="user_separator">&nbsp;</option>');
  181.  
  182. selectField.append('<option id="other_user" value="__OTHER__">Más felhasználó...</option>');
  183. selectField.append('<option id="edit_list" value="__DELETE__">Tárolt kód törlése...</option>');
  184.  
  185. $("td", selectField).css("position", "relative");
  186. selectField.css("font-weight", "bold").css("font-family", "consolas, courier new, courier, monospace").css("font-size", "1.5em");
  187. $("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");
  188. $("option.user_separator", selectField).css("font-size", "0.5em");
  189.  
  190. selectField.bind("mousedown focus change", function() { npu.abortLogin() });
  191. $("#pwd, #Submit, #btnSubmit").bind("mousedown focus change", function() { npu.abortLogin() });
  192.  
  193. selectField.bind("change", function() {
  194. npu.clearLogin();
  195.  
  196. if($(this).val() == "__OTHER__") {
  197. npu.hideSelect();
  198. return false;
  199. }
  200.  
  201. if($(this).val() == "__DELETE__") {
  202. $("#user_sel").val(users[0]).trigger("change");
  203. var defaultString = "mindegyiket";
  204. for(var i = 0; i < users.length; i++) {
  205. defaultString += " / " + users[i];
  206. }
  207. itemToDelete = unsafeWindow.prompt("Írd be a törlendő neptun kódot. Az összes törléséhez írd be: MINDEGYIKET", defaultString);
  208. if(itemToDelete == "" || itemToDelete == null) {
  209. return false;
  210. }
  211.  
  212. var deleted = false;
  213. for(var i = 0; i < users.length; i++) {
  214. if(users[i] == itemToDelete.toUpperCase() || itemToDelete.toUpperCase() == "MINDEGYIKET") {
  215. npu.setChild(npu.data, ["users", npu.domain, users[i], "password"], null);
  216. deleted = true;
  217. }
  218. }
  219.  
  220. if(!deleted) {
  221. if(confirm("A megadott neptun kód nincs benne a tárolt listában. Megpróbálod újra?")) {
  222. $("#user_sel").val("__DELETE__").trigger("change");
  223. }
  224. return false;
  225. }
  226.  
  227. npu.saveData();
  228.  
  229. if(itemToDelete.toUpperCase() == "MINDEGYIKET") {
  230. alert("Az összes tárolt neptun kód törölve lett a bejelentkezési listából.");
  231. window.location.reload();
  232. return false;
  233. }
  234.  
  235. alert("A(z) " + itemToDelete + " felhasználó törölve lett a bejelentkezési listából.");
  236. window.location.reload();
  237. return false;
  238. }
  239.  
  240. $("#user").val(users[$(this).get(0).selectedIndex]);
  241. $("#pwd").val(npu.decodeBase64(npu.getChild(npu.data, ["users", npu.domain, users[$(this).get(0).selectedIndex], "password"])));
  242. });
  243.  
  244. $("input[type=button].login_button").attr("onclick", "").bind("click", function(e) {
  245. e.preventDefault();
  246.  
  247. if($("#user_sel").val() == "__OTHER__") {
  248. if($("#user").val().trim() == "" || $("#pwd").val().trim() == "") {
  249. return;
  250. }
  251.  
  252. var foundID = -1;
  253. for(var i = 0; i < users.length; i++) {
  254. if(users[i] == $("#user").val().toUpperCase()) {
  255. foundID = i;
  256. }
  257. }
  258.  
  259. if(foundID == -1) {
  260. 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?")) {
  261. npu.setChild(npu.data, ["users", npu.domain, $("#user").val().toUpperCase(), "password"], npu.encodeBase64($("#pwd").val()));
  262. npu.saveData();
  263. }
  264. npu.submitLogin();
  265. return;
  266. }
  267. else {
  268. $("#user_sel").val(users[foundID]);
  269. }
  270. }
  271.  
  272. if($("#user_sel").val() == "__DELETE__") {
  273. return;
  274. }
  275.  
  276. if($("#pwd").val() != npu.decodeBase64(npu.getChild(npu.data, ["users", npu.domain, users[$("#user_sel").get(0).selectedIndex], "password"]))) {
  277. if(confirm("Szeretnéd megváltoztatni a(z) " + $("#user").val().toUpperCase() + " felhasználó tárolt jelszavát a most beírt jelszóra?")) {
  278. npu.setChild(npu.data, ["users", npu.domain, users[$("#user_sel").get(0).selectedIndex], "password"], npu.encodeBase64($("#pwd").val()));
  279. npu.saveData();
  280. }
  281. }
  282.  
  283. npu.submitLogin();
  284. return;
  285. });
  286.  
  287. $("#user").parent().append(selectField);
  288. npu.showSelect();
  289. selectField.trigger("change");
  290. },
  291.  
  292. /* Initialize auto login and start countdown */
  293. initAutoLogin: function() {
  294. var users = npu.getLoginUsers();
  295.  
  296. if(users.length < 1) {
  297. return;
  298. }
  299.  
  300. var submit = $("#Submit, #btnSubmit");
  301.  
  302. npu.loginCount = 3;
  303. npu.loginButton = submit.attr("value");
  304. submit.attr("value", npu.loginButton + " (" + npu.loginCount + ")");
  305.  
  306. $(".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>');
  307. $(".login_button_td a.abort_login").click(function(e) {
  308. e.preventDefault();
  309. npu.abortLogin();
  310. });
  311.  
  312. npu.loginTimer = window.setInterval(function() {
  313. npu.loginCount--;
  314. submit.attr("value", npu.loginButton + " (" + npu.loginCount + ")");
  315.  
  316. if(npu.loginCount <= 0) {
  317. npu.submitLogin();
  318. npu.abortLogin();
  319. submit.attr("value", npu.loginButton + "...");
  320. }
  321. }, 1000);
  322. },
  323.  
  324. /* Abort the auto login countdown */
  325. abortLogin: function() {
  326. window.clearInterval(npu.loginTimer);
  327. $("#Submit, #btnSubmit").attr("value", npu.loginButton);
  328. $("#abortLogin").remove();
  329. },
  330.  
  331. /* Clears the login form */
  332. clearLogin: function() {
  333. $("#user").val("");
  334. $("#pwd").val("");
  335. },
  336.  
  337. /* Display user select field */
  338. showSelect: function() {
  339. $("#user").hide();
  340. $("#user_sel").show().focus();
  341. npu.runEval(' Page_Validators[0].controltovalidate = "user_sel" ');
  342. },
  343.  
  344. /* Hide user select field and display original textbox */
  345. hideSelect: function() {
  346. $("#user_sel").hide();
  347. $("#user").show().focus();
  348. npu.runEval(' Page_Validators[0].controltovalidate = "user" ');
  349. },
  350.  
  351. /* Submit the login form */
  352. submitLogin: function() {
  353. unsafeWindow.docheck();
  354. },
  355.  
  356. /* Reconfigure server full wait dialog parameters */
  357. fixWaitDialog: function() {
  358. unsafeWindow.maxtrynumber = 1e6;
  359. /* Export the patched starttimer function into the security context of the page in order to avoid an "access denied" error on Firefox. Details: https://blog.mozilla.org/addons/2014/04/10/changes-to-unsafewindow-for-the-add-on-sdk */
  360. var timerFunction = function() {
  361. unsafeWindow.login_wait_timer = unsafeWindow.setInterval(unsafeWindow.docheck, 5000);
  362. };
  363. exportFunction(timerFunction, unsafeWindow, {defineAs: "npu_starttimer"});
  364. unsafeWindow.starttimer = unsafeWindow.npu_starttimer;
  365. },
  366.  
  367. /* == MAIN == */
  368.  
  369. /* Hide page header to save vertical space */
  370. hideHeader: function() {
  371. $("#panHeader, #panCloseHeader").hide();
  372. $("table.top_menu_wrapper").css("margin-top", "5px").css("margin-bottom", "8px");
  373. $("#form1 > fieldset").css("border", "0 none");
  374. $("#span_changeproject").parent().hide();
  375. },
  376.  
  377. /* Add current page name to the window title */
  378. fixTitle: function() {
  379. var originalTitle = document.title;
  380. window.setInterval(function() {
  381. var pageTitle = $("#menucaption").text().toString();
  382. if (document.title == originalTitle) {
  383. document.title = (pageTitle == "" ? "" : pageTitle + " - ") + originalTitle;
  384. }
  385. }, 1000);
  386. },
  387.  
  388. /* Fix opening in new tab and add shortcuts */
  389. fixMenu: function() {
  390. var color = $("#lbtnQuit").css("color");
  391.  
  392. $(
  393. '<style type="text/css"> ' +
  394. 'ul.menubar, ' +
  395. '.top_menu_wrapper ' +
  396. '{ ' +
  397. 'cursor: default !important; ' +
  398. '} ' +
  399. '#mb1 li.menu-parent ' +
  400. '{ ' +
  401. 'color: #525659 !important; ' +
  402. '} ' +
  403. '#mb1 li.menu-parent.has-target ' +
  404. '{ ' +
  405. 'color: ' + color + ' !important; ' +
  406. '} ' +
  407. '#mb1 li.menu-parent.has-target:hover ' +
  408. '{ ' +
  409. 'color: #000 !important; ' +
  410. '} ' +
  411. '</style>'
  412. ).appendTo("head");
  413.  
  414. $("#mb1_Tanulmanyok").attr("targeturl", "main.aspx?ctrl=0206&ismenuclick=true").attr("hoverid", "#mb1_Tanulmanyok_Leckekonyv");
  415. $("#mb1_Targyak").attr("targeturl", "main.aspx?ctrl=0303&ismenuclick=true").attr("hoverid", "#mb1_Targyak_Targyfelvetel");
  416. $("#mb1_Vizsgak").attr("targeturl", "main.aspx?ctrl=0401&ismenuclick=true").attr("hoverid", "#mb1_Vizsgak_Vizsgajelentkezes");
  417.  
  418. var orarend = $('<li aria-haspopup="false" tabindex="0" role="menuitem" class="menu-parent has-target" id="mb1_Orarend" targeturl="main.aspx?ctrl=0203&amp;ismenuclick=true">Órarend</li>');
  419. $("#mb1_Targyak").before(orarend);
  420. $("#mb1_Tanulmanyok_Órarend").remove();
  421.  
  422. if(!$("#upChooser_chooser_kollab").hasClass("KollabChooserSelected")) {
  423. $('<li aria-haspopup="false" tabindex="0" role="menuitem" class="menu-parent has-target" id="mb1_MeetStreet" targeturl="javascript:__doPostBack(\'upChooser$btnKollab\',\'\')">Meet Street</li>').appendTo("#mb1");
  424. }
  425. if(!$("#upChooser_chooser_neptun").hasClass("NeptunChooserSelected")) {
  426. $('<li aria-haspopup="false" tabindex="0" role="menuitem" class="menu-parent has-target" id="mb1_TanulmanyiRendszer" targeturl="javascript:__doPostBack(\'upChooser$btnNeptun\',\'\')">Neptun</li>').appendTo("#mb1");
  427. }
  428.  
  429. $("#mb1 li[targeturl]").css("position", "relative").each(function() {
  430. $(this).addClass("has-target");
  431. var a = $('<a href="' + $(this).attr("targeturl") + '" style="display: block; position: absolute; left: 0; top: 0; width: 100%; height: 100%"></a>');
  432. a.click(function(e) {
  433. $("ul.menu").css("visibility", "hidden");
  434. e.stopPropagation();
  435. });
  436. var hoverid = $(this).attr("hoverid");
  437. if(hoverid) {
  438. a.hover(function() { $(hoverid).addClass("menu-hover"); }, function() { $(hoverid).removeClass("menu-hover"); });
  439. }
  440. $(this).append(a);
  441. });
  442. },
  443.  
  444. /* Replace term drop-down list with buttons */
  445. fixTermSelect: function() {
  446. $(
  447. '<style type="text/css"> ' +
  448. '.termSelect ' +
  449. '{ ' +
  450. 'list-style: none; ' +
  451. 'padding: 0; ' +
  452. '} ' +
  453. '.termSelect li ' +
  454. '{ ' +
  455. 'display: inline-block; ' +
  456. '*display: inline; ' +
  457. 'vertical-align: middle; ' +
  458. 'margin: 0 15px 0 0; ' +
  459. 'line-height: 250%; ' +
  460. '} ' +
  461. '.termSelect li a ' +
  462. '{ ' +
  463. 'padding: 5px; ' +
  464. '} ' +
  465. '.termSelect li a.button ' +
  466. '{ ' +
  467. 'color: #FFF; ' +
  468. 'box-shadow: none; ' +
  469. 'text-decoration: none; ' +
  470. 'cursor: default; ' +
  471. '} ' +
  472. '</style>'
  473. ).appendTo("head");
  474.  
  475. var findTermSelect = function() {
  476. return $("#upFilter_cmbTerms, #upFilter_cmb_m_cmb, #cmbTermsNormal, #upFilter_cmbTerms_m_cmb, #cmb_cmb, #c_common_timetable_cmbTermsNormal, #cmbTerms_cmb").first();
  477. };
  478. var clickExecuteButton = function() {
  479. if(["0303", "h_addsubjects", "0401", "h_exams", "0503", "h_transactionlist", "1406", "h_grading_request"].indexOf(npu.getPage()) != -1) {
  480. return;
  481. }
  482. npu.runEval(function() {
  483. $("#upFilter_expandedsearchbutton").click();
  484. });
  485. };
  486. var selectTerm = function(term) {
  487. var termSelect = findTermSelect(), el = $(".termSelect a[data-value=" + term + "]");
  488. if(el.size() == 0 || el.hasClass("button")) {
  489. return false;
  490. }
  491. termSelect.val(el.attr("data-value"));
  492. $(".termSelect .button").removeClass("button");
  493. el.addClass("button");
  494. var onChange = termSelect[0].getAttributeNode("onchange");
  495. if(onChange) {
  496. npu.runAsync(function() { npu.runEval(onChange.value); });
  497. }
  498. return true;
  499. };
  500.  
  501. window.setInterval(function() {
  502. var termSelect = findTermSelect();
  503. if(termSelect.is(":disabled")) {
  504. return;
  505. }
  506. if(termSelect.is(":visible")) {
  507. $(".termSelect").remove();
  508. var select = $('<ul class="termSelect"></ul>');
  509. var stored = npu.getUserData(null, null, ["termSelect", npu.getPage()]);
  510. var found = false;
  511. var match = $("#lblTrainingName").text().match(/:(\d{4}\/\d{2}\/\d)\[.*?\]\)/);
  512. var admissionSemester = match && String(match[1]);
  513.  
  514. $("option", termSelect).each(function() {
  515. if($(this).attr("value") == "-1") { return; }
  516. if(admissionSemester && $(this).text() < admissionSemester) { return; }
  517. var item = $('<li><a href="#" data-value="' + $(this).attr("value") + '" class="' + (termSelect.val() == $(this).attr("value") ? "button" : "") + '">' + $(this).html() + "</a></li>");
  518. if(typeof stored != "undefined" && $(this).attr("value") == stored) {
  519. found = true;
  520. }
  521. $("a", item).bind("click", function(e) {
  522. e.preventDefault();
  523. var term = $(this).attr("data-value");
  524. if(selectTerm(term)) {
  525. if(stored != term) {
  526. stored = term;
  527. npu.setUserData(null, null, ["termSelect", npu.getPage()], term);
  528. npu.saveData();
  529. }
  530. clickExecuteButton();
  531. }
  532. });
  533. select.append(item);
  534. });
  535. termSelect.parent().append(select);
  536. termSelect.hide();
  537. if(!termSelect.data("initialized")) {
  538. termSelect.data("initialized", true);
  539. if(found && termSelect.val() != stored) {
  540. selectTerm(stored);
  541. clickExecuteButton();
  542. }
  543. else if($(".grid_pagertable").size() == 0) {
  544. clickExecuteButton();
  545. }
  546. }
  547. }
  548. }, 500);
  549. },
  550.  
  551. /* Set all paginators to 500 items per page */
  552. fixPagination: function() {
  553. window.setInterval(function() {
  554. var pageSelect = $(".grid_pagerpanel select");
  555. pageSelect.each(function() {
  556. var e = $(this);
  557. e.hide();
  558. $(".link_pagesize", e.closest("tr")).html("");
  559. if(e.attr("data-listing") != "1" && e.val() != "500") {
  560. e.attr("data-listing", "1").val("500");
  561. var onChange = this.getAttributeNode("onchange");
  562. if(onChange) {
  563. npu.runEval(onChange.value);
  564. }
  565. }
  566. });
  567. }, 100);
  568. },
  569.  
  570. /* Allow user to dismiss the 'you have an official message' popup */
  571. fixOfficialMessagePopup: function() {
  572. var dismiss = function() {
  573. $("[aria-describedby=upRequiredMessageReader_upmodal_RequiredMessageReader_divpopup] .ui-dialog-content").dialog("close");
  574. };
  575.  
  576. window.setInterval(function() {
  577. var messagePopup = $("#upRequiredMessageReader_upmodal_RequiredMessageReader_divpopup:visible").closest(".ui-dialog");
  578. if(messagePopup.size() > 0 && $("#upFunction_c_messages_upMain_upGrid").size() === 0) {
  579. npu.runEval(dismiss);
  580. }
  581. if(messagePopup.size() > 0 && messagePopup.is(":not([data-npu-enhanced])")) {
  582. messagePopup.attr("data-npu-enhanced", "true");
  583. $("input[commandname=Tovabb]", messagePopup).val("Elolvasom");
  584. var dismissBtn = $('<input value="Most nem érdekel" class="npu_dismiss ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" type="button">');
  585. dismissBtn.click(function() {
  586. npu.runEval(dismiss);
  587. });
  588. $(".ui-dialog-footerbar > div", messagePopup).append(dismissBtn);
  589. }
  590. }, 200);
  591. },
  592.  
  593. /* Hide countdown and send requests to the server to keep the session alive */
  594. initKeepSession: function() {
  595. var cdt = $("#hfCountDownTime");
  596. var timeout = 120;
  597. if(cdt.size() > 0) {
  598. var cdto = parseInt(cdt.val());
  599. if(cdto > 60) {
  600. timeout = cdto;
  601. }
  602. }
  603. var keepAlive = function() {
  604. window.setTimeout(function() {
  605. $.ajax({
  606. url: "main.aspx"
  607. });
  608. keepAlive();
  609. }, timeout * 1000 - 30000 - Math.floor(Math.random() * 30000));
  610. };
  611. keepAlive();
  612.  
  613. window.setInterval(function() {
  614. npu.runEval(function() {
  615. ShowModal = function() { };
  616. clearTimeout(timerID);
  617. clearTimeout(timerID2);
  618. sessionEndDate = null;
  619. });
  620. if($("#npuStatus").size() == 0) {
  621. $("#upTraining_lblRemainingTime").html('<span id="npuStatus" style="font-weight: normal"><a href="https://npu.herokuapp.com" target="_blank">Neptun PowerUp!</a> v' + GM_info["script"]["version"] + '</span>');
  622. }
  623. }, 1000);
  624. },
  625.  
  626. /* Use custom loading indicator for async requests */
  627. initProgressIndicator: function() {
  628. var color = $("#lbtnQuit").css("color");
  629. $(
  630. '<style type="text/css"> ' +
  631. '#npu_loading ' +
  632. '{ ' +
  633. 'position: fixed; ' +
  634. 'width: 150px; ' +
  635. 'margin-left: -75px; ' +
  636. 'left: 50%; ' +
  637. 'top: 0; ' +
  638. 'background: ' + color + '; ' +
  639. 'color: white; ' +
  640. 'font-size: 1.2em; ' +
  641. 'font-weight: bold; ' +
  642. 'padding: 8px 10px; ' +
  643. 'text-align: center; ' +
  644. 'z-index: 1000; ' +
  645. 'display: none; ' +
  646. '-webkit-border-bottom-right-radius: 5px; ' +
  647. '-webkit-border-bottom-left-radius: 5px; ' +
  648. '-moz-border-radius-bottomright: 5px; ' +
  649. '-moz-border-radius-bottomleft: 5px; ' +
  650. 'border-bottom-right-radius: 5px; ' +
  651. 'border-bottom-left-radius: 5px; ' +
  652. '-webkit-box-shadow: 0px 0px 3px 0px black; ' +
  653. '-moz-box-shadow: 0px 0px 3px 0px black; ' +
  654. 'box-shadow: 0px 0px 3px 0px black; ' +
  655. '} ' +
  656. '</style>'
  657. ).appendTo("head");
  658.  
  659. $("#progress, #customtextprogress").css("visibility", "hidden");
  660. $('<div id="npu_loading">Kis türelmet...</div>').appendTo("body");
  661.  
  662. npu.runEval(function() {
  663. var manager = Sys.WebForms.PageRequestManager.getInstance();
  664. manager.add_beginRequest(function(a, b) {
  665. $("#npu_loading").show();
  666. });
  667. manager.add_endRequest(function() {
  668. $("#npu_loading").hide();
  669. });
  670. });
  671. },
  672.  
  673. /* == TIMETABLE == */
  674.  
  675. /* Enhance timetable functionality */
  676. fixTimetable: function() {
  677. window.setInterval(function() {
  678. if($("#gridcontainer").attr("data-bound") != "1") {
  679. npu.runEval(function() {
  680. var options = $("#gridcontainer").BcalGetOp();
  681. if(typeof options != "undefined" && options != null) {
  682. $("#gridcontainer").attr("data-bound", "1");
  683. var callback = options.onAfterRequestData;
  684. options.onAfterRequestData = function(n) {
  685. if($("#gridcontainer").attr("data-called") != "1") {
  686. $("#gridcontainer").attr("data-called", "1");
  687. $("#upFunction_c_common_timetable_upTimeTable .showtoday").trigger("click");
  688. }
  689. callback(n);
  690. }
  691. }
  692. });
  693. }
  694. }, 100);
  695. },
  696.  
  697. /* == MARK LIST == */
  698.  
  699. /* Enhance mark list style */
  700. fixMarkList: function() {
  701. $(
  702. '<style type="text/css"> ' +
  703. '#h_markbook_gridIndexEntry_bodytable tr.SubjectCompletedRow td ' +
  704. '{ ' +
  705. 'background-color: #D5EFBA !important; ' +
  706. '} ' +
  707. '</style>'
  708. ).appendTo("head");
  709. },
  710.  
  711. /* == PROGRESS LIST == */
  712.  
  713. /* Enhance progress list style */
  714. fixProgressList: function() {
  715. $(
  716. '<style type="text/css"> ' +
  717. '#h_advance_gridSubjects_bodytable tr:not(.gridrow_blue):not(.gridrow_green) td, ' +
  718. '#h_advance_NonCurrTemp_bodytable tr:not(.gridrow_blue):not(.gridrow_green) td ' +
  719. '{ ' +
  720. 'background-color: #F8EFB1 !important; ' +
  721. 'font-weight: bold; ' +
  722. 'color: #525659; ' +
  723. '} ' +
  724. '#h_advance_gridSubjects_bodytable tr.gridrow_green td, ' +
  725. '#h_advance_NonCurrTemp_bodytable tr.gridrow_green td ' +
  726. '{ ' +
  727. 'background-color: #D5EFBA !important; ' +
  728. 'font-weight: bold; ' +
  729. 'color: #525659; ' +
  730. '} ' +
  731. '#h_advance_gridSubjects_bodytable tr.gridrow_blue td, ' +
  732. '#h_advance_NonCurrTemp_bodytable tr.gridrow_blue td ' +
  733. '{ ' +
  734. 'background-color: none !important; ' +
  735. 'color: #525659; ' +
  736. '} ' +
  737. '</style>'
  738. ).appendTo("head");
  739. },
  740.  
  741. /* == COURSE LIST == */
  742.  
  743. /* Enhance course list style and functionality */
  744. fixCourseList: function() {
  745. $(
  746. '<style type="text/css"> ' +
  747. '#h_addsubjects_gridSubjects_bodytable tr.Row1_Bold td, ' +
  748. '#Addsubject_course1_gridCourses_bodytable tr.Row1_sel td, ' +
  749. '#Addsubject_course1_gridCourses_grid_body_div tr.Row1_sel td, ' +
  750. '#Addsubject_course1_gridCourses_bodytable tr.Row1_Bold_sel td, ' +
  751. '#Addsubject_course1_gridCourses_grid_body_div tr.Row1_Bold_sel td, ' +
  752. '#h_addsubjects_gridSubjects_bodytable tr.context_selectedrow td ' +
  753. '{ ' +
  754. 'background-color: #F8EFB1 !important; ' +
  755. 'font-weight: bold; color: #525659; ' +
  756. '} ' +
  757. '#h_addsubjects_gridSubjects_bodytable tr, ' +
  758. '#Addsubject_course1_gridCourses_bodytable tr, ' +
  759. '#Addsubject_course1_gridCourses_grid_body_div tr ' +
  760. '{ ' +
  761. 'cursor: pointer; ' +
  762. '} ' +
  763. '#h_addsubjects_gridSubjects_bodytable tr.npu_completed td, ' +
  764. '#h_addsubjects_gridSubjects_bodytable tr.context_selectedrow[data-completed] td ' +
  765. '{ ' +
  766. 'background-color: #D5EFBA !important; ' +
  767. 'font-weight: bold; ' +
  768. 'color: #525659; ' +
  769. '} ' +
  770. '#h_addsubjects_gridSubjects_bodytable tr.context_selectedrow ' +
  771. '{ ' +
  772. 'border: 0 none !important; ' +
  773. 'border-bottom: 1px solid #D3D3D3 !important; ' +
  774. '} ' +
  775. '</style>'
  776. ).appendTo("head");
  777.  
  778. $("body").on("click", "#Addsubject_course1_gridCourses_bodytable tbody td, #Addsubject_course1_gridCourses_grid_body_div tbody td", function(e) {
  779. if($(e.target).closest("input[type=checkbox]").size() == 0 && $(e.target).closest("td[onclick]").size() == 0) {
  780. var checkbox = $("input[type=checkbox]", $(this).closest("tr")).get(0);
  781. checkbox.checked = !checkbox.checked;
  782. npu.getAjaxInstance(this) &&
  783. npu.getAjaxInstance(this).Cv($("input[type=checkbox]", $(this).closest("tr")).get(0), "1");
  784. e.preventDefault();
  785. return false;
  786. }
  787. });
  788.  
  789. $("body").on("click", "#h_addsubjects_gridSubjects_bodytable tbody td", function(e) {
  790. if($(e.target).closest("td[onclick], span.link").size() == 0 && $(e.target).closest("td.contextcell_sel, td.contextcell").size() == 0) {
  791. npu.runEval($("td span.link", $(this).closest("tr")).attr("onclick"));
  792. e.preventDefault();
  793. return false;
  794. }
  795. });
  796.  
  797. window.setInterval(function() {
  798. var table = $("#h_addsubjects_gridSubjects_bodytable");
  799. if(table.attr("data-painted") != "1") {
  800. table.attr("data-painted", "1");
  801. $("tbody tr", table).each(function() {
  802. if($('td[n="Completed"] img', this).size() != 0) {
  803. $(this).addClass("npu_completed").attr("data-completed", "1");
  804. }
  805. });
  806. }
  807. }, 250);
  808. },
  809.  
  810. /* Automatically press submit button on course list page */
  811. initCourseAutoList: function() {
  812. npu.runEval(function() {
  813. var manager = Sys.WebForms.PageRequestManager.getInstance();
  814. var courseListLoading = false;
  815. manager.add_beginRequest(function() {
  816. courseListLoading = true;
  817. });
  818. manager.add_endRequest(function() {
  819. courseListLoading = false;
  820. });
  821. window.setInterval(function() {
  822. if(!courseListLoading && $("#h_addsubjects_gridSubjects_gridmaindiv").size() == 0) {
  823. $("#upFilter_expandedsearchbutton").click();
  824. }
  825. }, 250);
  826. });
  827.  
  828. var updateTable = function() {
  829. $("#upFunction_h_addsubjects_upGrid").html("");
  830. };
  831.  
  832. $("body").on("change", "#upFilter_chkFilterCourses", updateTable);
  833. $("body").on("change", "#upFilter_rbtnSubjectType input[type=radio]", updateTable);
  834. },
  835.  
  836. /* Initialize course choice storage and mark subject and course lines with stored course choices */
  837. initCourseStore: function() {
  838. $(
  839. '<style type="text/css"> ' +
  840. '#h_addsubjects_gridSubjects_bodytable tr td.npu_choice_mark, ' +
  841. '#Addsubject_course1_gridCourses_bodytable tr td.npu_choice_mark, ' +
  842. '#Addsubject_course1_gridCourses_grid_body_div tr td.npu_choice_mark ' +
  843. '{ ' +
  844. 'background: #C00 !important; ' +
  845. '} ' +
  846. '</style>'
  847. ).appendTo("head");
  848.  
  849. var loadCourses = function() {
  850. courses = { };
  851. $.extend(courses, npu.getUserData(null, null, ["courses", "_legacy"]));
  852. $.extend(courses, npu.getUserData(null, null, ["courses", npu.training]));
  853. };
  854.  
  855. var refreshScreen = function() {
  856. $("#h_addsubjects_gridSubjects_bodytable").attr("data-choices-displayed", "0");
  857. $("#Addsubject_course1_gridCourses_bodytable").attr("data-inner-choices-displayed", "0");
  858. $("#Addsubject_course1_gridCourses_grid_body_div").attr("data-inner-choices-displayed", "0");
  859. };
  860.  
  861. var courses = null;
  862. loadCourses();
  863.  
  864. window.setInterval(function() {
  865. var table = $("#h_addsubjects_gridSubjects_bodytable");
  866. if(table.size() > 0 && table.attr("data-choices-displayed") != "1") {
  867. table.attr("data-choices-displayed", "1");
  868. var filterEnabled = npu.getUserData(null, null, "filterCourses");
  869. $("tbody tr", table).each(function() {
  870. var subjectCode = $("td:nth-child(3)", this).text().trim().toUpperCase();
  871. var choices = courses[subjectCode.trim().toUpperCase()];
  872. if(typeof choices != "undefined" && choices != null && choices.length > 0) {
  873. $("td:first-child", this).addClass("npu_choice_mark");
  874. $(this).css("display", "table-row");
  875. }
  876. else {
  877. $("td:first-child", this).removeClass("npu_choice_mark");
  878. $(this).css("display", filterEnabled ? "none" : "table-row");
  879. }
  880. });
  881.  
  882. if($("#h_addsubjects_gridSubjects_gridmaindiv .grid_pagertable .grid_pagerpanel").size() === 0) {
  883. $('<td class="grid_pagerpanel"><table align="right"><tbody><tr></tr></tbody></table></td>').
  884. insertBefore("#h_addsubjects_gridSubjects_gridmaindiv .grid_pagertable .grid_pagerrow_right");
  885. }
  886.  
  887. var pager = $("#h_addsubjects_gridSubjects_gridmaindiv .grid_pagertable .grid_pagerpanel table tr");
  888. if($("#npu_clear_courses").size() == 0) {
  889. var 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>');
  890. $("a", clearAll).click(function(e) {
  891. e.preventDefault();
  892. if(confirm(npu.user + " felhasználó összes tárolt kurzusa törölve lesz ezen a képzésen. Valóban ezt szeretnéd?")) {
  893. npu.setUserData(null, null, ["courses", npu.training], { });
  894. npu.setUserData(null, null, ["courses", "_legacy"], { });
  895. npu.setUserData(null, null, "filterCourses", false);
  896. npu.saveData();
  897. loadCourses();
  898. refreshScreen();
  899. }
  900. });
  901. pager.prepend(clearAll);
  902. }
  903. if($("#npu_filter_courses").size() == 0) {
  904. var 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>');
  905. $("input", filterCell).change(function(e) {
  906. npu.setUserData(null, null, "filterCourses", $(this).get(0).checked);
  907. npu.saveData();
  908. refreshScreen();
  909. });
  910. pager.prepend(filterCell);
  911. }
  912. $("#npu_filter_field").get(0).checked = filterEnabled;
  913. }
  914.  
  915. var innerTable = $("#Addsubject_course1_gridCourses_bodytable:visible, #Addsubject_course1_gridCourses_grid_body_div:visible").first();
  916. if(innerTable.size() > 0 && innerTable.attr("data-inner-choices-displayed") != "1") {
  917. innerTable.attr("data-inner-choices-displayed", "1");
  918. if($("th.headerWithCheckbox", innerTable).size() == 0) {
  919. var objName = npu.getAjaxInstanceId(this);
  920. $('<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></span></th>').appendTo("#Addsubject_course1_gridCourses_headerrow");
  921. $("tbody tr", innerTable).each(function() {
  922. $('<td t="chks" n="chk" class="aligncenter"><label class="hiddenforlabel" for="chk' + $(this).attr("id").substring(4) + '">' + $("td:nth-child(2)", this).text().trim() + '</label><input id="chk' + $(this).attr("id").substring(4) + '" aria-disabled="false" role="checkbox" onclick="' + objName + '.Cv(this,\'1\');" type="checkbox"></td>').appendTo(this);
  923. });
  924. }
  925. $("tbody tr", innerTable).each(function() {
  926. $("input[type=checkbox]", this).removeAttr("disabled");
  927. });
  928. var subjectText = $("#Subject_data_for_schedule_ctl00:visible > div > div > h2").html();
  929. if(subjectText != null) {
  930. var part = subjectText.split("<br>")[0];
  931. subjectCode = npu.parseSubjectCode(part);
  932. if(subjectCode) {
  933. var choices = courses[subjectCode.trim().toUpperCase()];
  934. var hasChoices = (typeof choices != "undefined" && choices != null && choices.length > 0);
  935. if(hasChoices) {
  936. $("tbody tr", innerTable).each(function() {
  937. var courseCode = $("td:nth-child(2)", this).text().trim().toUpperCase();
  938. if($.inArray(courseCode, choices) != -1) {
  939. $("td:first-child", this).addClass("npu_choice_mark");
  940. }
  941. else {
  942. $("td:first-child", this).removeClass("npu_choice_mark");
  943. }
  944. });
  945. }
  946. else {
  947. $("tbody tr td:first-child", innerTable).removeClass("npu_choice_mark");
  948. }
  949. if($(".npu_course_choice_actions").size() == 0) {
  950. var header = $("#Addsubject_course1_gridCourses_gridmaindiv .grid_functiontable_top .functionitem");
  951. var footer = $("#Addsubject_course1_gridCourses_tablebottom .grid_functiontable_bottom .functionitem");
  952. var canSave = header.size() > 0;
  953. if(header.size() == 0) {
  954. $('<table class="grid_functiontable_top" align="left"><tbody><tr><td class="functionitem" nowrap=""></td></tr></tbody></table>').appendTo("#Addsubject_course1_gridCourses_gridmaindiv .grid_topfunctionpanel");
  955. header = $(header.selector);
  956. }
  957. if(footer.size() == 0) {
  958. $('<table class="grid_functiontable_bottom" align="right"><tbody><tr><td class="functionitem" nowrap=""></td></tr></tbody></table>').appendTo("#Addsubject_course1_gridCourses_tablebottom .grid_bottomfunctionpanel");
  959. footer = $(footer.selector);
  960. }
  961. var buttonBarExtensions = $('<span class="npu_course_choice_actions" style="margin: 0 20px"><span class="FunctionCommandTitle">Tárolt kurzusok:</span><input type="button" value="Tárolás" class="gridbutton npu_course_choice_save"><input type="button" value="Betöltés" class="gridbutton npu_course_choice_load" style="display: none">' + (canSave ? '<input type="button" value="Betöltés és Mentés" class="gridbutton npu_course_choice_apply" style="display: none">' : "") + '<input type="button" value="Törlés" class="gridbutton npu_course_choice_delete" style="display: none"></span>');
  962. header.append(buttonBarExtensions);
  963. footer.prepend(buttonBarExtensions.clone());
  964. $(".npu_course_choice_actions .npu_course_choice_save").click(function() {
  965. var selectedCourses = [];
  966. $("tbody tr", innerTable).each(function() {
  967. var courseCode = $("td:nth-child(2)", this).text().trim().toUpperCase();
  968. var checkbox = $("input[type=checkbox]", this).get(0);
  969. if(checkbox.checked) {
  970. selectedCourses.push(courseCode);
  971. }
  972. });
  973. if(selectedCourses.length == 0) {
  974. alert("A tároláshoz előbb válaszd ki a tárolandó kurzusokat.");
  975. }
  976. else {
  977. npu.setUserData(null, null, ["courses", npu.training, subjectCode.trim().toUpperCase()], selectedCourses);
  978. npu.saveData();
  979. loadCourses();
  980. refreshScreen();
  981. }
  982. });
  983. $(".npu_course_choice_actions .npu_course_choice_load").click(function() {
  984. $("tbody tr", innerTable).each(function() {
  985. var courseCode = $("td:nth-child(2)", this).text().trim().toUpperCase();
  986. var checkbox = $("input[type=checkbox]", this).get(0);
  987. checkbox.checked = $.inArray(courseCode, courses[subjectCode.trim().toUpperCase()]) != -1;
  988. npu.getAjaxInstance(this) && npu.getAjaxInstance(this).Cv(checkbox, "1");
  989. });
  990. });
  991. $(".npu_course_choice_actions .npu_course_choice_apply").click(function() {
  992. npu.runEval(function() {
  993. $(".npu_course_choice_actions .npu_course_choice_load").trigger("click");
  994. });
  995. npu.getAjaxInstance(this) && npu.getAjaxInstance(this).SelectFunction("update");
  996. });
  997. $(".npu_course_choice_actions .npu_course_choice_delete").click(function() {
  998. if(confirm("Valóban törölni szeretnéd a tárolt kurzusokat?")) {
  999. npu.setUserData(null, null, ["courses", npu.training, subjectCode.trim().toUpperCase()], null);
  1000. npu.setUserData(null, null, ["courses", "_legacy", subjectCode.trim().toUpperCase()], null);
  1001. npu.saveData();
  1002. loadCourses();
  1003. refreshScreen();
  1004. }
  1005. });
  1006. }
  1007. $(".npu_course_choice_load, .npu_course_choice_apply, .npu_course_choice_delete", $(".npu_course_choice_actions")).css("display", hasChoices ? "inline" : "none");
  1008. }
  1009. }
  1010. }
  1011. }, 500);
  1012. },
  1013.  
  1014. /* == EXAM LIST == */
  1015.  
  1016. /* Decide whether the given grade string constitutes passing the exam */
  1017. isPassingGrade: function(gradeStr) {
  1018. return ["Elégtelen", "Nem felelt meg", "Nem jelent meg", "Fail", "Did not attend"].indexOf(gradeStr) == -1;
  1019. },
  1020.  
  1021. /* Enhance exam list style and functionality */
  1022. fixExamList: function() {
  1023. $(
  1024. '<style type="text/css"> ' +
  1025. '#h_exams_gridExamList_bodytable tr.gridrow_blue td ' +
  1026. '{ ' +
  1027. 'background: #F8EFB1 !important; ' +
  1028. 'font-weight: bold; ' +
  1029. 'color: #525659 !important; ' +
  1030. '} ' +
  1031. '#h_exams_gridExamList_bodytable tr.npu_completed td ' +
  1032. '{ ' +
  1033. 'background-color: #D5EFBA !important; ' +
  1034. '} ' +
  1035. '#h_exams_gridExamList_bodytable tr.npu_failed td ' +
  1036. '{ ' +
  1037. 'background-color: #F2A49F !important; ' +
  1038. 'color: #3A3C3E !important; ' +
  1039. '} ' +
  1040. '#h_exams_gridExamList_bodytable tr.npu_hidden ' +
  1041. '{ ' +
  1042. 'display: none; ' +
  1043. '} ' +
  1044. '#h_exams_gridExamList_bodytable tr ' +
  1045. '{ ' +
  1046. 'cursor: pointer; ' +
  1047. '} ' +
  1048. '#upFilter_cmbSubjects option[value="0"] ' +
  1049. '{ ' +
  1050. 'font-size: 13px; ' +
  1051. 'font-weight: bold; ' +
  1052. 'text-decoration: underline; ' +
  1053. '} ' +
  1054. '#upFilter_cmbSubjects option.npu_hidden ' +
  1055. '{ ' +
  1056. 'display: none; ' +
  1057. '} ' +
  1058. '#upFilter_cmbSubjects option.npu_subscribed ' +
  1059. '{ ' +
  1060. 'background-color: #F8EFB1 !important; ' +
  1061. 'font-weight: bold; ' +
  1062. '} ' +
  1063. '#upFilter_cmbSubjects option.npu_completed ' +
  1064. '{ ' +
  1065. 'background-color: #D5EFBA !important; ' +
  1066. '} ' +
  1067. '#upFilter_cmbSubjects option.npu_failed ' +
  1068. '{ ' +
  1069. 'background-color: #F2A49F !important; ' +
  1070. 'color: #3A3C3E !important; ' +
  1071. '} ' +
  1072. '</style>'
  1073. ).appendTo("head");
  1074.  
  1075. $("body").on("click", "#h_exams_gridExamList_bodytable tbody td", function(e) {
  1076. if($(e.target).closest("td[onclick], td.contextcell_sel, td.contextcell").size() == 0) {
  1077. npu.runEval(function() {
  1078. $("td.contextcell, td.contextcell_sel", $(this).closest("tr")).trigger("click");
  1079. });
  1080. e.preventDefault();
  1081. return false;
  1082. }
  1083. });
  1084.  
  1085. window.setInterval(function() {
  1086. var table = $("#h_exams_gridExamList_bodytable");
  1087. var filterEnabled = npu.getUserData(null, null, "filterExams");
  1088.  
  1089. if(table.attr("data-processed") != "1") {
  1090. table.attr("data-processed", "1");
  1091.  
  1092. $("tbody tr[id*=tr__]", table).each(function() {
  1093. var row = $(this);
  1094. var courseCode = $("td:nth-child(3)", row).clone().children().remove().end().text();
  1095. var rowId = row.attr("id").replace(/^tr__/, "");
  1096. var subRow = $("#trs__" + rowId, row.closest("tbody"));
  1097. var markRows = $(".subtable > tbody > tr", subRow);
  1098. var subscribed = row.hasClass("gridrow_blue");
  1099. var classToBeAdded = null;
  1100. row.add(markRows).removeClass("npu_completed npu_failed").removeAttr("data-completed");
  1101.  
  1102. markRows.each(function() {
  1103. var mark = $("td:nth-child(4)", this).text().trim();
  1104. $(this).addClass(npu.isPassingGrade(mark) ? "npu_completed" : "npu_failed");
  1105. });
  1106.  
  1107. if(markRows.size() > 0) {
  1108. var lastMark = markRows.last();
  1109. var mark = $("td:nth-child(4)", lastMark).text().trim();
  1110. var passed = npu.isPassingGrade(mark);
  1111. !subscribed && (classToBeAdded = passed ? "npu_completed" : "npu_failed");
  1112. if(passed) {
  1113. row.attr("data-completed", "1");
  1114. row.add(subRow)[filterEnabled ? "addClass" : "removeClass"]("npu_hidden");
  1115. }
  1116. }
  1117.  
  1118. classToBeAdded = classToBeAdded || (subscribed ? "npu_subscribed" : "npu_found");
  1119. row.addClass(classToBeAdded);
  1120.  
  1121. if(!$("#upFilter_cmbSubjects").val() || $("#upFilter_cmbSubjects").val() === "0") {
  1122. $.examSubjectFilterCache = $.examSubjectFilterCache || {};
  1123. $.examSubjectFilterCache[courseCode] = classToBeAdded;
  1124. }
  1125. });
  1126.  
  1127. if($.examSubjectFilterCache) {
  1128. $("#upFilter_cmbSubjects > option").each(function() {
  1129. $(this).removeClass("npu_hidden npu_completed npu_failed npu_subscribed npu_found");
  1130. var subjectCode = npu.parseSubjectCode($(this).text().trim());
  1131. var classToBeAdded = $.examSubjectFilterCache[subjectCode];
  1132. var filterEnabled = npu.getUserData(null, null, "filterExams");
  1133. subjectCode && $(this).addClass(classToBeAdded || "npu_hidden");
  1134. filterEnabled && classToBeAdded === "npu_completed" && $(this).addClass("npu_hidden");
  1135. });
  1136. }
  1137. }
  1138. }, 250);
  1139.  
  1140. var refreshScreen = function() {
  1141. $("#h_exams_gridExamList_bodytable").removeAttr("data-processed");
  1142. }
  1143.  
  1144. window.setInterval(function() {
  1145. var filterEnabled = npu.getUserData(null, null, "filterExams");
  1146. var pager = $("#h_exams_gridExamList_gridmaindiv .grid_pagertable .grid_pagerpanel table tr");
  1147. if($("#npu_filter_exams").size() == 0) {
  1148. var filterCell = $('<td id="npu_filter_exams" 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">Teljesített tárgyak elrejtése</label></td>');
  1149. $("input", filterCell).change(function(e) {
  1150. npu.setUserData(null, null, "filterExams", $(this).get(0).checked);
  1151. npu.saveData();
  1152. npu.runEval(function() {
  1153. $("#upFilter_expandedsearchbutton").click();
  1154. });
  1155. });
  1156. pager.prepend(filterCell);
  1157. }
  1158. $("#npu_filter_field").get(0).checked = filterEnabled;
  1159. }, 500);
  1160. },
  1161.  
  1162. /* Automatically list exams on page load and subject change */
  1163. initExamAutoList: function() {
  1164. $('<style type="text/css"> #upFilter_bodytable tr.nostyle { display: none } </style>').appendTo("head");
  1165. $("body").on("change", "#upFilter_cmbSubjects", function() {
  1166. $.examListSubjectValue = $(this).val();
  1167. });
  1168. window.setInterval(function() {
  1169. var panel = $("#upFilter_panFilter table.searchpanel");
  1170. var termChanged = $.examListTerm != $("#upFilter_cmbTerms option[selected]").attr("value");
  1171. var subjectChanged = $.examListSubject != $.examListSubjectValue;
  1172.  
  1173. if(panel.attr("data-listing") != "1" && (termChanged || subjectChanged)) {
  1174. panel.attr("data-listing", "1");
  1175. if(termChanged) {
  1176. $.examSubjectFilterCache = null;
  1177. }
  1178. $.examListTerm = $("#upFilter_cmbTerms option[selected]").attr("value");
  1179. $.examListSubject = $.examListSubjectValue;
  1180. npu.runEval(function() {
  1181. $("#upFilter_expandedsearchbutton").click();
  1182. });
  1183. }
  1184. }, 100);
  1185. },
  1186.  
  1187. /* == SIGNED EXAM LIST == */
  1188.  
  1189. /* Enhance signed exam list style and functionality */
  1190. fixSignedExamList: function() {
  1191. $(
  1192. '<style type="text/css"> ' +
  1193. '#h_signedexams_gridExamList_bodytable tr.npu_missed td ' +
  1194. '{ ' +
  1195. 'background: #F8EFB1 !important; ' +
  1196. 'color: #525659 !important; ' +
  1197. '} ' +
  1198. '#h_signedexams_gridExamList_bodytable tr.npu_completed td ' +
  1199. '{ ' +
  1200. 'background-color: #D5EFBA !important; ' +
  1201. '} ' +
  1202. '#h_signedexams_gridExamList_bodytable tr.npu_failed td ' +
  1203. '{ ' +
  1204. 'background-color: #F2A49F !important; ' +
  1205. 'color: #3A3C3E !important; ' +
  1206. '} ' +
  1207. '</style>'
  1208. ).appendTo("head");
  1209.  
  1210. window.setInterval(function() {
  1211. var table = $("#h_signedexams_gridExamList_bodytable");
  1212.  
  1213. if(table.attr("data-processed") != "1") {
  1214. table.attr("data-processed", "1");
  1215.  
  1216. $("tbody tr:not(.NoMatch)", table).each(function() {
  1217. var row = $(this);
  1218. row.removeClass("npu_completed npu_failed npu_missed");
  1219. var attended = $("td[n=Attended]", row)[0].attributes["checked"].value == "true";
  1220. var passed = npu.isPassingGrade($("td:nth-child(13)", row).text().trim());
  1221. row.addClass(attended ? (passed ? "npu_completed" : "npu_failed") : "npu_missed");
  1222. });
  1223. }
  1224. }, 250);
  1225. },
  1226.  
  1227. /* == STATISTICS == */
  1228.  
  1229. /* Statistics server URL */
  1230. statHost: "http://npu.herokuapp.com/stat",
  1231.  
  1232. /* Initialize statistics */
  1233. initStat: function() {
  1234. var code = npu.getUserData(null, null, ["statCode"]);
  1235. if(code == null) {
  1236. code = npu.generateToken();
  1237. npu.setUserData(null, null, ["statSalt"], null);
  1238. npu.setUserData(null, null, ["statCode"], code);
  1239. npu.saveData();
  1240. }
  1241. setTimeout(function() {
  1242. try {
  1243. var h = new npu.jsSHA(npu.user + ":" + code, "TEXT").getHash("SHA-256", "HEX");
  1244. GM_xmlhttpRequest({
  1245. method: "POST",
  1246. data: $.param({
  1247. version: GM_info["script"]["version"],
  1248. domain: npu.domain,
  1249. user: h.substring(0, 32),
  1250. uri: window.location.href
  1251. }),
  1252. headers: {
  1253. "Content-Type": "application/x-www-form-urlencoded"
  1254. },
  1255. synchronous: false,
  1256. timeout: 10000,
  1257. url: npu.statHost
  1258. });
  1259. }
  1260. catch(e) { }
  1261. }, 5000);
  1262. },
  1263.  
  1264. /* == MISC == */
  1265.  
  1266. /* Verify that we are indeed on a Neptun page */
  1267. isNeptunPage: function() {
  1268. return document.title.indexOf("Neptun.Net") != -1;
  1269. },
  1270.  
  1271. /* Initialize and cache parameters that do not change dynamically */
  1272. initParameters: function() {
  1273. npu.user = npu.getUser();
  1274. npu.domain = npu.getDomain();
  1275. npu.training = npu.getTraining();
  1276. },
  1277.  
  1278. /* Parses and returns the first-level domain of the site */
  1279. getDomain: function() {
  1280. var domain = "", host = location.host.split(".");
  1281. var tlds = ["at", "co", "com", "edu", "eu", "gov", "hu", "hr", "info", "int", "mil", "net", "org", "ro", "rs", "sk", "si", "ua", "uk"];
  1282. for(var i = host.length - 1; i >= 0; i--) {
  1283. domain = host[i] + "." + domain;
  1284. if($.inArray(host[i], tlds) == -1) {
  1285. return domain.substring(0, domain.length - 1);
  1286. }
  1287. }
  1288. },
  1289.  
  1290. /* Parses and returns the ID of the current user */
  1291. getUser: function() {
  1292. if($("#upTraining_topname").size() > 0) {
  1293. var input = $("#upTraining_topname").text();
  1294. return input.substring(input.indexOf(" - ") + 3).toUpperCase();
  1295. }
  1296. },
  1297.  
  1298. /* Parses and returns the sanitized name of the current training */
  1299. getTraining: function() {
  1300. if($("#lblTrainingName").size() > 0) {
  1301. return $("#lblTrainingName").text().replace(/[^a-zA-Z0-9]/g, "");
  1302. }
  1303. },
  1304.  
  1305. /* Returns whether we are on the login page */
  1306. isLogin: function() {
  1307. return $("td.login_left_side").size() > 0;
  1308. },
  1309.  
  1310. /* Returns the ID of the current page */
  1311. getPage: function() {
  1312. var result = (/ctrl=([a-zA-Z0-9_]+)/g).exec(window.location.href);
  1313. return result ? result[1] : null;
  1314. },
  1315.  
  1316. /* Get the current AJAX grid instance */
  1317. getAjaxInstance: function(element) {
  1318. return npu.getAjaxInstanceId(element) && unsafeWindow[npu.getAjaxInstanceId(element)];
  1319. },
  1320.  
  1321. getAjaxInstanceId: function(element) {
  1322. var ajaxGrid = $(element).closest("div[type=ajaxgrid]");
  1323. return ajaxGrid.size() > 0 && ajaxGrid.first().attr("instanceid");
  1324. },
  1325.  
  1326. /* Returns whether the specified ID is the current page */
  1327. isPage: function(ctrl) {
  1328. return (window.location.href.indexOf("ctrl=" + ctrl) != -1);
  1329. },
  1330.  
  1331. /* Runs a function asynchronously to fix problems in certain cases */
  1332. runAsync: function(func) {
  1333. window.setTimeout(func, 0);
  1334. },
  1335.  
  1336. /* Evaluates code in the page context */
  1337. runEval: function(source) {
  1338. if ("function" == typeof source) {
  1339. source = "(" + source + ")();"
  1340. }
  1341. var script = document.createElement('script');
  1342. script.setAttribute("type", "application/javascript");
  1343. script.textContent = source;
  1344. document.body.appendChild(script);
  1345. document.body.removeChild(script);
  1346. },
  1347.  
  1348. /* Returns the child object at the provided path */
  1349. getChild: function(o, s) {
  1350. while(s.length) {
  1351. var n = s.shift();
  1352. if(!(o instanceof Object && n in o)) {
  1353. return;
  1354. }
  1355. o = o[n];
  1356. }
  1357. return o;
  1358. },
  1359.  
  1360. /* Set the child object at the provided path */
  1361. setChild: function(o, s, v) {
  1362. while(s.length) {
  1363. var n = s.shift();
  1364. if(s.length == 0) {
  1365. if(v == null) {
  1366. delete o[n];
  1367. }
  1368. else {
  1369. o[n] = v;
  1370. }
  1371. return;
  1372. }
  1373. if(!(typeof o == "object" && n in o)) {
  1374. o[n] = new Object();
  1375. }
  1376. o = o[n];
  1377. }
  1378. },
  1379.  
  1380. /* Parses a subject code that is in parentheses at the end of a string */
  1381. parseSubjectCode: function(str) {
  1382. str = str.trim();
  1383. if(str.charAt(str.length - 1) == ')') {
  1384. var depth = 0;
  1385. for(var i = str.length - 2; i >= 0; i--) {
  1386. var c = str.charAt(i);
  1387. if(depth == 0 && c == '(') {
  1388. return str.substring(i + 1, str.length - 1);
  1389. }
  1390. depth = c == ')' ? depth + 1 : depth;
  1391. depth = c == '(' && depth > 0 ? depth - 1 : depth;
  1392. }
  1393. }
  1394. return null;
  1395. },
  1396.  
  1397. /* Generates a random token */
  1398. generateToken: function() {
  1399. var text = "", possible = "0123456789abcdef";
  1400. for(var i = 0; i < 32; i++) {
  1401. text += possible.charAt(Math.floor(Math.random() * possible.length));
  1402. }
  1403. return text;
  1404. },
  1405.  
  1406. /* Encodes a string into base64 */
  1407. encodeBase64: function(data) {
  1408. var b64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
  1409. var o1, o2, o3, h1, h2, h3, h4, bits, i = 0, ac = 0, enc = "", tmp_arr = [];
  1410. if(!data) {
  1411. return data;
  1412. }
  1413. do {
  1414. o1 = data.charCodeAt(i++); o2 = data.charCodeAt(i++); o3 = data.charCodeAt(i++);
  1415. bits = o1 << 16 | o2 << 8 | o3;
  1416. h1 = bits >> 18 & 0x3f; h2 = bits >> 12 & 0x3f; h3 = bits >> 6 & 0x3f; h4 = bits & 0x3f;
  1417. tmp_arr[ac++] = b64.charAt(h1) + b64.charAt(h2) + b64.charAt(h3) + b64.charAt(h4);
  1418. } while(i < data.length);
  1419. enc = tmp_arr.join("");
  1420. var r = data.length % 3;
  1421. return (r ? enc.slice(0, r - 3) : enc) + '==='.slice(r || 3);
  1422. },
  1423.  
  1424. /* Decodes a string from base64 */
  1425. decodeBase64: function(data) {
  1426. var b64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
  1427. var o1, o2, o3, h1, h2, h3, h4, bits, i = 0, ac = 0, dec = "", tmp_arr = [];
  1428. if (!data) {
  1429. return data;
  1430. }
  1431. data += "";
  1432. do {
  1433. h1 = b64.indexOf(data.charAt(i++)); h2 = b64.indexOf(data.charAt(i++)); h3 = b64.indexOf(data.charAt(i++)); h4 = b64.indexOf(data.charAt(i++));
  1434. bits = h1 << 18 | h2 << 12 | h3 << 6 | h4;
  1435. o1 = bits >> 16 & 0xff; o2 = bits >> 8 & 0xff; o3 = bits & 0xff;
  1436. tmp_arr[ac++] = (h3 == 64 ? String.fromCharCode(o1) : (h4 == 64 ? String.fromCharCode(o1, o2) : String.fromCharCode(o1, o2, o3)));
  1437. } while(i < data.length);
  1438. dec = tmp_arr.join("");
  1439. return dec;
  1440. }
  1441. };
  1442.  
  1443. /*
  1444. A JavaScript implementation of the SHA family of hashes, as
  1445. defined in FIPS PUB 180-2 as well as the corresponding HMAC implementation
  1446. as defined in FIPS PUB 198a
  1447.  
  1448. Copyright Brian Turek 2008-2013
  1449. Distributed under the BSD License
  1450. See http://caligatio.github.com/jsSHA/ for more information
  1451.  
  1452. Several functions taken from Paul Johnston
  1453. */
  1454. (function(B){function r(a,c,b){var f=0,e=[0],g="",h=null,g=b||"UTF8";if("UTF8"!==g&&"UTF16"!==g)throw"encoding must be UTF8 or UTF16";if("HEX"===c){if(0!==a.length%2)throw"srcString of HEX type must be in byte increments";h=u(a);f=h.binLen;e=h.value}else if("ASCII"===c||"TEXT"===c)h=v(a,g),f=h.binLen,e=h.value;else if("B64"===c)h=w(a),f=h.binLen,e=h.value;else throw"inputFormat must be HEX, TEXT, ASCII, or B64";this.getHash=function(a,c,b,g){var h=null,d=e.slice(),l=f,m;3===arguments.length?"number"!==
  1455. typeof b&&(g=b,b=1):2===arguments.length&&(b=1);if(b!==parseInt(b,10)||1>b)throw"numRounds must a integer >= 1";switch(c){case "HEX":h=x;break;case "B64":h=y;break;default:throw"format must be HEX or B64";}if("SHA-224"===a)for(m=0;m<b;m++)d=q(d,l,a),l=224;else if("SHA-256"===a)for(m=0;m<b;m++)d=q(d,l,a),l=256;else throw"Chosen SHA variant is not supported";return h(d,z(g))};this.getHMAC=function(a,b,c,h,k){var d,l,m,n,A=[],s=[];d=null;switch(h){case "HEX":h=x;break;case "B64":h=y;break;default:throw"outputFormat must be HEX or B64";
  1456. }if("SHA-224"===c)l=64,n=224;else if("SHA-256"===c)l=64,n=256;else throw"Chosen SHA variant is not supported";if("HEX"===b)d=u(a),m=d.binLen,d=d.value;else if("ASCII"===b||"TEXT"===b)d=v(a,g),m=d.binLen,d=d.value;else if("B64"===b)d=w(a),m=d.binLen,d=d.value;else throw"inputFormat must be HEX, TEXT, ASCII, or B64";a=8*l;b=l/4-1;l<m/8?(d=q(d,m,c),d[b]&=4294967040):l>m/8&&(d[b]&=4294967040);for(l=0;l<=b;l+=1)A[l]=d[l]^909522486,s[l]=d[l]^1549556828;c=q(s.concat(q(A.concat(e),a+f,c)),a+n,c);return h(c,
  1457. z(k))}}function v(a,c){var b=[],f,e=[],g=0,h;if("UTF8"===c)for(h=0;h<a.length;h+=1)for(f=a.charCodeAt(h),e=[],2048<f?(e[0]=224|(f&61440)>>>12,e[1]=128|(f&4032)>>>6,e[2]=128|f&63):128<f?(e[0]=192|(f&1984)>>>6,e[1]=128|f&63):e[0]=f,f=0;f<e.length;f+=1)b[g>>>2]|=e[f]<<24-g%4*8,g+=1;else if("UTF16"===c)for(h=0;h<a.length;h+=1)b[g>>>2]|=a.charCodeAt(h)<<16-g%4*8,g+=2;return{value:b,binLen:8*g}}function u(a){var c=[],b=a.length,f,e;if(0!==b%2)throw"String of HEX type must be in byte increments";for(f=0;f<
  1458. b;f+=2){e=parseInt(a.substr(f,2),16);if(isNaN(e))throw"String of HEX type contains invalid characters";c[f>>>3]|=e<<24-f%8*4}return{value:c,binLen:4*b}}function w(a){var c=[],b=0,f,e,g,h,k;if(-1===a.search(/^[a-zA-Z0-9=+\/]+$/))throw"Invalid character in base-64 string";f=a.indexOf("=");a=a.replace(/\=/g,"");if(-1!==f&&f<a.length)throw"Invalid '=' found in base-64 string";for(e=0;e<a.length;e+=4){k=a.substr(e,4);for(g=h=0;g<k.length;g+=1)f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(k[g]),
  1459. h|=f<<18-6*g;for(g=0;g<k.length-1;g+=1)c[b>>2]|=(h>>>16-8*g&255)<<24-b%4*8,b+=1}return{value:c,binLen:8*b}}function x(a,c){var b="",f=4*a.length,e,g;for(e=0;e<f;e+=1)g=a[e>>>2]>>>8*(3-e%4),b+="0123456789abcdef".charAt(g>>>4&15)+"0123456789abcdef".charAt(g&15);return c.outputUpper?b.toUpperCase():b}function y(a,c){var b="",f=4*a.length,e,g,h;for(e=0;e<f;e+=3)for(h=(a[e>>>2]>>>8*(3-e%4)&255)<<16|(a[e+1>>>2]>>>8*(3-(e+1)%4)&255)<<8|a[e+2>>>2]>>>8*(3-(e+2)%4)&255,g=0;4>g;g+=1)b=8*e+6*g<=32*a.length?b+
  1460. "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(h>>>6*(3-g)&63):b+c.b64Pad;return b}function z(a){var c={outputUpper:!1,b64Pad:"="};try{a.hasOwnProperty("outputUpper")&&(c.outputUpper=a.outputUpper),a.hasOwnProperty("b64Pad")&&(c.b64Pad=a.b64Pad)}catch(b){}if("boolean"!==typeof c.outputUpper)throw"Invalid outputUpper formatting option";if("string"!==typeof c.b64Pad)throw"Invalid b64Pad formatting option";return c}function k(a,c){return a>>>c|a<<32-c}function I(a,c,b){return a&
  1461. c^~a&b}function J(a,c,b){return a&c^a&b^c&b}function K(a){return k(a,2)^k(a,13)^k(a,22)}function L(a){return k(a,6)^k(a,11)^k(a,25)}function M(a){return k(a,7)^k(a,18)^a>>>3}function N(a){return k(a,17)^k(a,19)^a>>>10}function O(a,c){var b=(a&65535)+(c&65535);return((a>>>16)+(c>>>16)+(b>>>16)&65535)<<16|b&65535}function P(a,c,b,f){var e=(a&65535)+(c&65535)+(b&65535)+(f&65535);return((a>>>16)+(c>>>16)+(b>>>16)+(f>>>16)+(e>>>16)&65535)<<16|e&65535}function Q(a,c,b,f,e){var g=(a&65535)+(c&65535)+(b&
  1462. 65535)+(f&65535)+(e&65535);return((a>>>16)+(c>>>16)+(b>>>16)+(f>>>16)+(e>>>16)+(g>>>16)&65535)<<16|g&65535}function q(a,c,b){var f,e,g,h,k,q,r,C,u,d,l,m,n,A,s,p,v,w,x,y,z,D,E,F,G,t=[],H,B=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,
  1463. 3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];d=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428];f=[1779033703,3144134277,1013904242,
  1464. 2773480762,1359893119,2600822924,528734635,1541459225];if("SHA-224"===b||"SHA-256"===b)l=64,A=16,s=1,G=Number,p=O,v=P,w=Q,x=M,y=N,z=K,D=L,F=J,E=I,d="SHA-224"===b?d:f;else throw"Unexpected error in SHA-2 implementation";a[c>>>5]|=128<<24-c%32;a[(c+65>>>9<<4)+15]=c;H=a.length;for(m=0;m<H;m+=A){c=d[0];f=d[1];e=d[2];g=d[3];h=d[4];k=d[5];q=d[6];r=d[7];for(n=0;n<l;n+=1)t[n]=16>n?new G(a[n*s+m],a[n*s+m+1]):v(y(t[n-2]),t[n-7],x(t[n-15]),t[n-16]),C=w(r,D(h),E(h,k,q),B[n],t[n]),u=p(z(c),F(c,f,e)),r=q,q=k,k=
  1465. h,h=p(g,C),g=e,e=f,f=c,c=p(C,u);d[0]=p(c,d[0]);d[1]=p(f,d[1]);d[2]=p(e,d[2]);d[3]=p(g,d[3]);d[4]=p(h,d[4]);d[5]=p(k,d[5]);d[6]=p(q,d[6]);d[7]=p(r,d[7])}if("SHA-224"===b)a=[d[0],d[1],d[2],d[3],d[4],d[5],d[6]];else if("SHA-256"===b)a=d;else throw"Unexpected error in SHA-2 implementation";return a}"function"===typeof define&&typeof define.amd?define(function(){return r}):"undefined"!==typeof exports?"undefined"!==typeof module&&module.exports?module.exports=exports=r:exports=r:B.jsSHA=r})(npu);
  1466.  
  1467. /* Run the script */
  1468. npu.init();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement