diff --git a/resource/js/docready.js b/resource/js/docready.js index bf220a57b..b464c0464 100644 --- a/resource/js/docready.js +++ b/resource/js/docready.js @@ -94,8 +94,8 @@ $(function() { // DOCUMENT READY countAndSetOffset(); // Make a selection of an element for copy pasting. - function makeSelection() { - var $clicked = $(this); + function makeSelection(e, elem) { + var $clicked = elem || $(this); var text = $clicked[0]; var range; if (document.body.createTextRange) { // ms @@ -127,6 +127,17 @@ $(function() { // DOCUMENT READY $(document).on('click','.uri-input-box', makeSelection); + // copy to clipboard + function copyToClipboard() { + var $btn = $(this); + var id = $btn.attr('for'); + $elem = $(id); + makeSelection(undefined, $elem); + document.execCommand('copy'); + } + + $(document).on('click', 'button.copy-clipboard', copyToClipboard); + var sidebarResizer = debounce(function() { countAndSetOffset(); }, 40); diff --git a/view/concept-shared.twig b/view/concept-shared.twig index 11af60311..7185b532d 100644 --- a/view/concept-shared.twig +++ b/view/concept-shared.twig @@ -49,7 +49,8 @@ {% else %}
{{ key|trans }}: {{ val }}
{% endif %}{% endfor %}{{ key|trans }}: {{ val }}
{% endif %}{% endfor %}