diff --git a/resources/libs/clipboard/tooltip.js b/resources/libs/clipboard/tooltip.js index 6333457..9cce976 100644 --- a/resources/libs/clipboard/tooltip.js +++ b/resources/libs/clipboard/tooltip.js @@ -1,5 +1,5 @@ -function showTooltip(elem, msg) { - elem.setAttribute('class', 'btn-clipboard tooltipped tooltipped-s'); +function showTooltip(elem, msg, direction='s') { + $(elem).addClass('tooltipped tooltipped-' + direction); elem.setAttribute('aria-label', msg); } function fallbackMessage(action) { diff --git a/templates/actionbar/list.html b/templates/actionbar/list.html index 64b8389..d3ca294 100644 --- a/templates/actionbar/list.html +++ b/templates/actionbar/list.html @@ -17,8 +17,8 @@ {% if not hide_actionbar_comment %} - - + + {{_("Comment")}} @@ -33,8 +33,8 @@ {{_("Bookmark")}} - - + + {{_("Share")}} diff --git a/templates/actionbar/media-js.html b/templates/actionbar/media-js.html index 9144ea1..1e3b083 100644 --- a/templates/actionbar/media-js.html +++ b/templates/actionbar/media-js.html @@ -104,7 +104,21 @@ } } }; + $(".actionbar-share").click( function() { + link = $(this).attr("share-url") || window.location.href; + navigator.clipboard + .writeText(link) + .then(() => { + showTooltip(this, "Copied link", 'n'); + }); + }); + $('.actionbar-comment').on('click', function() { + if ($('#comment-announcement').length) { + $('#comment-announcement').click(); + } + $('#write-comment').click(); + }) }); {% endcompress %} \ No newline at end of file diff --git a/templates/base.html b/templates/base.html index b771565..a9b3d6b 100644 --- a/templates/base.html +++ b/templates/base.html @@ -91,6 +91,7 @@ {% include "extra_js.html" %} + {% endcompress %} diff --git a/templates/common-content.html b/templates/common-content.html index c809252..52f195b 100644 --- a/templates/common-content.html +++ b/templates/common-content.html @@ -7,7 +7,6 @@ {% block js_media %} {% compress js %} -