Skip to content

Instantly share code, notes, and snippets.

@Delivator
Last active July 10, 2018 21:07
Show Gist options
  • Save Delivator/091d7aa72e785782a351fe9bcd7f7e1a to your computer and use it in GitHub Desktop.
Save Delivator/091d7aa72e785782a351fe9bcd7f7e1a to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name Skribbl drawing downloader
// @namespace https://delivator.me/
// @version 0.4
// @description Adds a button to skribbl.io to save the drawing
// @author Delivator
// @match https://skribbl.io/*
// @grant none
// @homepage https://gist.github.com/Delivator/091d7aa72e785782a351fe9bcd7f7e1a
// @icon https://skribbl.io/res/favicon.png
// ==/UserScript==
(function () {
'use strict';
$(document).ready(() => {
const button = $('<a href="#" download="" id="btnSaveImage" role="button" class="btn btn-info" style="position: fixed; top: 60px; left: 10px;">Save drawing</a>');
const canvas = document.getElementById("canvasGame");
const body = $("body");
body.append(button);
button.click(() => {
const filename = "drawing_" + new Date().getTime() + ".png";
button.attr("href", canvas.toDataURL("image/png"));
button.attr("download", filename);
});
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment