Skip to content

Commit c52ed88

Browse files
committedJun 2, 2013
Fixes content not loading
It looks like Canvas is using multiple AJAX calls to load the content in the right aside bar. This called removeElements() before all the content from Canvas was loaded, so the elements would still be there, which caused the content this extension loads to now show up
1 parent cdb1cae commit c52ed88

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed
 

Diff for: ‎js/contentscript.js

+16-6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
$(document).ready(function() {
2+
23
function removeElements(){
34
$("aside#right-side").children('div').remove();
45
$("aside#right-side").children('h2').remove();
@@ -66,11 +67,20 @@ $(document).ready(function() {
6667
});
6768
}
6869

69-
removeElements();
70-
addDivs();
71-
72-
getCalendar();
73-
getGrades();
74-
getAssignments();
70+
removeElements();
71+
(function(){
72+
var checkIfAssideHasLoaded = setInterval(function() {
73+
if ( $('ul.events').length ) {
74+
removeElements();
75+
addDivs();
76+
getCalendar();
77+
getGrades();
78+
getAssignments();
79+
80+
clearInterval(checkIfAssideHasLoaded);
81+
}
82+
console.log('magic');
83+
}, 50);
84+
}())
7585
});
7686

0 commit comments

Comments
 (0)
Please sign in to comment.