Skip to content

Commit

Permalink
Fixed setting of canvas
Browse files Browse the repository at this point in the history
Current way causes an infinite loop for me
  • Loading branch information
marksteve committed Oct 16, 2012
1 parent 2a528d2 commit 92330b0
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions chrome/lib/gmailr.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,9 @@
// Here we do delayed loading until success. This is in the case
// that our script loads after Gmail has already loaded.
self.delayed_loader = setInterval(function() {
self.elements.canvas = $(document.getElementsByTagName('html')[0]);
var canvas_frame;
self.elements.canvas = (canvas_frame = document.getElementById("canvas_frame")) ?
$(canvas_frame.contentDocument) : $(document);
self.elements.body = self.elements.canvas.find('body').first();

if(self.loaded) {
Expand Down Expand Up @@ -159,7 +161,7 @@

// add selectors here if/when gmail changes this
var emailSelectors = ['#guser b', '.gbmp1', ".gbps2"]

return this.elements.canvas.find(emailSelectors.join(',')).first().html();
},

Expand Down Expand Up @@ -522,4 +524,4 @@
};

window.Gmailr = Gmailr;
})(jQuery, window);
})(jQuery, window);

0 comments on commit 92330b0

Please sign in to comment.