From a32adf1c32763eb0afed7a7afdbf3454cce9faf1 Mon Sep 17 00:00:00 2001 From: tophf Date: Sun, 18 Apr 2021 15:43:08 +0300 Subject: [PATCH] show usw logo --- popup/search.css | 6 ++++++ popup/search.js | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/popup/search.css b/popup/search.css index 127738b4..4887fadd 100644 --- a/popup/search.css +++ b/popup/search.css @@ -82,6 +82,12 @@ body.search-results-shown { overflow-wrap: break-word; } +.search-result-title img { + width: 20px; + height: 20px; + margin: -6px 4px -6px 0; +} + .search-result-title span { font-size: 12px; font-weight: 600; diff --git a/popup/search.js b/popup/search.js index c6e9a748..e2647389 100644 --- a/popup/search.js +++ b/popup/search.js @@ -13,6 +13,10 @@ const RESULT_ID_PREFIX = 'search-result-'; const INDEX_URL = URLS.usoArchiveRaw + 'search-index.json'; const USW_INDEX_URL = URLS.usw + 'api/index/uso-format'; + const USW_ICON = $create('img', { + src: `${URLS.usw}favicon.ico`, + title: URLS.usw, + }); const STYLUS_CATEGORY = 'chrome-extension'; const PAGE_LENGTH = 10; // update USO style install counter if the style isn't uninstalled immediately @@ -283,6 +287,7 @@ href: isUsw ? `${URLS.usw}style/${id}` : `${URLS.usoArchive}?category=${category}&style=${id}`, }); + if (isUsw) $('.search-result-title', entry).prepend(USW_ICON.cloneNode(true)); $('.search-result-title span', entry).textContent = t.breakWord(name.length < 300 ? name : name.slice(0, 300) + '...'); // screenshot