mirror of
https://gitgud.io/BondageProjects/Bondage-College.git
synced 2025-04-25 17:59:34 +00:00
MAINT: Use hidden spans rather than copy
event listeners for handling chat room header copies
The previous listener could not handle partial selections
This commit is contained in:
parent
754076b594
commit
eaa2807009
2 changed files with 6 additions and 21 deletions
BondageClub
|
@ -47,6 +47,10 @@
|
|||
margin-block: 0.1em;
|
||||
}
|
||||
|
||||
.chat-room-sep-image > span {
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.chat-room-no-copy {
|
||||
user-select: none;
|
||||
}
|
||||
|
|
|
@ -913,25 +913,6 @@ var ChatRoomSep = {
|
|||
*/
|
||||
ActiveElem: null,
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {(this: HTMLDivElement, event: ClipboardEvent) => void}
|
||||
*/
|
||||
_CopyHeader: function _CopyHeader(ev) {
|
||||
let txt = "";
|
||||
for (const el of this.childNodes) {
|
||||
if (!(el instanceof Element)) {
|
||||
txt += el.textContent;
|
||||
continue;
|
||||
} else if (el.classList.contains("chat-room-no-copy")) {
|
||||
continue;
|
||||
}
|
||||
txt += el.textContent || (el.getAttribute("aria-label") ?? "");
|
||||
}
|
||||
ev.clipboardData.setData("text/plain", txt);
|
||||
ev.preventDefault();
|
||||
},
|
||||
|
||||
/**
|
||||
* Click event listener for collapsing one or more chat room separators
|
||||
* @private
|
||||
|
@ -979,7 +960,7 @@ var ChatRoomSep = {
|
|||
attributes: { role: "img", "aria-label": InterfaceTextGet(`ChatRoomSpace${button.dataset.space || "F"}`) },
|
||||
classList: ["chat-room-sep-image"],
|
||||
style: { mask: `url(${namespace.src}) center/contain` },
|
||||
eventListeners: { copy: ChatRoomSep._CopyImage },
|
||||
children: [{ tag: "span", children: [InterfaceTextGet(`ChatRoomSpace${button.dataset.space || "F"}`)] }],
|
||||
}),
|
||||
" - ",
|
||||
] : undefined,
|
||||
|
@ -989,7 +970,7 @@ var ChatRoomSep = {
|
|||
attributes: { role: "img", "aria-label": InterfaceTextGet("Private") },
|
||||
classList: ["chat-room-sep-image"],
|
||||
style: { mask: `url(${FriendListIconMapping.Private.src}) center/contain` },
|
||||
eventListeners: { copy: ChatRoomSep._CopyImage },
|
||||
children: [{ tag: "span", children: [InterfaceTextGet("Private")] }],
|
||||
}),
|
||||
" - ",
|
||||
] : undefined,
|
||||
|
|
Loading…
Add table
Reference in a new issue