mirror of
https://github.com/FrankerFaceZ/FrankerFaceZ.git
synced 2025-09-16 10:06:54 +00:00
3.5.423. Add option to hide boxart on hover to directory. Add support for new bits badge tiers. Reduce data stored for local chat history cache. Don't hide AutoMod buttons when a message is handled to prevent mis-clicks. Closes #77
This commit is contained in:
parent
8c5732cc5b
commit
b84bd1d4a2
11 changed files with 121 additions and 39 deletions
|
@ -200,6 +200,20 @@ FFZ.settings_info.directory_uploads_position = {
|
|||
};
|
||||
|
||||
|
||||
FFZ.settings_info.directory_hide_info_on_hover = {
|
||||
type: "boolean",
|
||||
value: false,
|
||||
|
||||
category: "Directory",
|
||||
no_mobile: true,
|
||||
|
||||
name: "Hide Boxart on Hover",
|
||||
help: "Do not display boxart and other information over a stream or video's thumbnail when hovering over it.",
|
||||
|
||||
on_update: utils.toggle_cls('ffz-hide-thumb-info-on-hover')
|
||||
}
|
||||
|
||||
|
||||
// --------------------
|
||||
// Initialization
|
||||
// --------------------
|
||||
|
@ -210,6 +224,7 @@ FFZ.prototype.setup_directory = function() {
|
|||
utils.toggle_cls('ffz-creative-tags')(this.settings.directory_creative_all_tags);
|
||||
utils.toggle_cls('ffz-creative-showcase')(this.settings.directory_creative_showcase);
|
||||
utils.toggle_cls('ffz-hide-directory-uploads')(this.settings.directory_uploads_position === 2);
|
||||
utils.toggle_cls('ffz-hide-thumb-info-on-hover')(this.settings.directory_hide_info_on_hover);
|
||||
|
||||
var f = this,
|
||||
VodCoviews = utils.ember_lookup('service:vod-coviews');
|
||||
|
|
|
@ -810,9 +810,12 @@ FFZ.prototype._modify_chat_line = function(component, is_vod) {
|
|||
|
||||
output = ['<span class="mod-icons">'];
|
||||
|
||||
if ( is_tb && ! this.get('hasClickedFlaggedMessage') ) {
|
||||
output.push('<a class="mod-icon html-tooltip tb-reject" title="Not Allowed' + TB_TOOLTIP + '">Not Allowed</a>');
|
||||
output.push('<a class="mod-icon html-tooltip tb-allow" title="Allowed' + TB_TOOLTIP + '">Allowed</a>');
|
||||
if ( is_tb ) {
|
||||
var clicked = this.get('hasClickedFlaggedMessage'),
|
||||
inactive = clicked ? ' inactive' : '';
|
||||
|
||||
output.push('<a class="mod-icon html-tooltip tb-reject' + inactive + (clicked ? '' : '" title="Not Allowed' + TB_TOOLTIP) + '">Not Allowed</a>');
|
||||
output.push('<a class="mod-icon html-tooltip tb-allow' + inactive + (clicked ? '' : '" title="Allowed' + TB_TOOLTIP) + '">Allowed</a>');
|
||||
}
|
||||
|
||||
if ( is_pinned_cheer ) {
|
||||
|
@ -1201,7 +1204,10 @@ FFZ.prototype._modify_chat_subline = function(component, is_whisper) {
|
|||
jQuery(e.target).trigger('mouseout');
|
||||
e.preventDefault();
|
||||
|
||||
if ( cl.contains('pc-dismiss-local') )
|
||||
if ( cl.contains('inactive') )
|
||||
return;
|
||||
|
||||
else if ( cl.contains('pc-dismiss-local') )
|
||||
PinnedCheers.dismissLocalMessage();
|
||||
|
||||
else if ( cl.contains('pc-dismiss') )
|
||||
|
|
|
@ -233,8 +233,15 @@ FFZ.settings_info.timeout_notices = {
|
|||
|
||||
|
||||
FFZ.settings_info.mod_card_history = {
|
||||
type: "boolean",
|
||||
value: false,
|
||||
type: "select",
|
||||
options: {
|
||||
0: "Disabled",
|
||||
1: "On Rooms without Logviewer",
|
||||
2: "Always"
|
||||
},
|
||||
|
||||
value: 0,
|
||||
process_value: utils.process_int(0, 0, 1),
|
||||
|
||||
no_bttv: true,
|
||||
category: "Chat Moderation",
|
||||
|
@ -243,13 +250,13 @@ FFZ.settings_info.mod_card_history = {
|
|||
help: "Display a few of the user's previously sent messages on moderation cards.",
|
||||
|
||||
on_update: function(val) {
|
||||
if ( val || ! this.rooms )
|
||||
if ( val === 2 || ! this.rooms )
|
||||
return;
|
||||
|
||||
// Delete all history~!
|
||||
for(var room_id in this.rooms) {
|
||||
var room = this.rooms[room_id];
|
||||
if ( room )
|
||||
if ( room && (val === 0 || room.has_logs) )
|
||||
room.user_history = undefined;
|
||||
}
|
||||
}
|
||||
|
@ -1527,9 +1534,9 @@ FFZ.prototype._build_mod_card_history = function(msg, modcard, show_from, ts_cli
|
|||
colored = '';
|
||||
}
|
||||
|
||||
|
||||
var message = '<span class="message' + colored + '" style="' + style + (colors ? '" data-color="' + raw_color : '') + '">' +
|
||||
(msg.style === 'action' && ! show_from ? '*' + name + ' ' : '') + this.render_tokens(msg.cachedTokens, true, false, msg.tags && msg.tags.bits) + '</span>';
|
||||
var tokens = this.tokenize_chat_line(msg, true, false, true),
|
||||
message = '<span class="message' + colored + '" style="' + style + (colors ? '" data-color="' + raw_color : '') + '">' +
|
||||
(msg.style === 'action' && ! show_from ? '*' + name + ' ' : '') + this.render_tokens(tokens, true, false, msg.tags && msg.tags.bits) + '</span>';
|
||||
|
||||
if ( msg.deleted )
|
||||
out.push('<span class="deleted"><a class="undelete" href="#" data-message="' + utils.quote_attr(message) + '"><message deleted></a></span>');
|
||||
|
|
|
@ -1029,6 +1029,10 @@ FFZ.prototype.add_room = function(room_id, room) {
|
|||
|
||||
data.has_logs = response.has_logs;
|
||||
data.log_source = response.log_source;
|
||||
|
||||
if ( f.settings.mod_card_history === 1 )
|
||||
data.user_history = undefined;
|
||||
|
||||
}, true);
|
||||
|
||||
// Is the room important?
|
||||
|
@ -1481,25 +1485,43 @@ FFZ.prototype._modify_room = function(room) {
|
|||
|
||||
addUserHistory: function(message) {
|
||||
var room_id = this.get('id'),
|
||||
is_group = this.get('isGroupRoom'),
|
||||
setting = f.settings.mod_card_history,
|
||||
ffz_room = f.rooms[room_id];
|
||||
|
||||
if ( ! ffz_room || ! f.settings.mod_card_history )
|
||||
if ( is_group || ! ffz_room || setting === 0 || (setting === 1 && ffz_room.has_logs) )
|
||||
return;
|
||||
|
||||
var username = message.ffz_ban_target || message.from,
|
||||
historical = message.tags && message.tags.historical,
|
||||
|
||||
chat_history = ffz_room.user_history = ffz_room.user_history || {},
|
||||
user_history = chat_history[username] = chat_history[username] || [];
|
||||
user_history = chat_history[username] = chat_history[username] || [],
|
||||
|
||||
// Don't store any computed values that would take a lot of memory.
|
||||
old_tags = message.tags || {},
|
||||
cache_object = {
|
||||
date: message.date,
|
||||
from: message.from,
|
||||
room: message.room,
|
||||
message: message.message,
|
||||
style: message.style,
|
||||
tags: {
|
||||
emotes: old_tags.emotes,
|
||||
bits: old_tags.bits,
|
||||
'display-name': old_tags['display-name'],
|
||||
id: old_tags.id
|
||||
}
|
||||
};
|
||||
|
||||
if ( historical ) {
|
||||
if ( user_history.length >= 20 )
|
||||
return;
|
||||
|
||||
user_history.unshift(message);
|
||||
user_history.unshift(cache_object);
|
||||
|
||||
} else {
|
||||
user_history.push(message);
|
||||
user_history.push(cache_object);
|
||||
while ( user_history.length > 20 )
|
||||
user_history.shift();
|
||||
}
|
||||
|
@ -1510,7 +1532,7 @@ FFZ.prototype._modify_room = function(room) {
|
|||
|
||||
if ( history ) {
|
||||
var was_at_top = history.scrollTop >= (history.scrollHeight - history.clientHeight),
|
||||
line = f._build_mod_card_history(message, f._mod_card);
|
||||
line = f._build_mod_card_history(cache_object, f._mod_card);
|
||||
|
||||
if ( historical )
|
||||
history.insertBefore(line, history.firstElementChild);
|
||||
|
@ -2086,18 +2108,7 @@ FFZ.prototype._modify_room = function(room) {
|
|||
|
||||
// Keep the history.
|
||||
if ( ! is_whisper && msg.from && msg.from !== 'jtv' && msg.from !== 'twitchnotify' )
|
||||
this.addUserHistory({
|
||||
from: msg.from,
|
||||
tags: {
|
||||
id: msg.tags && msg.tags.id,
|
||||
'display-name': msg.tags && msg.tags['display-name'],
|
||||
bits: msg.tags && msg.tags.bits
|
||||
},
|
||||
message: msg.message,
|
||||
cachedTokens: msg.cachedTokens,
|
||||
style: msg.style,
|
||||
date: msg.date
|
||||
});
|
||||
this.addUserHistory(msg);
|
||||
|
||||
// Clear the last ban for that user.
|
||||
var f_room = f.rooms && f.rooms[msg.room],
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue