diff --git a/on-site-vtt/module.json b/on-site-vtt/module.json index 9d76081..8b8368e 100644 --- a/on-site-vtt/module.json +++ b/on-site-vtt/module.json @@ -2,7 +2,7 @@ "id": "on-site-vtt", "title": "On-Site VTT - Virtual Tabletop, now with less virtual", "description": "A simple module adding functionality to improve playability for multiple players on a single screen/digital map.", - "version": "0.0.5", + "version": "0.0.6", "compatibility": { "minimum": "10", "verified": "11" @@ -27,7 +27,7 @@ ], "url": "https://gitea.aweleczka.de/aweleczka/On-Site-VTT", "manifest": "https://gitea.aweleczka.de/aweleczka/On-Site-VTT/raw/branch/main/on-site-vtt/module.json", - "download": "https://gitea.aweleczka.de/aweleczka/On-Site-VTT/archive/0.0.5.zip", + "download": "https://gitea.aweleczka.de/aweleczka/On-Site-VTT/archive/0.0.6.zip", "bugs": "https://gitea.aweleczka.de/aweleczka/On-Site-VTT/issues", "readme": "https://gitea.aweleczka.de/aweleczka/On-Site-VTT/raw/branch/main/README.md", "license" :"https://gitea.aweleczka.de/aweleczka/On-Site-VTT/raw/branch/main/LICENSE.txt", diff --git a/on-site-vtt/scripts/on-site-vtt.js b/on-site-vtt/scripts/on-site-vtt.js index f2e9750..de036f3 100644 --- a/on-site-vtt/scripts/on-site-vtt.js +++ b/on-site-vtt/scripts/on-site-vtt.js @@ -1,7 +1,8 @@ -if(game.modules.get("on-site-vtt")?.active) { - console.log("on-site-vtt active"); - Hooks.on("init", function () { +function inti() { + if (game.modules.get("on-site-vtt")?.active) { + console.log("on-site-vtt | Enabled"); + Hooks.on( "getSceneControlButtons", (controls: SceneControl[]) => { @@ -15,16 +16,22 @@ if(game.modules.get("on-site-vtt")?.active) { button: true, onClick: () => rotateView(), }); + console.log("on-site-vtt | Added control button"); }); - }); + } else { + console.log("on-site-vtt | Disabled"); + } } + function rotateView() { - if(document.getElementsByTagName("body")[0].className.includes("nsvRotate")) { - document.getElementsByTagName("body")[0].className = document.getElementsByTagName("body")[0].className.replace( /(?:^|\s)nsvRotate(?!\S)/g , '' ) - document.getElementById("board").className = document.getElementById("board").className.replace( /(?:^|\s)nsvRotate(?!\S)/g , '' ) + if (document.getElementsByTagName("body")[0].className.includes("nsvRotate")) { + document.getElementsByTagName("body")[0].className = document.getElementsByTagName("body")[0].className.replace(/(?:^|\s)nsvRotate(?!\S)/g, '') + document.getElementById("board").className = document.getElementById("board").className.replace(/(?:^|\s)nsvRotate(?!\S)/g, '') } else { document.getElementsByTagName("body")[0].className += " nsvRotate"; document.getElementById("board").className += " nsvRotate"; } -} \ No newline at end of file +} + +Hooks.on("init", init); \ No newline at end of file