mirror of
https://github.com/zenorocha/clipboard.js.git
synced 2023-08-10 21:12:48 +03:00
34 lines
923 B
JavaScript
34 lines
923 B
JavaScript
var btns = document.querySelectorAll('.btn');
|
|
|
|
for (var i = 0; i < btns.length; i++) {
|
|
btns[i].addEventListener('mouseleave', function(e) {
|
|
e.currentTarget.setAttribute('class', 'btn');
|
|
e.currentTarget.removeAttribute('aria-label');
|
|
});
|
|
}
|
|
|
|
function showTooltip(elem, msg) {
|
|
elem.setAttribute('class', 'btn tooltipped tooltipped-s');
|
|
elem.setAttribute('aria-label', msg);
|
|
}
|
|
|
|
// Simplistic detection, do not use it in production
|
|
function fallbackMessage(action) {
|
|
var actionMsg = '';
|
|
var actionKey = (action === 'cut' ? 'X' : 'C');
|
|
|
|
if(/iPhone|iPad/i.test(navigator.userAgent)) {
|
|
actionMsg = 'No support :(';
|
|
}
|
|
else if (/Mac/i.test(navigator.userAgent)) {
|
|
actionMsg = 'Press ⌘-' + actionKey + ' to ' + action;
|
|
}
|
|
else {
|
|
actionMsg = 'Press Ctrl-' + actionKey + ' to ' + action;
|
|
}
|
|
|
|
return actionMsg;
|
|
}
|
|
|
|
hljs.initHighlightingOnLoad();
|