Skip to content

Commit

Permalink
Pierwszy commit, wersja 0.3.2
Browse files Browse the repository at this point in the history
  • Loading branch information
msxmine authored Jun 15, 2017
1 parent 0eb4489 commit 9bb2b50
Show file tree
Hide file tree
Showing 11 changed files with 716 additions and 0 deletions.
26 changes: 26 additions & 0 deletions banerinject.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
chrome.storage.local.get({
//DOMYSLNE USTAWIENIA CHROME
baner: true,
banerurl: "https://i.imgur.com/OYSVEl8.png"
}, function(items) {
if (items.baner){

//Using CSS as a placeholder so the banner doesnt flicker
//CSS applies as soon as element is shown (It can be set before element exists)
//JS has a delay (it needs DOM completely loaded)
var customStyles = document.createElement('style');
customStyles.appendChild(document.createTextNode(
"#top-banner { visibility: hidden } #top-banner-container { background: url(" + items.banerurl + ") no-repeat, url(/assets/img/synergia/header/systema.png) top left no-repeat !important; }"
));
//banerurl set by user, shouldnt be a problem //I dont even know if there is any risk with CSS
document.documentElement.appendChild(customStyles);

//When everthing is loaded do JS anyway because background: url isn't perfect
document.addEventListener("DOMContentLoaded", function() {
var banerElement = document.getElementById("top-banner");
banerElement.src = items.banerurl;
banerElement.style.visibility = "visible";
});

}
});
41 changes: 41 additions & 0 deletions glowna.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
chrome.storage.local.get({
glowna: true
}, function(items) {
if (items.glowna == true) {

var customStyles = document.createElement('style');
customStyles.appendChild(document.createTextNode(
".center.main-page { display: none; } .container.static.margin-bottom { display: none; } #footer {display: none;}"
));
document.documentElement.appendChild(customStyles);

};
});


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);

chrome.storage.local.get({
glowna: true
}, function(items) {
if (items.glowna == true) {
document.getElementById("body").innerHTML = '<div><iframe style="position:absolute;left:0px;width:100%;height:85%" src="https://synergia.librus.pl/przegladaj_plan_lekcji" scrolling="yes" align="middle" frameborder="0"></iframe></div>';
};
});

});



Binary file added icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
48 changes: 48 additions & 0 deletions magicznyweb.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
function OdpalDodanaPrzezemnieAnimacje(){
var style = document.createElement('style');
style.type = 'text/css';
style.textContent = '.grade-box { position: fixed; }';
document.getElementsByTagName('head')[0].appendChild(style);



function makeNewPosition(){

var h = $(window).height() - 50;
var w = $(window).width() - 50;

var nh = Math.floor(Math.random() * h);
var nw = Math.floor(Math.random() * w);

return [nh,nw];

}
function calcSpeed(prev, next) {
var x = Math.abs(prev[1] - next[1]);
var y = Math.abs(prev[0] - next[0]);
var greatest = x > y ? x : y;
var speedModifier = 0.01;
var speed = Math.ceil(greatest / speedModifier);
return speed;
}
function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}

function animateDiv(objekt){
var newq = makeNewPosition();
var oldq = objekt.offset();
var speed = calcSpeed([oldq.top, oldq.left], newq);

objekt.animate({ top: newq[0], left: newq[1] }, speed, function(){
animateDiv(objekt);
});
};

function WystartujAnimacje(){
$('.grade-box').each(function(){
animateDiv($(this));
});
}
WystartujAnimacje();
}
50 changes: 50 additions & 0 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
"manifest_version": 2,

"name": "Edziennik-plus",
"description": "Więcej funkcji w dzienniku elektronicznym",
"version": "0.3.2",
"icons": {"128":"icon.png"},
"author": "MS",
"options_ui": {
"page": "options.html",
"chrome_style": true
},
"web_accessible_resources": [
"wiadantyspamweb.js",
"magicznyweb.js"
],
"content_scripts": [
{
"matches": ["https://synergia.librus.pl/przegladaj_oceny/uczen"],
"js": ["oceny.js"],
"run_at": "document_start"
},
{
"matches": ["https://synergia.librus.pl/uczen_index"],
"js": ["glowna.js"],
"run_at": "document_start"
},
{
"matches": ["https://synergia.librus.pl/*"],
"js": ["banerinject.js"],
"run_at": "document_start"
},
{
"matches": ["https://synergia.librus.pl/wiadomosci", "https://synergia.librus.pl/wiadomosci/5", "https://synergia.librus.pl/wiadomosci/5/*"],
"js": ["wiadantyspam.js"],
"run_at": "document_idle"
},
{
"matches": ["https://synergia.librus.pl/*"],
"exclude_matches": ["https://synergia.librus.pl/uczen_index"],
"js": ["szczesliwy.js"],
"run_at": "document_end"
}
],
"permissions": [
"storage",
"tabs",
"https://synergia.librus.pl/*"
]
}
Loading

0 comments on commit 9bb2b50

Please sign in to comment.