Skip to content

Commit

Permalink
fix(quote): add italic text, change position
Browse files Browse the repository at this point in the history
  • Loading branch information
yoyurec committed Aug 6, 2022
1 parent 6df93f0 commit 09e4832
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 9 deletions.
Binary file modified screenshots/widgets-dark-01.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified screenshots/widgets-light-01.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ body[data-page="home"].is-icon-active #journals .journal-item:first-of-type h1.t
/* Quote */
#banner-widgets-quote {
position: relative;
margin: 12px 10px;
margin: 6px 8px;
filter: drop-shadow(0px 0px 2px rgba(var(--widgetsTextColor), 0.2)) drop-shadow(-2px -2px 0px rgba(var(--widgetsBgColor), 0.8))
}
#banner-widgets-quote::before {
Expand Down
11 changes: 3 additions & 8 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -743,18 +743,13 @@ const getWeatherHTML = async () => {

// Render random quote widget
const renderWidgetQuote = async () => {
doc.getElementById("banner-widgets-quote")?.remove();
if (widgetsConfig.quote.enabled === "off" || (widgetsConfig.quote.enabled === "journals" && !(isHome || isJournal))) {
doc.getElementById("banner-widgets-quote")?.remove();
return;
}
const quote = await getRandomQuote();
if (quote) {
const bannerWidgetsQuoteText = doc.getElementById("banner-widgets-quote-text");
if (bannerWidgetsQuoteText) {
bannerWidgetsQuoteText.textContent = quote;
} else {
doc.getElementById("banner-widgets")?.insertAdjacentHTML("beforeend", `<div id="banner-widgets-quote"><span id="banner-widgets-quote-text">${quote}</span></div>`);
}
doc.getElementById("banner-widgets")?.insertAdjacentHTML("beforeend", `<div id="banner-widgets-quote"><span id="banner-widgets-quote-text">${quote}</span></div>`);
root.style.setProperty("--widgetsQuoteFS", getFontSize(quote.length));
}
}
Expand Down Expand Up @@ -791,7 +786,7 @@ const getRandomQuote = async () => {
const randomQuoteBlock = quotesList[Math.floor(Math.random() * quotesList.length)][0];
const randomQuoteContent: string = randomQuoteBlock.content || "";
const regExpVal = new RegExp(`${widgetsConfig.quote.tag}`,"gi");
return randomQuoteContent.replace(regExpVal, "").trim();
return randomQuoteContent.replace(regExpVal, "").replace(/\*(.*)\*/g, "<i>$1</i>").trim();
}

// Render custom widget
Expand Down

0 comments on commit 09e4832

Please sign in to comment.