Skip to content

Commit

Permalink
Allow to show both debug tooltip and tab preview tooltip
Browse files Browse the repository at this point in the history
  • Loading branch information
piroor committed Nov 30, 2024
1 parent 4f26b72 commit d7981f9
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions webextensions/sidebar/components/TabElement.js
Original file line number Diff line number Diff line change
Expand Up @@ -392,8 +392,9 @@ export class TabElement extends HTMLElement {
if (!tabElement)
return;

let debugTooltip;
if (configs.debug) {
this.tooltip = `
debugTooltip = `
${tab.title}
#${tab.id}
(${tabElement.className})
Expand All @@ -403,18 +404,24 @@ restored = <${!!this.$TST.uniqueId.restored}>
tabId = ${tab.id}
windowId = ${tab.windowId}
`.trim();
this.$TST.setAttribute('title', this.tooltip);
return;
this.$TST.setAttribute('title', debugTooltip);
if (!configs.tabPreviewTooltip) {
this.tooltip = debugTooltip;
this.tooltipHtml = `<pre>${sanitizeForHTMLText(debugTooltip)}</pre>`;
return;
}
}

this.tooltip = this.$TST.generateTooltipText();
this.tooltipWithDescendants = this.$TST.generateTooltipTextWithDescendants();
this.tooltipHtml = this.$TST.generateTooltipHtml();
this.tooltipHtmlWithDescendants = this.$TST.generateTooltipHtmlWithDescendants();

const tooltipText = configs.tabPreviewTooltip ?
null :
this.appliedTooltipText;
const tooltipText = configs.debug ?
debugTooltip :
configs.tabPreviewTooltip ?
null :
this.appliedTooltipText;
if (typeof tooltipText == 'string')
this.$TST.setAttribute('title', tooltipText);
else
Expand Down

0 comments on commit d7981f9

Please sign in to comment.