Refactor clipboard functions

This commit is contained in:
Cotes Chung 2021-09-17 16:07:42 +08:00
parent da9881a47f
commit 2dfdb66e0a
3 changed files with 4 additions and 5 deletions

View file

@ -58,21 +58,18 @@ $(function() {
function hideTooltip(btn) {
$(btn).tooltip('hide');
unlock(btn);
}
function setSuccessIcon(btn) {
let btnNode = $(btn);
let iconNode = btnNode.children();
iconNode.attr('class', ICON_SUCCESS);
lock(btn);
}
function resumeIcon(btn) {
let btnNode = $(btn);
let iconNode = btnNode.children();
iconNode.attr('class', ICON_DEFAULT);
unlock(btn);
}
clipboard.on('success', (e) => {
@ -85,10 +82,12 @@ $(function() {
setSuccessIcon(trigger);
showTooltip(trigger);
lock(trigger);
setTimeout(() => {
hideTooltip(trigger);
resumeIcon(trigger);
unlock(trigger);
}, TIMEOUT);
});

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long