-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathp2c.js
More file actions
25 lines (18 loc) · 872 Bytes
/
Copy pathp2c.js
File metadata and controls
25 lines (18 loc) · 872 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
Hooks.on("renderImagePopout", (html) => {
// Create a new button element
const img2ChatBtn = document.createElement("a");
// Set the class and icon for the button
img2ChatBtn.className = "send-img2chat";
img2ChatBtn.innerHTML = '<i class="fa-solid fa-share-from-square"></i> img2Chat';
// Add an event listener to handle button clicks
img2ChatBtn.addEventListener("click", () => {
let dialogContent = `<img style="border:none;" src="${html.object}" >`;
ChatMessage.create({
content: dialogContent,
});
});
// Find the existing element with class "window-title"
const img2ChatBtnAfterEnd = document.querySelector('.image-popout .window-header .window-title');
// Insert img2ChatBtn after the windowTitleElement
img2ChatBtnAfterEnd.insertAdjacentElement('afterend', img2ChatBtn);
});