mirror of
https://github.com/BetterSEQTA/BetterSEQTA-Plus.git
synced 2026-06-06 03:34:40 +00:00
chore: clean comments
This commit is contained in:
+2
-10
@@ -749,27 +749,19 @@ export async function ObserveMenuItemPosition() {
|
|||||||
const node = element as HTMLElement;
|
const node = element as HTMLElement;
|
||||||
if (!node?.dataset?.checked && !MenuOptionsOpen) {
|
if (!node?.dataset?.checked && !MenuOptionsOpen) {
|
||||||
const key = MenuitemSVGKey[node?.dataset?.key! as keyof typeof MenuitemSVGKey];
|
const key = MenuitemSVGKey[node?.dataset?.key! as keyof typeof MenuitemSVGKey];
|
||||||
console.log("Key: ", key)
|
|
||||||
if (key) {
|
if (key) {
|
||||||
console.log('replacing!')
|
|
||||||
ReplaceMenuSVG(
|
ReplaceMenuSVG(
|
||||||
node,
|
node,
|
||||||
MenuitemSVGKey[node.dataset.key as keyof typeof MenuitemSVGKey],
|
MenuitemSVGKey[node.dataset.key as keyof typeof MenuitemSVGKey],
|
||||||
);
|
);
|
||||||
} else if (node?.firstChild?.nodeName === 'LABEL') {
|
} else if (node?.firstChild?.nodeName === 'LABEL') {
|
||||||
// Assuming `node` is an <li> element containing a <label>
|
|
||||||
const label = node.firstChild as HTMLElement;
|
const label = node.firstChild as HTMLElement;
|
||||||
|
|
||||||
// The magical step: We find the last child. If it's a text node, embrace it with <span>
|
|
||||||
let textNode = label.lastChild as HTMLElement;
|
let textNode = label.lastChild as HTMLElement;
|
||||||
|
|
||||||
// A quick check to ensure it's a text node and not already ensconced in a <span>
|
|
||||||
if (textNode.nodeType === 3 && textNode.parentNode && textNode.parentNode.nodeName !== 'SPAN') {
|
if (textNode.nodeType === 3 && textNode.parentNode && textNode.parentNode.nodeName !== 'SPAN') {
|
||||||
// The text node is indeed bare, and not in a <span>. Time to act!
|
const span = document.createElement('span');
|
||||||
const span = document.createElement('span'); // The creation of the <span>
|
span.textContent = textNode.nodeValue;
|
||||||
span.textContent = textNode.nodeValue; // Transferring the text
|
|
||||||
|
|
||||||
// Replacing the text node with our newly minted <span> full of text
|
|
||||||
label.replaceChild(span, textNode);
|
label.replaceChild(span, textNode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user