Skip to content

Instantly share code, notes, and snippets.

@Andersgee
Created August 28, 2021 18:20
Show Gist options
  • Save Andersgee/258c59e4faf23a7949de3894a5af69c6 to your computer and use it in GitHub Desktop.
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
// ==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