diff --git a/docs/assets/js/src/application.js b/docs/assets/js/src/application.js
index 85a578649f..1fec200795 100644
--- a/docs/assets/js/src/application.js
+++ b/docs/assets/js/src/application.js
@@ -38,29 +38,38 @@
// Insert copy to clipboard button before .highlight
$('.highlight').each(function () {
- var btnHtml = '
Copy
'
+ var btnHtml = 'Copy
'
$(this).before(btnHtml)
+ $('.btn-clipboard').tooltip()
})
- var clipboard = new Clipboard('.bd-clipboard', {
+ var clipboard = new Clipboard('.btn-clipboard', {
target: function (trigger) {
- return trigger.nextElementSibling;
+ return trigger.parentNode.nextElementSibling
}
- });
+ })
- /*
clipboard.on('success', function (e) {
- console.info('Action:', e.action);
- console.info('Text:', e.text);
- console.info('Trigger:', e.trigger);
+ $(e.trigger)
+ .attr('title', 'Copied!')
+ .tooltip('_fixTitle')
+ .tooltip('show')
+ .attr('title', 'Copy to clipboard')
+ .tooltip('_fixTitle')
- e.clearSelection();
- });
+ e.clearSelection()
+ })
clipboard.on('error', function (e) {
- console.error('Action:', e.action);
- console.error('Trigger:', e.trigger);
- });*/
+ var fallbackMsg = /Mac/i.test(navigator.userAgent) ? 'Press \u2318 to copy' : 'Press Ctrl-C to copy'
+
+ $(e.trigger)
+ .attr('title', fallbackMsg)
+ .tooltip('_fixTitle')
+ .tooltip('show')
+ .attr('title', 'Copy to clipboard')
+ .tooltip('_fixTitle')
+ })
})