From 61d0c0e80450295ae7bbd6e93dbcea49871925f9 Mon Sep 17 00:00:00 2001 From: CBenni Date: Mon, 8 May 2017 23:39:52 +0200 Subject: [PATCH] Added note counter flag --- src/ui/logviewer.js | 10 +++++++++- style.css | 8 ++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/ui/logviewer.js b/src/ui/logviewer.js index f8a53b6d..6221cffa 100644 --- a/src/ui/logviewer.js +++ b/src/ui/logviewer.js @@ -536,7 +536,9 @@ FFZ.mod_card_pages.history = { msg_line.classList.remove('ffz-mentioned'); history.appendChild(msg_line); } - + + FFZ.mod_card_pages.notes.update_counter(mod_card, data.comments.length) + history.scrollTop = history.scrollHeight; }); } @@ -624,6 +626,11 @@ FFZ.mod_stats_blocks = { FFZ.mod_card_pages.notes = { title: "Notes", needs_lv: true, + + update_counter: function(mod_card, count) { + var tabelement = document.getElementById(mod_card.elementId).querySelector(".moderation-card__actions [data-page=notes]"); + tabelement.innerHTML = 'Notes' + ( count > 0 ? '
' + count + '
' : ''); + }, add_note: function(mod_card, el, note, history, last_line, do_scroll) { if ( ! history ) @@ -653,6 +660,7 @@ FFZ.mod_card_pages.notes = { } history.appendChild(output); + FFZ.mod_card_pages.notes.update_counter(mod_card, history.querySelectorAll(".message-line").length); if ( was_at_bottom ) setTimeout(function() { history.scrollTop = history.scrollHeight }); diff --git a/style.css b/style.css index 8051d011..3409e577 100644 --- a/style.css +++ b/style.css @@ -4182,4 +4182,12 @@ body.ffz-sidebar-swap .app-main.theatre #main_col:not(.expandRight) #player[data padding: 0; display: block; max-width: 340px; +} + +.moderation-card div.note-counter { + display: inline-block; + background-color: #555; + color: white; + padding: 0 8px; + border-radius: 100%; } \ No newline at end of file