Skip to content

Commit

Permalink
fix(multi-account): support mutiple google accounts /u/*
Browse files Browse the repository at this point in the history
closes #8.
  • Loading branch information
adrienjoly committed Feb 5, 2018
1 parent e48923e commit 7ca75a2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
9 changes: 8 additions & 1 deletion content.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,19 @@ function attachLinks(messageView) {
attachThreadLink(threadView);
}
*/

function getUserSuffix(url) {
var res = /^https\:\/\/inbox\.google\.com\/(u\/\d\/)/.exec(url);
return res ? res[1] : '';
}

function attachThreadLink(threadView) {
threadView.getThreadIDAsync().then(function(threadId) {
console.log('[google-inbox-permalinks] getThreadIDAsync => ', arguments);
if (!threadId) return;
var userSuffix = getUserSuffix(window.location.href);
var link = document.createElement('a');
link.href = 'https://mail.google.com/mail/#all/' + threadId;
link.href = 'https://mail.google.com/mail/' + userSuffix + '#all/' + threadId;
link.target = '_blank';
link.appendChild(document.createTextNode('Permalink'));
// note: threadView.getSubject() contains junk in the French version of Google Inbox
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "Permalinks for Google Inbox",
"description": "Provides direct URLs to your emails, from Google Inbox.",
"version": "0.4",
"version": "0.5",
"icons": {
"128": "icon.png"
},
Expand Down

0 comments on commit 7ca75a2

Please sign in to comment.