Stevenator1 / /r/place Downloader

// ==UserScript==
// @name         /r/place Downloader
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Adds a button to download the raw image from /r/place
// @author       Stevenator1
// @match        https://www.reddit.com/place?webview=true*
// @match        https://www.reddit.com/r/place/
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    var button = document.createElement('button');
    button.style="z-index:999;display:float;position: absolute;left: 60px;top: 10px;";
    button.innerHTML="Download Image";
    button.style.border = "thick solid #FF0000";
    var body = document.body;
    var place = document.getElementById('place');
    var canvas = document.getElementById("place-canvasse");
    body.appendChild(button,0);
    button.onclick = function() {
        var canvasImg = document.createElement('img');

        var dataURL = canvas.toDataURL('image/png');
        var link = document.createElement("a");
        link.download = "place_image";
        link.href = dataURL;
        document.body.appendChild(link);
        link.click();
        document.body.removeChild(link);
        /*
        canvasImg.src = dataURL;
        while (body.hasChildNodes()) {
            body.removeChild(body.lastChild);
        }
        body.appendChild(canvasImg);
        */
    };
})();