Skip to content

Commit

Permalink
Add ability to download directly in browser
Browse files Browse the repository at this point in the history
  • Loading branch information
gillstrom committed May 15, 2016
1 parent addb11c commit d73a80d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ function reload (config) {
background.onload = () => {
var renderer = createRenderer(opts);

document.querySelector('.download').onclick = () => window.open(canvas.toDataURL(), '_blank')

if (opts.debugLuma) {
renderer.debugLuma();
} else {
Expand Down
6 changes: 6 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,14 @@
.seed-text {
font-weight: 700;
}
.download,
.howto {
font-size: 9px;
}
.download:hover {
text-decoration: underline;
cursor: pointer;
}
#fill {
cursor: pointer;
position: absolute;
Expand All @@ -51,6 +56,7 @@
<header class="seed-container">
<div>seed – <span class="seed-text">12380</span></div>
<div class="howto">tap to randomize</div>
<div class="download">download image</div>
</header>
<script src="bundle.js"></script>
</body>
Expand Down

0 comments on commit d73a80d

Please sign in to comment.