Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion base.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
$(function(){
function enableStudentPhotos() {
var rows = $('table.wrnav tr td a.wrgrey');
var personRegexp = new RegExp("pokazOsobe\\(os_id:([0-9]*)\\)");
Expand All @@ -23,4 +24,5 @@ function enableStudentPhotos() {
}
}

enableStudentPhotos();
enableStudentPhotos();
});
6 changes: 3 additions & 3 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{
"content_scripts": [
{
"js": [ "jquery.min.js", "base.js", "mimuw.js" ],
"js": [ "jquery.min.js", "base.js", "mimuw.js", "tests.js" ],
"matches": [ "https://usosweb.mimuw.edu.pl/*" ]
},
{
"js": [ "jquery.min.js", "base.js" ],
"js": [ "jquery.min.js", "base.js", "tests.js" ],
"matches": [ "https://usosweb.wne.uw.edu.pl/*" ]
}
],
"description": "Dodatek modyfikujący działanie usosweba.",
"name": "USOSweb ++",
"version": "0.1.2"
"version": "0.2.3"
}
25 changes: 14 additions & 11 deletions mimuw.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
function enableWikispaces() {
var h2 = $('h2')
if(h2) {
if(h2[0].innerHTML == 'Informacje o pracowniku') {
var h1 = $('h1')[0];
var name = h1.childNodes[2].nodeValue.split(' ');
var url = 'http://mimuw.wikispaces.com/' + name[2] + ', ' + name[0];
$(h2[0].parentNode).append('<br><a href="' +
url + '">Przejdź do wikispaces</a><iframe style="width: 100%; height: 500px;" src="'+url+'"></iframe>');
$(function(){
function enableWikispaces() {
var h2 = $('h2')
if(h2) {
if(h2[0].innerHTML == 'Informacje o pracowniku') {
var h1 = $('h1')[0];
var name = h1.childNodes[2].nodeValue.split(' ');
var url = 'http://mimuw.wikispaces.com/' + name[2] + ', ' + name[0];
$(h2[0].parentNode).append('<br><a href="' +
url + '">Przejdź do wikispaces</a><iframe style="width: 100%; height: 500px;" src="'+url+'"></iframe>');
}
}
}
}
enableWikispaces();

enableWikispaces();
});
67 changes: 67 additions & 0 deletions tests.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
$(function(){
/*
Podglad punktow ze sprawdzianow na glownej (Moim Usoswebie)
W localstorage zapisuje poprzednio sprawdzona sume, jezeli sie rozni
to wyswietla roznice

By pyetras
*/
function lookupTests(){
var url_exp = "kontroler.php?_action=actionx:dla_stud/studia/sprawdziany/pokaz(wez_id:"
var alrdy_checked = [];
$('a[href]').each(function(i){
if ($(this).attr("href").indexOf(url_exp) == -1) return;
var url = $(this).attr('href');
if (alrdy_checked[url]){
return;
}else{
alrdy_checked[url] = true;
}

var link = this;
$.get(url, function(data){
var re = /wez_id:(\d+)/;
var id = re.exec(url)[1];
var wynik = 0.0;
var nullCount = 0;

var rec_find = function(table){
$(table).each(function(i){
if ($($(this).find('td')[1]).text().search('ocena') != -1)
return;

var pkt_txt = $($(this).find('td')[2]).text();
pkt = parseFloat(pkt_txt.replace('pkt', ''));
if (!isNaN(pkt)){
wynik += pkt;
}else{
nullCount++;
//nie ma punktu, sprawdzam poddrzewo
rec_find($(this).next('div[id^=childrenof]').children('table'));
}
});
}

rec_find($('div#childrenof'+id+' > table', data));
$(link).after(' <span class="note">' + wynik + ' pkt</span> ');
var data;

if (!(data = localStorage[id])){
data = [0, 0];
}else{
data = JSON.parse(data);
data = [parseFloat(data[0]), parseInt([data[1]])];
}
if (data[0] != wynik || data[1] != nullCount){
var dif = wynik - data[0];
$(link).next().append(' (' + ((dif >= 0)?'+':'') + dif +')');
$(link).next().css('font-weight', 'bold');
localStorage[id] = JSON.stringify([wynik, nullCount]);
}

});
});
}

lookupTests();
})