fixed copy to clipboard

This commit is contained in:
Uvis Grinfelds 2014-11-06 17:52:35 +01:00
parent 7249b90d7c
commit 9f87fb789f
2 changed files with 5 additions and 12 deletions

View file

@ -51,15 +51,7 @@ include "includes/head.html"
<br/>
<div>
<a href="#" id="copy-link-btn" class="btn-cta btn">copy link</a> &nbsp;&nbsp;
<a href="{{.Url}}" class="btn-cta btn"> download</i> </a>
<div id="copy-link-wrapper" class="copy-link-wrapper">
<p>Press Ctrl / CMD + C to copy link to your clipboard.</p>
<input readonly="readonly" type="text" value="{{.Url}}" />
</div>
<div id="overlay" class="overlay"></div>
</div>
include "includes/download-btn.html"
</section>

View file

@ -109,6 +109,7 @@ $(document).ready(function() {
copylink = document.getElementById("copy-link-wrapper"),
overlay = document.getElementById("overlay");
var url = "http://url"
copylinkbtn.addEventListener("click", function() {
var error = document.getElementsByClassName('error');
@ -119,9 +120,9 @@ $(document).ready(function() {
document.body.className += ' active';
copylink.children[2].value = window.location.href;
copylink.children[2].focus();
copylink.children[2].select();
copylink.children[1].value = url;
copylink.children[1].focus();
copylink.children[1].select();
}, false);
overlay.addEventListener("click", function() {