Created
April 25, 2020 18:25
-
-
Save madox2/2d165dc1285cc5fd7e71b0011a316123 to your computer and use it in GitHub Desktop.
Enables auto-end turn for KDice
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name KDice Auto-end turn | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description Auto-end turn for KDice | |
// @author You | |
// @match https://kdice.com/* | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
function showAutoEndTurn() { | |
var xpath = "//label[text()='Auto end turn']"; | |
var label = document.evaluate(xpath, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue | |
if (label) { | |
label.parentElement.style.margin = '0px 10px' | |
label.parentElement.style.display = 'block' | |
} | |
} | |
function init() { | |
const controls = document.querySelector('.iogc-Controls') | |
if (!controls) { | |
// wait for dom to load | |
setTimeout(init, 1000) | |
return | |
} | |
const observer = new MutationObserver(showAutoEndTurn) | |
const config = { attributes: true, childList: true, subtree: true } | |
observer.observe(controls, config) | |
showAutoEndTurn() | |
} | |
init() | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment