From 99709f39756b4c95ba66078f50600f3cc2ed2a5c Mon Sep 17 00:00:00 2001 From: Andrey Marakulin Date: Sun, 3 Apr 2022 06:17:55 +0300 Subject: [PATCH] 0.9.2 Fixes --- js/edit-menu.js | 7 +++---- js/load-icons.js | 17 ++++++++--------- manifest.json | 2 +- 3 files changed, 12 insertions(+), 14 deletions(-) diff --git a/js/edit-menu.js b/js/edit-menu.js index 814d12b..c45aed7 100644 --- a/js/edit-menu.js +++ b/js/edit-menu.js @@ -34,15 +34,14 @@ function deleteEditPopup() { function updateIconPreview() { let link_value = document.getElementById("edit-link-text").value let iconlink = document.getElementById("edit-icon-text").value - - // Icon itself let preview_div = document.getElementById("preview") preview_div.setAttribute('link', link_value) - if (varDefined(iconlink)){ + if (varDefined(link_value) && varDefined(iconlink)){ preview_div.setAttribute('icon-link', iconlink) loadIcon('preview') } - else if (varDefined(link_value)){ + else if (varDefined(link_value) && !varDefined(iconlink)){ + preview_div.removeAttribute('icon-link') loadIcon('preview') } else { diff --git a/js/load-icons.js b/js/load-icons.js index 6337aa2..eb7acee 100644 --- a/js/load-icons.js +++ b/js/load-icons.js @@ -50,17 +50,16 @@ function setIcon(id, data) { } function cacheIcon(id, iconBase64){ - if (id !== 'preview'){ - chrome.storage.local.get([id], function (res) { - let storage_value = res[id] - storage_value[0]['cache-icon'] = iconBase64 - chrome.storage.local.set({[id]: storage_value}, () => {}) - setIcon(id, iconBase64) - }) - } - else { + if (id === 'preview') { setIcon(id, iconBase64) + return } + chrome.storage.local.get([id], function (res) { + let storage_value = res[id] + storage_value[0]['cache-icon'] = iconBase64 + chrome.storage.local.set({[id]: storage_value}, () => {}) + setIcon(id, iconBase64) + }) } function clearIconCache(id) { diff --git a/manifest.json b/manifest.json index 13dd490..eee80cd 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "name": "Pulchra bookmarks", "description": "Pulchra bookmarks extension", - "version": "0.9.1", + "version": "0.9.2", "manifest_version": 3, "minimum_chrome_version": "96", "chrome_url_overrides": {