diff options
| author | David Siegfried <david.siegfried@uni-vechta.de> | 2022-10-19 09:43:22 +0000 |
|---|---|---|
| committer | David Siegfried <david.siegfried@uni-vechta.de> | 2022-10-19 09:43:22 +0000 |
| commit | aa096c09faa3c0d1c63c356709f5cb35c26850ec (patch) | |
| tree | 9ba251f3144bd25a65d41be36503c759c92c5fc5 /resources/assets/javascripts/bootstrap/copyable_links.js | |
| parent | 00028bc455146aac8113be750a4165153f8a8fb4 (diff) | |
refine copy-link-message, closes #486
Closes #486
Merge request studip/studip!924
Diffstat (limited to 'resources/assets/javascripts/bootstrap/copyable_links.js')
| -rw-r--r-- | resources/assets/javascripts/bootstrap/copyable_links.js | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/resources/assets/javascripts/bootstrap/copyable_links.js b/resources/assets/javascripts/bootstrap/copyable_links.js index f8aa280..e41d064 100644 --- a/resources/assets/javascripts/bootstrap/copyable_links.js +++ b/resources/assets/javascripts/bootstrap/copyable_links.js @@ -6,7 +6,7 @@ $(document).on('click', 'a.copyable-link', function (event) { // Create dummy element and position it off screen // This element must be "visible" (as in "not hidden") or otherwise // the copy command will fail - var dummy = $('<textarea>').val(this.href).css({ + let dummy = $('<textarea>').val(this.href).css({ position: 'absolute', left: '-9999px' }).appendTo('body'); @@ -19,15 +19,13 @@ $(document).on('click', 'a.copyable-link', function (event) { // Show visual hint using a deferred (this way we don't need to // duplicate the functionality in the done() handler) (new Promise((resolve, reject) => { - var confirmation = $('<div class="copyable-link-confirmation">'); + let confirmation = $('<div class="copyable-link-confirmation copyable-link-success">'); confirmation.text($gettext('Link wurde kopiert')); - confirmation.insertBefore(this); - - $(this).parent().addClass('copyable-link-animation'); + confirmation.insertBefore('#layout_container'); // Resolve deferred when animation has ended or after 2 seconds as a // fail safe - var timeout = setTimeout(() => { + let timeout = setTimeout(() => { $(this).parent().off('animationend'); resolve(confirmation); }, 1500); @@ -37,6 +35,5 @@ $(document).on('click', 'a.copyable-link', function (event) { }); })).then((confirmation, parent) => { confirmation.remove(); - $(this).parent().removeClass('copyable-link-animation'); }); }); |
