client/tags: fade out tag colors after 2.5s

This commit is contained in:
rr- 2016-07-30 16:44:27 +02:00
parent af455b901f
commit 81afd383fa
2 changed files with 27 additions and 9 deletions

View File

@ -174,13 +174,15 @@ input:disabled
cursor: not-allowed cursor: not-allowed
div.tag-input div.tag-input
li.implication li
transition: background-color 0.5s linear
&.implication
background: $implied-tag-background-color background: $implied-tag-background-color
color: $implied-tag-text-color color: $implied-tag-text-color
li.new &.new
background: $new-tag-background-color background: $new-tag-background-color
color: $new-tag-text-color color: $new-tag-text-color
li.duplicate &.duplicate
background: $duplicate-tag-background-color background: $duplicate-tag-background-color
color: $duplicate-tag-text-color color: $duplicate-tag-text-color
ul ul

View File

@ -14,6 +14,21 @@ const SOURCE_INIT = 'init';
const SOURCE_IMPLICATION = 'implication'; const SOURCE_IMPLICATION = 'implication';
const SOURCE_USER_INPUT = 'user-input'; const SOURCE_USER_INPUT = 'user-input';
function _fadeOutListItemNodeStatus(listItemNode) {
if (listItemNode.classList.length) {
if (listItemNode.fadeTimeout) {
window.clearTimeout(listItemNode.fadeTimeout);
}
listItemNode.fadeTimeout = window.setTimeout(() => {
while (listItemNode.classList.length) {
listItemNode.classList.remove(
listItemNode.classList.item(0));
}
listItemNode.fadeTimeout = null;
}, 2500);
}
}
class TagInputControl extends events.EventTarget { class TagInputControl extends events.EventTarget {
constructor(sourceInputNode) { constructor(sourceInputNode) {
super(); super();
@ -140,6 +155,7 @@ class TagInputControl extends events.EventTarget {
} }
this._tagListNode.prependChild(listItemNode); this._tagListNode.prependChild(listItemNode);
} }
_fadeOutListItemNodeStatus(listItemNode);
} }
_evtTagRemoved(e) { _evtTagRemoved(e) {