Skip to content

Commit

Permalink
Merge pull request #10 from marksteve/patch-1
Browse files Browse the repository at this point in the history
Fixed setting of canvas
  • Loading branch information
James Yu committed Oct 16, 2012
2 parents 2a528d2 + 92330b0 commit 0c588f3
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 0c588f3

Please sign in to comment.