MCPcopy Create free account
hub / github.com/Revadike/Misc-JavaScript-Projects / monitorInGameStatus

Function monitorInGameStatus

DIM - Auto Ghost Switcher.user.js:80–99  ·  view source on GitHub ↗
(ghosts)

Source from the content-addressed store, hash-verified

78 }
79
80 function monitorInGameStatus(ghosts) {
81 var currentArea = null;
82 var monitor = setInterval(() => {
83 GM.xmlHttpRequest({
84 method: "GET",
85 url: "https://steamcommunity.com/miniprofile/" + STEAMID3 + "?t=" + Date.now(),
86 onload: (response) => {
87 var html = response.responseText;
88 var parser = new DOMParser();
89 var doc = parser.parseFromString(html, "text/html")
90 var area = getD2Area(doc);
91 if (!area || currentArea === area) { return; }
92
93 console.log(area);
94 currentArea = area;
95 pickGhost(ghosts, area);
96 }
97 });
98 }, INTERVAL * 1000);
99 }
100
101 function doubleClick(elem) {
102 var event = new MouseEvent("dblclick", {

Callers 1

initGhostSwitcherFunction · 0.85

Calls 2

getD2AreaFunction · 0.85
pickGhostFunction · 0.85

Tested by

no test coverage detected