Skip to content

Commit

Permalink
Fixes content not loading
Browse files Browse the repository at this point in the history
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
  • Loading branch information
dyro committed Jun 2, 2013
1 parent cdb1cae commit c52ed88
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions js/contentscript.js
@@ -1,4 +1,5 @@
$(document).ready(function() {

function removeElements(){
$("aside#right-side").children('div').remove();
$("aside#right-side").children('h2').remove();
Expand Down Expand Up @@ -66,11 +67,20 @@ $(document).ready(function() {
});
}

removeElements();
addDivs();

getCalendar();
getGrades();
getAssignments();
removeElements();
(function(){
var checkIfAssideHasLoaded = setInterval(function() {
if ( $('ul.events').length ) {
removeElements();
addDivs();
getCalendar();
getGrades();
getAssignments();

clearInterval(checkIfAssideHasLoaded);
}
console.log('magic');
}, 50);
}())
});

0 comments on commit c52ed88

Please sign in to comment.