NDOJ/resources/libs/clipboard/tooltip.js

18 lines
585 B
JavaScript
Raw Permalink Normal View History

2022-11-19 23:30:07 +00:00
function showTooltip(elem, msg, direction='s') {
$(elem).addClass('tooltipped tooltipped-' + direction);
2022-07-29 08:00:44 +00:00
elem.setAttribute('aria-label', msg);
}
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;
}