diff --git a/Library/0BDFDB.plugin.js b/Library/0BDFDB.plugin.js index e801ae609a..0dafbbcab3 100644 --- a/Library/0BDFDB.plugin.js +++ b/Library/0BDFDB.plugin.js @@ -1505,14 +1505,8 @@ module.exports = (_ => { text = typeof text == "function" ? text() : text; if (typeof text != "string" && !BDFDB.ReactUtils.isValidElement(text) && !BDFDB.ObjectUtils.is(config.guild)) return null; let id = BDFDB.NumberUtils.generateId(Tooltips); - let zIndexed = typeof config.zIndex == "number"; + let zIndexed = config.zIndex && typeof config.zIndex == "number"; let itemLayer = BDFDB.DOMUtils.create(`
`); - if (zIndexed) { - let itemLayerContainerClone = itemLayerContainer.cloneNode(); - itemLayerContainerClone.style.setProperty("z-index", config.zIndex || 1002, "important"); - itemLayerContainer.parentElement.insertBefore(itemLayerContainerClone, itemLayerContainer.nextElementSibling); - itemLayerContainer = itemLayerContainerClone; - } itemLayerContainer.appendChild(itemLayer); let tooltip = itemLayer.firstElementChild; @@ -1538,10 +1532,12 @@ module.exports = (_ => { style = (style ? (style + " ") : "") + `background: ${backgroundColor} !important; border-color: ${backgroundColorIsGradient ? BDFDB.ColorUtils.convert(config.backgroundColor[type == "left" ? 100 : 0], "RGBA") : backgroundColor} !important;`; } if (style) tooltip.style = style; + const zIndexed = config.zIndex && typeof config.zIndex == "number"; if (zIndexed) { - itemLayer.style.setProperty("z-index", config.zIndex || 1002, "important"); - tooltip.style.setProperty("z-index", config.zIndex || 1002, "important"); - tooltipContent.style.setProperty("z-index", config.zIndex || 1002, "important"); + itemLayer.style.setProperty("z-index", config.zIndex, "important"); + tooltip.style.setProperty("z-index", config.zIndex, "important"); + tooltipContent.style.setProperty("z-index", config.zIndex, "important"); + BDFDB.DOMUtils.addClass(itemLayerContainer, BDFDB.disCN.itemlayercontainerzindexdisabled); } if (typeof config.width == "number" && config.width > 196) { tooltip.style.setProperty("width", `${config.width}px`, "important"); @@ -1560,7 +1556,7 @@ module.exports = (_ => { let parent = e.target.parentElement.querySelector(":hover"); if (parent && anker != parent && !anker.contains(parent)) itemLayer.removeTooltip(); }; - let mouseLeave = e => {itemLayer.removeTooltip();}; + let mouseLeave = e => itemLayer.removeTooltip(); if (!config.perssist) { document.addEventListener("mousemove", mouseMove); document.addEventListener("mouseleave", mouseLeave); @@ -1655,7 +1651,7 @@ module.exports = (_ => { BDFDB.DOMUtils.remove(itemLayer); BDFDB.ArrayUtils.remove(Tooltips, id); observer.disconnect(); - if (zIndexed) BDFDB.DOMUtils.remove(itemLayerContainer); + if (zIndexed) BDFDB.DOMUtils.removeClass(itemLayerContainer, BDFDB.disCN.itemlayercontainerzindexdisabled); if (typeof config.onHide == "function") config.onHide(itemLayer, anker); }); (tooltip.update = itemLayer.update = newText => { diff --git a/Library/_res/BDFDB.data.json b/Library/_res/BDFDB.data.json index 418f64d233..9c6ebb6f50 100644 --- a/Library/_res/BDFDB.data.json +++ b/Library/_res/BDFDB.data.json @@ -557,6 +557,11 @@ "inputNumberWrapper": "numberInputWrapper-j4svZS", "inputNumberWrapperDefault": "numberInputWrapperDefault-gRxcuK numberInputWrapper-j4svZS", "inputNumberWrapperMini": "numberInputWrapperMini-wtUU31 numberInputWrapper-j4svZS", + "layerContainerZIndexDisabled": "zIndexDisabled-Pf4Txx", + "listInput": "listInput-11g5Sr", + "listInputDelete": "delete-M_nPTt", + "listInputItem": "item-wGC8aX", + "listInputItems": "items-D9PGwH", "listRow": "listRow-7SfZww", "loadingIcon": "loadingIcon-cOYMPl", "loadingIconWrapper": "loadingIconWrapper-PsVJ9m", @@ -573,10 +578,6 @@ "paginationTop": "top-v-18jZ", "popoutWrapper": "popout-xwjvsX", "quickSelectWrapper": "quickSelectWrapper-UCfTKz", - "listInput": "listInput-11g5Sr", - "listInputDelete": "delete-M_nPTt", - "listInputItem": "item-wGC8aX", - "listInputItems": "items-D9PGwH", "marginLeft4": "marginLeft4-58StzA", "marginLeft8": "marginLeft8-3RhhAa", "menuColorCustom": "colorCustom-44asd2", @@ -2032,6 +2033,7 @@ "imagezoom": ["ImageWrapper", "imageZoom"], "itemlayer": ["ItemLayerContainer", "layer"], "itemlayercontainer": ["ItemLayerContainer", "layerContainer"], + "itemlayercontainerzindexdisabled": ["BDFDB", "layerContainerZIndexDisabled"], "itemlayerdisabledpointerevents": ["ItemLayerContainer", "disabledPointerEvents"], "input": ["Input", "input"], "inputdefault": ["Input", "inputDefault"], diff --git a/Library/_res/BDFDB.raw.css b/Library/_res/BDFDB.raw.css index 9e6d2b1d55..a49cc58ae6 100644 --- a/Library/_res/BDFDB.raw.css +++ b/Library/_res/BDFDB.raw.css @@ -8,6 +8,12 @@ img:not([src]), img[src=""], img[src="null"] { opacity: 0; } +[REPLACE_CLASS_itemlayercontainerzindexdisabled] { + z-index: unset; +} +[REPLACE_CLASS_itemlayercontainerzindexdisabled] > * { + z-index: 1002; +} [REPLACE_CLASS_itemlayer] ~ [REPLACE_CLASS_itemlayer] [REPLACE_CLASS_menu] { z-index: 1001; }