Skip to content

Commit

Permalink
Add copy button on /custom
Browse files Browse the repository at this point in the history
  • Loading branch information
jacebrowning committed Jan 12, 2017
1 parent ebfe2a4 commit ca6f4e6
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions memegen/templates/custom.html
Expand Up @@ -42,7 +42,10 @@

<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<input type="submit" class="btn btn-primary" id="btn-generate" value="Generate">
<input type="submit" class="btn btn-primary" id="btn-generate" value="Generate Image" />
<button type="button" class="btn btn-primary pull-right" id="btn-copy" data-toggle="tooltip" title="Copy link">
Copy Share Link
</button>
</div>
</div>
</form>
Expand All @@ -58,7 +61,7 @@
</div>

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>

<script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/1.5.16/clipboard.min.js"></script>
<script>
$("#meme-form").submit(false);

Expand All @@ -78,5 +81,11 @@
$('#meme-font').val("titilliumweb-black");
$('#meme-background').val("http://www.gstatic.com/webp/gallery/1.jpg");
$('#btn-generate').click();

var clipboard = new Clipboard('#btn-copy', {
text: function(trigger) {
return "https://memegen.link/" + $("#meme-image").attr('href') + "&share=true";
}
});
</script>
{% endblock %}

0 comments on commit ca6f4e6

Please sign in to comment.