Refactor clipboard functions
This commit is contained in:
parent
da9881a47f
commit
2dfdb66e0a
3 changed files with 4 additions and 5 deletions
|
@ -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);
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
2
assets/js/dist/page.min.js
vendored
2
assets/js/dist/page.min.js
vendored
File diff suppressed because one or more lines are too long
2
assets/js/dist/post.min.js
vendored
2
assets/js/dist/post.min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue