From ee4c4de059f7dd0c541d60af5fc9f80d35163619 Mon Sep 17 00:00:00 2001 From: tophf Date: Sat, 28 Jul 2018 21:05:20 +0300 Subject: [PATCH] code cosmetics: combine and simplify --- manage/manage.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/manage/manage.js b/manage/manage.js index 49c28669..25204021 100644 --- a/manage/manage.js +++ b/manage/manage.js @@ -321,14 +321,12 @@ function recreateStyleTargets({styles, iconsOnly = false} = {}) { } function getFaviconImgSrc(container = installed) { - const targets = $$('.target', container); const regexpRemoveNegativeLookAhead = /(\?!([^)]+\))|\(\?![\w(]+[^)]+[\w|)]+)/g; // replace extra characters & all but the first group entry "(abc|def|ghi)xyz" => abcxyz const regexpReplaceExtraCharacters = /[\\(]|((\|\w+)+\))/g; - const domainExt = 'com,org,co,net,im,io,edu,gov,biz,info,de,cn,uk,nl,eu,ru'.split(','); - const regexpMatchRegExp = new RegExp(`[\\w-]+[\\.(]+(${domainExt.join('|')})\\b`, 'g'); + const regexpMatchRegExp = /[\w-]+[.(]+(com|org|co|net|im|io|edu|gov|biz|info|de|cn|uk|nl|eu|ru)\b/g; const regexpMatchDomain = /^.*?:\/\/([^/]+)/; - for (const target of targets) { + for (const target of $$('.target', container)) { const type = target.dataset.type; const targetValue = target.textContent; if (!targetValue) continue;