From 532f673ad3b9c8b67fb45439a6c10e0b9ac95e32 Mon Sep 17 00:00:00 2001 From: groovecoder Date: Wed, 21 Dec 2016 07:25:01 -0600 Subject: [PATCH] for #5: handle custom containers --- webextension/js/popup.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/webextension/js/popup.js b/webextension/js/popup.js index 316c5c9..6d265fa 100644 --- a/webextension/js/popup.js +++ b/webextension/js/popup.js @@ -2,18 +2,24 @@ const IDENTITY_L10NID_MATCH_INDEX = 1; browser.runtime.sendMessage('get-identities').then(reply=> { if (reply) { + console.log('reply from sdk addon: ', reply); reply.content.identities.forEach(identity=> { - const identityName = identity.l10nID.match(/userContext(\w*)\.label/)[IDENTITY_L10NID_MATCH_INDEX]; + let identityName = identity.name; + + console.log('identityName: ', identityName); + + if (typeof identityName === 'undefined') { + identityName = identity.l10nID.match(/userContext(\w*)\.label/)[IDENTITY_L10NID_MATCH_INDEX]; + } const identityRow = ` -
+
${identityName} > `; document.querySelector('.identities-list').innerHTML += identityRow; }); - console.log('response from sdk addon: ', reply.content); } });