Skip to content

Commit

Permalink
Merge pull request #22 from imicky/master
Browse files Browse the repository at this point in the history
Make it possible to capture mail content from Gmail
  • Loading branch information
danlec committed Oct 8, 2015
2 parents ef74529 + 6ff95eb commit ed806ca
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions trello_bookmarklet.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,21 @@
selection = ""+window.getSelection();
} else if(document.selection && document.selection.createRange) {
selection = document.selection.createRange().text;
}

if (!selection && $('.gs .adP').length){

// we're looking at an email in Gmail
selection = $('.gs .adP').eq(0).html();
selection = selection.replace(/(<br\s*[/]?>|<\/p>|<\/div>|<\/blockquote>)/gi,'\n$1');
selection = $(selection).text();
if(selection){
selection = '------ original content ------\n\n'+selection;
}

}


// If they've selected text, add it to the name/desc of the card
if(selection) {
if(!name) {
Expand Down

0 comments on commit ed806ca

Please sign in to comment.