From 51aa931deec3b3da89f9ea3119799c1bdc80c46b Mon Sep 17 00:00:00 2001 From: Robin Scholtes Date: Tue, 23 May 2023 20:11:40 +1200 Subject: [PATCH] [#181] move isFavourite check up in toStubHtml to be able to add 'favourite' class on init as well --- src/web/HTMLOperation.mjs | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/web/HTMLOperation.mjs b/src/web/HTMLOperation.mjs index c84812af..01c623cc 100755 --- a/src/web/HTMLOperation.mjs +++ b/src/web/HTMLOperation.mjs @@ -50,7 +50,10 @@ class HTMLOperation { // returning the HTML we purge this.name from any HTML for the data-name attribute const name = this.name.replace(/(<([^>]+)>)/ig, ""); - let html = `
  • ${titleFromWikiLink(this.infoURL)}` : ""; @@ -68,13 +71,8 @@ class HTMLOperation { html += "check"; } - // check if local storage is available *and* has favourites at all ( otherwise we use the default favs ) - const isFavourite = this.app.isLocalStorageAvailable() && localStorage.favourites?.includes(this.name); - if (this.app.isMobileView()) { - html += ` - ${isFavourite ? "star" : "star_outline"} - `; + html += `${isFavourite ? "star" : "star_outline"}`; } html += "
  • ";