1
0
Fork 0
mirror of https://github.com/FrankerFaceZ/FrankerFaceZ.git synced 2025-06-28 05:15:54 +00:00

3.5.481. Clean up the mod card note count code.

This commit is contained in:
SirStendec 2017-05-09 17:03:47 -04:00
parent 6d708184b4
commit e843a3bb19
3 changed files with 13 additions and 14 deletions

View file

@ -1,5 +1,6 @@
<div class="list-header">3.5.481 <time datetime="2017-05-09">(2017-05-09)</time></div> <div class="list-header">3.5.481 <time datetime="2017-05-09">(2017-05-09)</time></div>
<ul class="chat-menu-content menu-side-padding"> <ul class="chat-menu-content menu-side-padding">
<li>Added: Display the number of Notes a user has on moderation cards, once the data is loaded.</li>
<li>Fixed: Don't display background colors on custom bits badges.</li> <li>Fixed: Don't display background colors on custom bits badges.</li>
<li>Fixed: Advanced settings search box styling.</li> <li>Fixed: Advanced settings search box styling.</li>
<li>Fixed: ITAD button showing in places it shouldn't.</li> <li>Fixed: ITAD button showing in places it shouldn't.</li>

View file

@ -536,9 +536,9 @@ FFZ.mod_card_pages.history = {
msg_line.classList.remove('ffz-mentioned'); msg_line.classList.remove('ffz-mentioned');
history.appendChild(msg_line); history.appendChild(msg_line);
} }
FFZ.mod_card_pages.notes.update_counter(mod_card, data.comments.length) FFZ.mod_card_pages.notes.update_counter(mod_card, data.comments.length)
history.scrollTop = history.scrollHeight; history.scrollTop = history.scrollHeight;
}); });
} }
@ -626,10 +626,14 @@ FFZ.mod_stats_blocks = {
FFZ.mod_card_pages.notes = { FFZ.mod_card_pages.notes = {
title: "<span>N</span>otes", title: "<span>N</span>otes",
needs_lv: true, needs_lv: true,
update_counter: function(mod_card, count) { update_counter: function(mod_card, count) {
var tabelement = document.getElementById(mod_card.elementId).querySelector(".moderation-card__actions [data-page=notes]"); var el = mod_card.get('element'),
tabelement.innerHTML = '<span>N</span>otes' + ( count > 0 ? ' <div class="note-counter">' + count + '</div>' : ''); notes_tab = el && el.querySelector('.moderation-card__actions [data-page=notes]');
if ( notes_tab )
notes_tab.innerHTML = FFZ.mod_card_pages.notes.title +
(count > 0 ? ' <div class="pill">' + utils.number_commas(count) + '</div>' : '');
}, },
add_note: function(mod_card, el, note, history, last_line, do_scroll) { add_note: function(mod_card, el, note, history, last_line, do_scroll) {
@ -774,6 +778,8 @@ FFZ.mod_card_pages.notes = {
mod_card._lv_sock_user = user_id; mod_card._lv_sock_user = user_id;
f.lv_ws_sub('logs-' + room_id + '-' + user_id); f.lv_ws_sub('logs-' + room_id + '-' + user_id);
FFZ.mod_card_pages.notes.update_counter(mod_card, data.length);
if ( data.length ) { if ( data.length ) {
var last_line = null; var last_line = null;
for(var i=0; i < data.length; i++) for(var i=0; i < data.length; i++)
@ -787,7 +793,7 @@ FFZ.mod_card_pages.notes = {
}); });
if ( mod_card.lv_write_notes ) { if ( mod_card.lv_write_notes ) {
var textarea = utils.createElement('textarea', 'chat_text_input mousetrap note-text-input'), var textarea = utils.createElement('textarea', 'chat_text_input mousetrap form__input note-text-input'),
note_container = utils.createElement('div', 'moderation-card__actions textarea-contain note-input', textarea), note_container = utils.createElement('div', 'moderation-card__actions textarea-contain note-input', textarea),
btn_submit = utils.createElement('a', 'button float-right', 'Add Note'), btn_submit = utils.createElement('a', 'button float-right', 'Add Note'),
btn_container = utils.createElement('div', 'chat-buttons-container clearfix', btn_submit), btn_container = utils.createElement('div', 'chat-buttons-container clearfix', btn_submit),

View file

@ -4200,12 +4200,4 @@ body.ffz-sidebar-swap .app-main.theatre #main_col:not(.expandRight) #player[data
padding: 0; padding: 0;
display: block; display: block;
max-width: 340px; max-width: 340px;
}
.moderation-card div.note-counter {
display: inline-block;
background-color: #555;
color: white;
padding: 0 8px;
border-radius: 100%;
} }