mirror of
https://github.com/the1812/Bilibili-Evolved.git
synced 2025-11-04 21:22:45 +08:00
32 lines
1021 B
JavaScript
32 lines
1021 B
JavaScript
function extractKey(listItem) {
|
|
const input = listItem.querySelector("input");
|
|
if (input) {
|
|
return input.getAttribute("key");
|
|
}
|
|
return null;
|
|
}
|
|
(async () => {
|
|
resources.applyStyle("settingsTooltipStyle");
|
|
const { toolTips } = await import(`settings-tooltip.${getI18nKey()}`);
|
|
const tooltip = await SpinQuery.select(".gui-settings-tooltip");
|
|
if (!tooltip) {
|
|
return;
|
|
}
|
|
document.querySelectorAll(".gui-settings-content>ul>li").forEach(element => {
|
|
element.addEventListener("mouseover", () => {
|
|
const key = extractKey(element);
|
|
if (key === null || toolTips === null) {
|
|
return;
|
|
}
|
|
const tipText = toolTips.get(key);
|
|
if (tipText !== undefined) {
|
|
tooltip.innerHTML = tipText;
|
|
tooltip.classList.add("show");
|
|
}
|
|
});
|
|
element.addEventListener("mouseout", () => {
|
|
tooltip.classList.remove("show");
|
|
});
|
|
});
|
|
})();
|