Skip to content

Commit e5fe189

Browse files
committed
v0.4: fixed permalink URLs (one per thread)
according to inboxsdk’s update. + adjusted positioning of icon
1 parent c68007f commit e5fe189

File tree

4 files changed

+1590
-21
lines changed

4 files changed

+1590
-21
lines changed

content.js

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,34 @@
1+
/*
12
function attachLinks(messageView) {
23
var url = 'https://mail.google.com/mail/#all/' + messageView.getMessageID();
34
// TODO: or https://mail.google.com/mail/h/ouilk5cfmn2l/?th=MESSAGE_ID&v=c ?
45
var threadView = messageView.getThreadView();
5-
var div = document.createElement('div');
6-
var link = document.createElement('a');
7-
link.href = url;
8-
link.target = '_blank';
9-
link.innerHTML = 'Permalink to this email';
10-
div.style = 'text-align: center;';
11-
div.appendChild(link);
12-
var res = threadView.addSidebarContentPanel({
13-
el: div,
14-
title: 'Permalink: ' + threadView.getSubject(),
15-
iconUrl: chrome.extension.getURL('link.png'),
6+
attachThreadLink(threadView);
7+
}
8+
*/
9+
function attachThreadLink(threadView) {
10+
threadView.getThreadIDAsync().then(function(threadId) {
11+
console.log('[google-inbox-permalinks] getThreadIDAsync => ', arguments);
12+
if (!threadId) return;
13+
var link = document.createElement('a');
14+
link.href = 'https://mail.google.com/mail/#all/' + threadId;
15+
link.target = '_blank';
16+
link.appendChild(document.createTextNode('Permalink'));
17+
// note: threadView.getSubject() contains junk in the French version of Google Inbox
18+
var div = document.createElement('div');
19+
//div.style = 'text-align: center;';
20+
div.appendChild(link);
21+
threadView.addSidebarContentPanel({
22+
el: div,
23+
title: 'Permalinks',
24+
iconUrl: chrome.extension.getURL('link.png'),
25+
});
26+
}).catch(function() {
27+
console.log('[google-inbox-permalinks] getThreadIDAsync => error:', arguments);
1628
});
1729
}
1830

1931
InboxSDK.load('2', 'sdk_inbox-permalink_77495e9cd5').then(function(sdk){
20-
sdk.Conversations.registerMessageViewHandler(attachLinks);
32+
//sdk.Conversations.registerMessageViewHandler(attachLinks);
33+
sdk.Conversations.registerThreadViewHandler(attachThreadLink);
2134
});

inboxsdk.js

100755100644
Lines changed: 1564 additions & 8 deletions
Large diffs are not rendered by default.

link.png

32 Bytes
Loading

manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "Permalinks for Google Inbox",
33
"description": "Provides direct URLs to your emails, from Google Inbox.",
4-
"version": "0.3",
4+
"version": "0.4",
55
"icons": {
66
"128": "icon.png"
77
},

0 commit comments

Comments
 (0)