code cosmetics: animateElement() 'highlight' by default
This commit is contained in:
parent
1aa5c11b10
commit
dc846aa7dd
|
@ -246,7 +246,7 @@ function importFromString(jsonString) {
|
|||
const styleElement = $('#style-' + event.target.dataset.id);
|
||||
if (styleElement) {
|
||||
scrollElementIntoView(styleElement);
|
||||
animateElement(styleElement, {className: 'highlight'});
|
||||
animateElement(styleElement);
|
||||
}
|
||||
};
|
||||
for (const block of $$('details')) {
|
||||
|
|
9
dom.js
9
dom.js
|
@ -46,8 +46,13 @@ function scrollElementIntoView(element) {
|
|||
}
|
||||
|
||||
|
||||
function animateElement(element, {className, removeExtraClasses = [], remove = false}) {
|
||||
return new Promise(resolve => {
|
||||
function animateElement(
|
||||
element, {
|
||||
className = 'highlight',
|
||||
removeExtraClasses = [],
|
||||
remove = false,
|
||||
} = {}) {
|
||||
return element && new Promise(resolve => {
|
||||
element.addEventListener('animationend', function _() {
|
||||
element.removeEventListener('animationend', _);
|
||||
element.classList.remove(
|
||||
|
|
|
@ -342,7 +342,7 @@ Object.assign(handleEvent, {
|
|||
delete(event, entry) {
|
||||
const id = entry.styleId;
|
||||
const {name} = BG.cachedStyles.byId.get(id) || {};
|
||||
animateElement(entry, {className: 'highlight'});
|
||||
animateElement(entry);
|
||||
messageBox({
|
||||
title: t('deleteStyleConfirm'),
|
||||
contents: name,
|
||||
|
@ -420,7 +420,7 @@ function handleUpdate(style, {reason, method} = {}) {
|
|||
}
|
||||
filterAndAppend({entry});
|
||||
if (!entry.matches('.hidden') && reason != 'import') {
|
||||
animateElement(entry, {className: 'highlight'});
|
||||
animateElement(entry);
|
||||
scrollElementIntoView(entry);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user