Skip to content

Commit

Permalink
0.4.0
Browse files Browse the repository at this point in the history
-Usunięcie wstrzykiwania szczęśliwego numeru
-Naprawa przekierowania na stronie logowania
-Naprawa przekierowania na stronie wylogowania
-Mały hack naprawiający auto-uzupełnianie haseł w firefox
  • Loading branch information
msxmine authored Sep 3, 2018
1 parent 7be7df4 commit 96bfa30
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 17 deletions.
20 changes: 10 additions & 10 deletions glowna.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@ chrome.storage.local.get({
document.addEventListener("DOMContentLoaded", function() {


var szczesliwyNum = document.getElementsByClassName("szczesliwy-numerek")[0].children[0].textContent;
var teksik = document.getElementsByClassName("szczesliwy-numerek")[0].parentElement.children[2].textContent;
localStorage.setItem("szczesliwy", szczesliwyNum);
localStorage.setItem("szczesliwytex", teksik);
var tb = document.getElementById("top-banner-container").children[0];
var myheader = document.createElement('p1');
myheader.style.position = "absolute";
myheader.style.top = "85%";
myheader.textContent = teksik + szczesliwyNum;
tb.insertBefore(myheader, tb.firstChild);
//var szczesliwyNum = document.getElementsByClassName("szczesliwy-numerek")[0].children[0].textContent;
//var teksik = document.getElementsByClassName("szczesliwy-numerek")[0].parentElement.children[2].textContent;
//localStorage.setItem("szczesliwy", szczesliwyNum);
//localStorage.setItem("szczesliwytex", teksik);
//var tb = document.getElementById("top-banner-container").children[0];
//var myheader = document.createElement('p1');
//myheader.style.position = "absolute";
//myheader.style.top = "85%";
//myheader.textContent = teksik + szczesliwyNum;
//tb.insertBefore(myheader, tb.firstChild);

chrome.storage.local.get({
glowna: true
Expand Down
9 changes: 9 additions & 0 deletions loginfix.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
var ramkaLogowania = document.getElementById("caLoginIframe");
function HandleLoad(){
ramkaLogowania.removeEventListener('load', HandleLoad);
setTimeout(function(){
ramkaLogowania.src = ramkaLogowania.src;
}, 100);
}

ramkaLogowania.addEventListener('load', HandleLoad);
14 changes: 7 additions & 7 deletions manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

"name": "Edziennik-plus",
"description": "Więcej funkcji w dzienniku elektronicznym",
"version": "0.3.5",
"version": "0.4.0",
"icons": {"128":"icon.png"},
"author": "MS",
"options_ui": {
Expand All @@ -21,7 +21,7 @@
"run_at": "document_start"
},
{
"matches": ["https://synergia.librus.pl/uczen_index"],
"matches": ["https://synergia.librus.pl/uczen/index"],
"js": ["glowna.js"],
"run_at": "document_start"
},
Expand All @@ -36,18 +36,18 @@
"run_at": "document_idle"
},
{
"matches": ["https://synergia.librus.pl/*"],
"exclude_matches": ["https://synergia.librus.pl/uczen_index"],
"js": ["szczesliwy.js"],
"run_at": "document_end"
"matches": ["https://portal.librus.pl/rodzina/synergia/loguj"],
"js": ["loginfix.js"],
"run_at": "document_idle"
}
],
"permissions": [
"storage",
"tabs",
"webRequest",
"webRequestBlocking",
"https://synergia.librus.pl/*"
"https://synergia.librus.pl/*",
"https://portal.librus.pl/*"
],
"background": {
"scripts": ["tlo.js"]
Expand Down
39 changes: 39 additions & 0 deletions tlo.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,42 @@ browser.webRequest.onHeadersReceived.addListener(
{urls: ["https://synergia.librus.pl/przegladaj_plan_lekcji", "http://synergia.librus.pl/przegladaj_plan_lekcji"]},
["blocking", "responseHeaders"]
);

function zmienNaglowekdwa(req) {
for (var i = 0, leng = req.responseHeaders.length; i < leng; i++){
if (req.responseHeaders[i].name == "Location"){
req.responseHeaders[i].value = "https://portal.librus.pl/rodzina/synergia/loguj";
}
}
return {responseHeaders: req.responseHeaders};
}

browser.webRequest.onHeadersReceived.addListener(
zmienNaglowekdwa,
{urls: ["https://synergia.librus.pl/wyloguj"]},
["blocking", "responseHeaders"]
);

function zmienRzadanie(req) {
var zmiana = 0;
for(var header of req.requestHeaders){
if(header.name == "Referer"){
header.value = "https://portal.librus.pl/rodzina"
zmiana = 1;
}
}
if(zmiana == 0){
var nowyhead = {
"name": "Referer",
"value": "https://portal.librus.pl/rodzina"
};
req.requestHeaders.push(nowyhead);
}
return {requestHeaders: req.requestHeaders};
}

browser.webRequest.onBeforeSendHeaders.addListener(
zmienRzadanie,
{urls: ["https://portal.librus.pl/rodzina/synergia/loguj"]},
["blocking", "requestHeaders"]
);

0 comments on commit 96bfa30

Please sign in to comment.