Attempt to get favicon for RegExp match

This commit is contained in:
Rob Garrison 2017-12-30 09:08:45 -06:00
parent 8153a03c19
commit be8c28053e

View File

@ -252,9 +252,12 @@ function createStyleTargetsElement({entry, style, iconsOnly}) {
let favicon = ''; let favicon = '';
if (type === 'domains') { if (type === 'domains') {
favicon = GET_FAVICON_URL + targetValue; favicon = GET_FAVICON_URL + targetValue;
} else if (targetValue.startsWith('chrome-extension:')) { } else if (targetValue.startsWith('chrome-extension:') || targetValue.startsWith('moz-extension:')) {
favicon = OWN_ICON; favicon = OWN_ICON;
} else if (type !== 'regexps') { } else if (type === 'regexps') {
favicon = targetValue.match(/\w+[\\.(]+(com|org|co|net|im|io)\b/g);
favicon = favicon ? GET_FAVICON_URL + favicon.pop().replace(/[\\(]/g, '') : '';
} else {
favicon = targetValue.includes('://') && targetValue.match(/^.*?:\/\/([^/]+)/); favicon = targetValue.includes('://') && targetValue.match(/^.*?:\/\/([^/]+)/);
favicon = favicon ? GET_FAVICON_URL + favicon[1] : ''; favicon = favicon ? GET_FAVICON_URL + favicon[1] : '';
} }