-
Notifications
You must be signed in to change notification settings - Fork 0
/
code.txt
59 lines (44 loc) · 1.66 KB
/
code.txt
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
var dialog = document.querySelector("#dicerollerdialog");
var btn = dialog.querySelectorAll("h3")[1];
btn.innerHTML = "Roll Initiative";
btn.style.cursor = "pointer";
var sendCommand = function(cmd) {
var ta = document.querySelector("#textchat-input > textarea");
ta.value = cmd;
var snd = document.querySelector("#textchat-input .btn");
snd.click();
};
btn.addEventListener("click", function() {
sendCommand("/roll 1d20 + 6 &{tracker}");
});
var toolbar = document.querySelector("#floatingtoolbar ul");
var rollDaggerHit = document.createElement("li");
rollDaggerHit.innerHTML = "Dag/Hit";
rollDaggerHit.setAttribute("style","font-size:10px;");
var rollDaggerDam = document.createElement("li");
rollDaggerDam.setAttribute("style","font-size:10px;");
rollDaggerDam.innerHTML="DagCrit";
var rollBowDam = document.createElement("li");
rollBowDam.setAttribute("style","font-size:10px;");
rollBowDam.innerHTML = "BowDam";
var rollRapierHit = document.createElement("li");
rollRapierHit.setAttribute("style","font-size:10px;");
rollRapierHit.innerHTML = "RapHit";
rollDaggerHit.addEventListener("click", function() {
sendCommand("/roll 1d20+9");
});
rollRapierHit.addEventListener("click", function() {
sendCommand("/roll 1d20+8");
});
rollDaggerDam.addEventListener("click", function() {
sendCommand("/roll 1d4+5+1d6+5d6");
});
rollBowDam.addEventListener("click", function() {
sendCommand("/roll 1d8+5+5d6");
});
toolbar.appendChild(rollDaggerHit);
toolbar.appendChild(rollDaggerDam);
toolbar.appendChild(rollBowDam);
toolbar.appendChild(rollRapierHit);
document.querySelector("#floatingtoolbar").style.width = "60px";
document.querySelector(".dark-mode-switch").style.display = "none";