Skip to content

Instantly share code, notes, and snippets.

@Joehoel
Created September 7, 2021 21:12
Show Gist options
  • Save Joehoel/45ef89d0dd4f4db290fab1e77e4ae42e to your computer and use it in GitHub Desktop.
Save Joehoel/45ef89d0dd4f4db290fab1e77e4ae42e to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name Get glade
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://amazing.hbo-ict.org/*
// @icon https://www.google.com/s2/favicons?domain=tampermonkey.net
// @require http://code.jquery.com/jquery-3.4.1.min.js
// @grant none
// ==/UserScript==
(function() {
'use strict';
jQuery(document).ready(function () {
let translate = {
stone: "q",
bomb: "x",
black: "l",
blue: "b",
bonus: "m",
bush: "q",
debris: "q",
goal: "t",
gray: "g",
green: "e",
orange: "o",
purple: "p",
red: "r",
start: "s",
turn: "d",
white: "w",
wood: "q",
yellow: "y",
};
let colors = ["black", "purple", "blue", "green", "yellow", "orange", "red", "gray", "white"];
let output = "";
let rows = jQuery(".field-container > .field-row");
rows.map(function (i, row) {
jQuery(row)
.find(".field-block")
.map(function (i, col) {
let img = jQuery(col).children("img").get(0);
let type = translate[jQuery(img).attr("type")];
let value = jQuery(img).attr("value");
if (type === undefined) {
if (jQuery(img).attr("type") === "color") {
type = translate[colors[value]];
}
}
output += type;
if (["x", "t", "m", "d", "s"].includes(type)) {
output += value;
}
if (i < 19) output += ";";
});
output += "\n";
});
console.log(output);
navigator.clipboard.writeText(output);
console.log("Copied output to clipboard");
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment