-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.js
More file actions
29 lines (26 loc) · 1.12 KB
/
main.js
File metadata and controls
29 lines (26 loc) · 1.12 KB
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
// window.onload = function(){
let observer = new MutationObserver(mutations=>{
mutations.forEach((mutation)=>{
console.log(mutation);
if(mutation.addedNodes.length > 0){
const rollName = mutation.addedNodes[0]?.querySelector('h3').textContent;
const traitRoll = mutation.addedNodes[0]?.querySelector('.sheet-trollLeft');
const wildRoll = mutation.addedNodes[0]?.querySelector('.sheet-trollRight');
const rolls = [traitRoll, wildRoll]
let results = '';
rolls.forEach(roll=>{
const label = roll.querySelector('.sheet-rollLabel').textContent;
const rollResult = roll.querySelector('.inlinerollresult').textContent;
results = `::: ${results} ${label} ${rollResult}`
})
result = `${rollName} ${results}`
console.log(result);
} else {
return;
}
})
})
observer.observe(document.querySelector('#textchat > .content'), {
childList : true
});
// }