new version & migrate from github

This commit is contained in:
CPTN Cosmo 2026-02-10 22:43:11 +01:00
parent 2917a402ab
commit 1b8e9e00a6
No known key found for this signature in database
2 changed files with 26 additions and 23 deletions

View file

@ -2,7 +2,7 @@
"id": "duality-roller", "id": "duality-roller",
"title": "Daggerheart Duality Dice Roller", "title": "Daggerheart Duality Dice Roller",
"description": "Adds a button next to the chat dice/controls that triggers the /dr command for the Foundryborne Daggerheart system.", "description": "Adds a button next to the chat dice/controls that triggers the /dr command for the Foundryborne Daggerheart system.",
"version": "0.1.5", "version": "0.1.6",
"compatibility": { "compatibility": {
"minimum": "13", "minimum": "13",
"verified": "13" "verified": "13"
@ -16,5 +16,5 @@
"languages": [], "languages": [],
"url": "https://github.com/cptn-cosmo/DualityDiceRoller", "url": "https://github.com/cptn-cosmo/DualityDiceRoller",
"manifest": "https://github.com/cptn-cosmo/DualityDiceRoller/releases/latest/download/module.json", "manifest": "https://github.com/cptn-cosmo/DualityDiceRoller/releases/latest/download/module.json",
"download": "https://github.com/cptn-cosmo/DualityDiceRoller/releases/download/0.1.5/duality-roller.zip" "download": "https://github.com/cptn-cosmo/DualityDiceRoller/releases/download/0.1.6/duality-roller.zip"
} }

View file

@ -15,6 +15,12 @@ Hooks.on("renderChatPopout", (_app, _html) => addDRButton());
function addDRButton() { function addDRButton() {
try { try {
// Find all roll-privacy divs and append one button per container, avoiding duplicates
const rollPrivacyDivs = document.querySelectorAll("#roll-privacy");
rollPrivacyDivs.forEach(div => {
// If this container already has our button, skip adding another
if (div.querySelector(".dr-quick-button-container")) return;
const container = document.createElement("div"); const container = document.createElement("div");
container.className = "dr-quick-button-container"; container.className = "dr-quick-button-container";
@ -26,17 +32,14 @@ function addDRButton() {
btn.setAttribute("aria-label", "Duality Dice Roll"); btn.setAttribute("aria-label", "Duality Dice Roll");
// Inline SVG (or use icon.src = "modules/dr-quick-button/icons/dr.svg"; if external) // Inline SVG (or use icon.src = "modules/dr-quick-button/icons/dr.svg"; if external)
btn.innerHTML = `<img src="systems/daggerheart/assets/icons/dice/duality/Daggerheart Foundry_g489.png" alt="DR" style="width:12px; height:16px;"> btn.innerHTML = `<img src="systems/daggerheart/assets/icons/dice/duality/Daggerheart Foundry_g489.png" alt="DR" style="width:12px; height:16px;">`;
`;
btn.addEventListener("click", async () => { btn.addEventListener("click", async () => {
await runDRCommand(); await runDRCommand();
}); });
container.appendChild(btn); container.appendChild(btn);
div.appendChild(container);
// Find all roll-privacy divs and append the button });
const rollPrivacyDivs = document.querySelectorAll("#roll-privacy");
rollPrivacyDivs.forEach(div => div.appendChild(container));
} catch (err) { } catch (err) {
console.error("DR Quick Button | addDRButton error:", err); console.error("DR Quick Button | addDRButton error:", err);