From d2826ebd0a9620d276f7ed74345e9711e51f1b86 Mon Sep 17 00:00:00 2001 From: aptmac Date: Mon, 2 Sep 2024 22:54:14 -0400 Subject: [PATCH] fix(rolls): fix formatting of multi-dice type rolls going into TS (#3) --- extension/js/main.js | 2 +- extension/js/popup.js | 1 + extension/manifest.json | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/extension/js/main.js b/extension/js/main.js index 15a7c35..c59333d 100644 --- a/extension/js/main.js +++ b/extension/js/main.js @@ -107,7 +107,6 @@ document.addEventListener('keydown', function(e) { */ function determineRollType(element) { let rollName = getRollNameFromString(element.getAttribute("name")); - console.warn(rollName); if (rollName == "initiative") { return ROLL_TYPES.Initiative; } else if (rollName == "hit_dice") { @@ -267,5 +266,6 @@ function getAttackRollInformation(element) { function getDamageRollInformation(element) { let roll = element.getElementsByTagName("input")[0].value; modifier = parseDamageRollModifier(roll); + roll = roll.replace(/\s/g, ''); // TaleSpire does not like whitespaces in dice roll strings return new RollInformation(ROLL_TYPES.Damage, ROLL_TYPES.Damage, roll, modifier); } diff --git a/extension/js/popup.js b/extension/js/popup.js index 4e3367e..d601fe0 100644 --- a/extension/js/popup.js +++ b/extension/js/popup.js @@ -1,6 +1,7 @@ // Fetch the input data from the popup and send it to TaleSpire document.getElementById("submitButton").addEventListener("click", async function() { let roll = document.getElementById("rollInput").value + roll = roll.replace(/\s/g, ''); // TaleSpire does not like whitespaces in dice roll strings let rollName = document.getElementById("rollNameInput").value || `${roll}`; // Takes a look at the advantage toggles and determines what the roll query is diff --git a/extension/manifest.json b/extension/manifest.json index 457c2b1..ed2a95e 100644 --- a/extension/manifest.json +++ b/extension/manifest.json @@ -1,6 +1,6 @@ { "name": "Roll20 to TaleSpire", - "version": "0.0.1", + "version": "0.0.2", "description": "A TaleSpire companion application, used to send dice rolls from your Roll20 character sheet directly into your TaleSpire dice tray.", "manifest_version": 3, "author": "aptmac",