for #5: handle custom containers

This commit is contained in:
groovecoder 2016-12-21 07:25:01 -06:00
parent 53363865cb
commit 532f673ad3

View file

@ -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 = `
<tr>
<td><div class="userContext-icon" data-identity-icon="${identity.icon}"></div></td>
<td><div class="userContext-icon" data-identity-icon="${identity.icon}" data-identity-icon-color="${identity.color}"></div></td>
<td>${identityName}</td>
<td>&gt;</td>
</tr>`;
document.querySelector('.identities-list').innerHTML += identityRow;
});
console.log('response from sdk addon: ', reply.content);
}
});