mirror of
https://github.com/KoboldAI/KoboldAI-Client.git
synced 2025-06-05 21:59:24 +02:00
Fixes
This commit is contained in:
@@ -1904,27 +1904,13 @@ body {
|
|||||||
z-index: 9999999;
|
z-index: 9999999;
|
||||||
}
|
}
|
||||||
|
|
||||||
.context-token[tooltip]:hover::after {
|
.tooltip-context-token {
|
||||||
content: attr(tooltip);
|
border: none !important;
|
||||||
font-family: "Helvetica Neue",Helvetica,Arial,sans-serif;
|
font-family: monospace !important;
|
||||||
position: fixed;
|
max-width: min-content !important;
|
||||||
transition: opacity 0s linear 0.5s;
|
|
||||||
|
|
||||||
|
|
||||||
top: calc(var(--mouse-y) * 100vh - 30px);
|
|
||||||
left: calc(var(--mouse-x) * 100vw);
|
|
||||||
transform: translate(var(--tooltip_x), var(--tooltip_y_context)) !important;
|
|
||||||
opacity: 1;
|
|
||||||
|
|
||||||
|
|
||||||
padding: 0px 2px;
|
|
||||||
color: var(--tooltip_text);
|
|
||||||
background-color: var(--tooltip_background);
|
|
||||||
|
|
||||||
pointer-events: none;
|
|
||||||
z-index: 9999999;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Mobile tooltips */
|
/* Mobile tooltips */
|
||||||
@media (pointer: coarse), (hover: none) {
|
@media (pointer: coarse), (hover: none) {
|
||||||
[tooltip]:after {
|
[tooltip]:after {
|
||||||
|
@@ -4983,18 +4983,25 @@ let load_substitutions;
|
|||||||
const tooltip = $e("span", document.body, {id: "tooltip-text", "style.display": "none"});
|
const tooltip = $e("span", document.body, {id: "tooltip-text", "style.display": "none"});
|
||||||
let tooltipActive = false;
|
let tooltipActive = false;
|
||||||
|
|
||||||
function alterTooltipState(enabled) {
|
function alterTooltipState(enabled, specialClass=null) {
|
||||||
tooltipActive = enabled;
|
tooltipActive = enabled;
|
||||||
tooltip.style.display = enabled ? "block" : "none";
|
tooltip.style.display = enabled ? "block" : "none";
|
||||||
|
tooltip.className = specialClass || "";
|
||||||
}
|
}
|
||||||
|
|
||||||
function registerElement(el) {
|
function registerElement(el) {
|
||||||
// el should have attribute "tooltip"
|
// el should have attribute "tooltip"
|
||||||
let text = el.getAttribute("tooltip");
|
let text = el.getAttribute("tooltip");
|
||||||
|
el.setAttribute("wawawa", "yeah")
|
||||||
|
|
||||||
el.addEventListener("mouseenter", function(event) {
|
el.addEventListener("mouseenter", function(event) {
|
||||||
tooltip.innerText = text;
|
tooltip.innerText = text;
|
||||||
alterTooltipState(true);
|
let specialClass = null;
|
||||||
|
|
||||||
|
// Kinda lame
|
||||||
|
if (this.classList.contains("context-token")) specialClass = "tooltip-context-token";
|
||||||
|
|
||||||
|
alterTooltipState(true, specialClass);
|
||||||
});
|
});
|
||||||
|
|
||||||
el.addEventListener("mouseleave", function(event) {
|
el.addEventListener("mouseleave", function(event) {
|
||||||
@@ -5014,13 +5021,15 @@ let load_substitutions;
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Use a MutationObserver to catch future tooltips
|
// Use a MutationObserver to catch future tooltips
|
||||||
const observer = new MutationObserver(function(record, observer) {
|
const observer = new MutationObserver(function(records, observer) {
|
||||||
for (const node of record[0].addedNodes) {
|
for (const record of records) {
|
||||||
if (!node.hasAttribute("tooltip")) continue;
|
for (const node of record.addedNodes) {
|
||||||
registerElement(node);
|
if (node.nodeType !== 1 || !node.hasAttribute("tooltip")) continue;
|
||||||
|
registerElement(node);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
observer.observe(document.body, {childList: true});
|
observer.observe(document.body, {childList: true, subtree: true});
|
||||||
})();
|
})();
|
||||||
|
|
||||||
/* -- Shortcuts -- */
|
/* -- Shortcuts -- */
|
||||||
|
Reference in New Issue
Block a user