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

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long