Created
August 28, 2021 18:20
-
-
Save Andersgee/258c59e4faf23a7949de3894a5af69c6 to your computer and use it in GitHub Desktop.
[greasemonkey script] A button for running the code-sync command on yare.io
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 YareCodeSyncButton | |
// @namespace https://yare.io/ | |
// @include https://yare.io/d1/* | |
// @version 1 | |
// ==/UserScript== | |
//Create a button | |
var input = document.createElement("input"); | |
input.type="button"; | |
//Style it | |
input.value="Code Sync"; | |
input.style.position = "absolute"; | |
input.style.right = "20px"; | |
input.style.top = "9ch"; | |
input.style.background = "#2a1e1d"; | |
input.style.padding = "10px 16px 10px 16px"; | |
input.style.color = "#af6565"; | |
input.onmouseover = () => input.style.color = "#ea8585e3" | |
input.onmouseleave = () => input.style.color = "#af6565" | |
input.style["border-style"]= "none" | |
input.style["border-radius"]= "8px" | |
input.style["font-family"] = '"Montserrat", sans-serif' | |
input.style["font-size"] = "14px" | |
input.style["font-weight"] = 500 | |
input.style.cursor = "pointer" | |
//The actual code-sync call (see: https://github.com/arikwex/yare-code-sync) | |
input.onclick = () => fetch('http://localhost:4000/code-sync').then((r)=>r.json()).then(unsafeWindow.eval) | |
document.body.appendChild(input); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment