From 8cb32902de4198d9bd6ffb60bfab080a4443b740 Mon Sep 17 00:00:00 2001 From: Paul Kalauner Date: Mon, 30 Nov 2015 17:32:34 +0100 Subject: [PATCH 1/2] added tick icon --- content.js | 18 +++++++++--------- manifest.json | 3 ++- tick.png | Bin 0 -> 499 bytes 3 files changed, 11 insertions(+), 10 deletions(-) mode change 100644 => 100755 content.js mode change 100644 => 100755 manifest.json create mode 100644 tick.png diff --git a/content.js b/content.js old mode 100644 new mode 100755 index b035113..397c689 --- a/content.js +++ b/content.js @@ -1,19 +1,19 @@ -events = $(".block_calendar_upcoming .content .event > a"); +var tickpath = chrome.extension.getURL('tick.png'); +events = $(".block_calendar_upcoming .content .event"); events.each(function() { checkAssignment($(this)); }); function checkAssignment(event) { - var name = event.text() + var eventlink = event.find("> a"); + var name = eventlink.text(); var handler = function(data) { - var submissionstatussubmitted = $(data).find('.submissionstatussubmitted') + var submissionstatussubmitted = $(data).find('.submissionstatussubmitted'); if (submissionstatussubmitted.length >= 1) { - console.log(name + ": submitted"); - event.parent().css("background-color", "#7AFF7A") - } else { - console.log(name + ": not submitted"); + var img = event.find(".icon > img"); + img.attr("src" , tickpath); } }; - $.get(event.attr('href'), handler); -} + $.get(eventlink.attr('href'), handler); +} \ No newline at end of file diff --git a/manifest.json b/manifest.json old mode 100644 new mode 100755 index 6bfd119..abeae43 --- a/manifest.json +++ b/manifest.json @@ -11,5 +11,6 @@ }], "permissions": [ "*://elearning.tgm.ac.at/*", "tabs", "webNavigation" - ] + ], + "web_accessible_resources": ["tick.png"] } diff --git a/tick.png b/tick.png new file mode 100644 index 0000000000000000000000000000000000000000..f77255ffc5a387b494260911f2d84627f415548b GIT binary patch literal 499 zcmVw&eJd z_ct%!bh_Pm`vTkm9v>c7FMqFsV<(QyelqvT2V~7+g<{^mPCje(Wc1ko|NYN!^~JS+ zdrs~Nx!-($J=g$tXLc588_8u6b|Ik$FCRU5?br>s_p9E20?A3`O1U}P+HF)8SK|2h z=Rd>aH&6d9J+LDC*YsaA;9ii*m&)<6wV%w*!_C0R^q=AQ>5E6NoxAP9&Cg|K?_jc7 zT1tZJ&#(UsUqAi$zvAG=g3r@GPeKVqc6WAuWfSS$R;D_p%$!UNOhC~y2kxAfRS?#c zP!{6(|C^D4@e9}gRlB#9y_xy02WvF4d9n#<8p`g`vlcaE;P}hH0+jj7@Q>l=_g@S@ zUo!qbe(Y(@%Q Date: Mon, 30 Nov 2015 17:46:52 +0100 Subject: [PATCH 2/2] fixed indentations --- content.js | 13 +++++++++---- manifest.json | 6 +++--- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/content.js b/content.js index 397c689..3f9bee3 100755 --- a/content.js +++ b/content.js @@ -6,14 +6,19 @@ events.each(function() { }); function checkAssignment(event) { - var eventlink = event.find("> a"); + var eventlink = event.find("> a"); var name = eventlink.text(); var handler = function(data) { var submissionstatussubmitted = $(data).find('.submissionstatussubmitted'); if (submissionstatussubmitted.length >= 1) { - var img = event.find(".icon > img"); - img.attr("src" , tickpath); + var img = event.find(".icon > img"); + img.attr("src" , tickpath); } }; $.get(eventlink.attr('href'), handler); -} \ No newline at end of file +} +events = $(".block_calendar_upcoming .content .event > a"); + +events.each(function() { + checkAssignment($(this)); +}); \ No newline at end of file diff --git a/manifest.json b/manifest.json index abeae43..23d84a6 100755 --- a/manifest.json +++ b/manifest.json @@ -11,6 +11,6 @@ }], "permissions": [ "*://elearning.tgm.ac.at/*", "tabs", "webNavigation" - ], - "web_accessible_resources": ["tick.png"] -} + ], + "web_accessible_resources": ["tick.png"] +} \ No newline at end of file