-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathroll20_character_sheet_no_scrolling_number_fields.user.js
68 lines (57 loc) · 2.62 KB
/
roll20_character_sheet_no_scrolling_number_fields.user.js
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
60
61
62
63
64
65
66
67
68
// ==UserScript==
// @name Roll20 Character Sheet No Scrolling Number Fields
// @namespace https://github.com/StaticPH
// @match https://app.roll20.net/editor/
// @match https://app.roll20.net/editor/popout
// @version 1.0
// @createdAt 1/23/2021
// @author StaticPH
// @description This should disable changing the value of any numeric fields on Roll20 character sheets by scrolling
// @license MIT
// @updateURL https://raw.githubusercontent.com/StaticPH/Userscripts/master/roll20_character_sheet_no_scrolling_number_fields.user.js
// @downloadURL https://raw.githubusercontent.com/StaticPH/Userscripts/master/roll20_character_sheet_no_scrolling_number_fields.user.js
// @homepageURL https://github.com/StaticPH/UserScripts
// @supportURL https://github.com/StaticPH/UserScripts/issues
// @icon https://app.roll20.net/favicon.ico
// @grant none
// @run-at document-end
// ==/UserScript==
(function(){
'use strict';
//TODO: MUTATION OBSERVERS!!!
// var classObserverCallback = function(mutations){
// for(let mutation of mutations){
// const classes = mutation.target.classList;
// if (classes.contains("right-column")){
// document.body.classList.toggle("ttc-theatre", classes.contains("right-column--theatre"));
// document.body.classList.toggle("ttc-rcol-collapsed", classes.contains("right-column--collapsed"));
// }
// }
// };
// var classObserver = new MutationObserver(classObserverCallback);
// function setupClassHelpers(){
// const col = document.querySelector(".right-column");
// if (!col){
// return false;
// }
// classObserver.observe(col, { attributes: true, attributeFilter: [ "class" ] });
// classObserverCallback([
// { target: col }
// ]);
// return true;
// }
setInterval(() => {
document.querySelectorAll(
'div.sheet-hp > input[type="number"] , div.sheet-spell-level > div.sheet-expended > input[type="number"] , ' +
'div.sheet-page.sheet-options div.sheet-row > input[type="number"][name="attr_default_critical_range"] , ' +
'div.sheet-row > input.sheet-class-level[type="number"] , ' +
'div.sheet-hdice-dsaves-container.sheet-old-hit-dice > div.sheet-subcontainer > input[type="number"] , ' +
'div.sheet-resources > div.sheet-hdice-dsaves-container > div.sheet-subcontainer > input[type="number"] , ' +
'div.repitem > div.sheet-hdice-dsaves-container > div.sheet-subcontainer > input[type="number"]'
).forEach(function(field){
field.onmousewheel = ()=>{return false;};
field.onwheel = ()=>{return false;};
console.log(field.name);
});
}, 3000);
})();