X-Git-Url: https://git.p6c8.net/jirafeau_mojo42.git/blobdiff_plain/75c98902b1f1be9a4cd1429886c3089c568e532b..bb8be3e5ee423aae47f500f7aa12cdeecc1b0f77:/lib/functions.js.php diff --git a/lib/functions.js.php b/lib/functions.js.php index 542000b..d552cd8 100644 --- a/lib/functions.js.php +++ b/lib/functions.js.php @@ -119,7 +119,7 @@ function show_link (reference, delete_code, crypt_key, date) document.getElementById('uploading').style.display = 'none'; document.getElementById('upload').style.display = 'none'; document.getElementById('upload_finished').style.display = ''; - document.title = 'Jirafeau - 100%'; + document.title = " - 100%"; // Download page var download_link_href = 'f.php?h=' + reference; @@ -203,7 +203,7 @@ function show_upload_progression (percentage, speed, time_left) document.getElementById('uploaded_percentage').innerHTML = percentage; document.getElementById('uploaded_speed').innerHTML = speed; document.getElementById('uploaded_time').innerHTML = time_left; - document.title = 'Jirafeau - ' + percentage; + document.title = " - " + percentage; } function hide_upload_progression () @@ -211,7 +211,7 @@ function hide_upload_progression () document.getElementById('uploaded_percentage').style.display = 'none'; document.getElementById('uploaded_speed').style.display = 'none'; document.getElementById('uploaded_time').style.display = 'none'; - document.title = 'Jirafeau'; + document.title = ""; } function upload_progress (e) @@ -710,3 +710,25 @@ document.addEventListener('DOMContentLoaded', function(event) { // Search for all datetime fields and convert the time to local timezone convertAllDatetimeFields(); }); + +// Add copy event listeners +function copyLinkToClipboard(link_id) { + var focus = document.activeElement; + var e = document.getElementById(link_id); + + var tmp = document.createElement("textarea"); + document.body.appendChild(tmp); + tmp.textContent = e.href; + tmp.focus(); + tmp.setSelectionRange(0, tmp.value.length); + document.execCommand("copy"); + document.body.removeChild(tmp); + + focus.focus(); +} + +function addCopyListener(button_id, link_id) { + document.getElementById(button_id) + .addEventListener("click", function() { + copyLinkToClipboard(link_id);}); +}