Skip to content

Commit

Permalink
tooltip update 2024/02/04
Browse files Browse the repository at this point in the history
  • Loading branch information
sctop committed Feb 4, 2024
1 parent e5f7870 commit e4c8abc
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
2 changes: 2 additions & 0 deletions static/css/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -419,3 +419,5 @@ body > .wrapper {
.story-by-comm:lang(en):after {content: "[Comm]"}
.story-by-narr:lang(zh-Hans):after {content: "[叙述]"}
.story-by-narr:lang(en):after {content: "[Narrator]"}

.tooltip-variable-content {display: none;}
7 changes: 6 additions & 1 deletion static/js/popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ async function autoCurrentDestruct() {
removePopup(currentPopup);
}

function showPopupByTooltipId(tooltip_id) {
function showPopupByTooltipId(tooltip_id, designatedElementClass) {
if (currentPopup !== void 0) {
removePopup(currentPopup);
}
Expand All @@ -29,4 +29,9 @@ function showPopupByTooltipId(tooltip_id) {
setScrollToNone();
currentPopup.show();
displayZhcnString();

let designatedElementClass_ = designatedElementClass || [];
for (let i = 0; i < designatedElementClass_.length; i++) {
setElementDisplay(designatedElementClass_[i], "block");
}
}
13 changes: 9 additions & 4 deletions static/js/tooltip.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,22 +46,27 @@ const tooltipHtmlGenerator = {
}
}

function showTooltip(obj, content, params) {
function showTooltip(obj, content, params, designatedElementClass) {
if (currentTooltip !== void 0) {
currentTooltip.destroy();
}

currentTooltip = tippy(obj, Object.assign({}, {content: content}, params));
currentTooltip.show();
displayZhcnString();
for (let i = 0; i < designatedElementClass.length; i++) {
setElementDisplay(designatedElementClass[i], "block");
}
}

function showTooltipById(obj, dataKeyname) {
if (dataKeyname === void 0) {
function showTooltipById(obj, dataKeyname, designatedElementClass) {
if (dataKeyname === void 0 || dataKeyname === "undefined") {
dataKeyname = obj.dataset.tooltip;
}

showTooltip(obj, tooltipData.getData(dataKeyname), {interactive: true, allowHTML: true, maxWidth: "40em", placement: "top"})
showTooltip(obj, tooltipData.getData(dataKeyname),
{interactive: true, allowHTML: true, maxWidth: "40em", placement: "top"},
designatedElementClass)
}

function showTooltipGallerySmall(obj) {
Expand Down

0 comments on commit e4c8abc

Please sign in to comment.