1
0
Fork 0
mirror of https://github.com/FrankerFaceZ/FrankerFaceZ.git synced 2025-09-17 18:26:57 +00:00

3.5.463. Fix tab completion issues. Fix rendering of system-msgs that require special rendering. Fix compatibility with BetterTTV v7. This includes a lot of tiny changes because many features are only incompatible with BTTV v6.

This commit is contained in:
SirStendec 2017-04-10 15:03:05 -04:00
parent c3e5aa4fcf
commit 996ab7031e
26 changed files with 319 additions and 129 deletions

View file

@ -19,7 +19,7 @@ FFZ.settings_info.collect_bits = {
process_value: utils.process_int(0),
category: "Chat Appearance",
no_bttv: true,
no_bttv: 6,
name: "Bits Stacking",
help: "Collect all the bits emoticons in a message into a single one at the start of the message."
@ -31,7 +31,7 @@ FFZ.settings_info.bits_animated = {
value: true,
category: "Chat Appearance",
no_bttv: true,
no_bttv: 6,
name: "Bits Animation",
help: "Display bits with animation.",
@ -50,7 +50,7 @@ FFZ.settings_info.bits_tags_container = {
value: true,
category: "Chat Appearance",
no_bttv: true,
no_bttv: 6,
name: "Bits Tag Display",
help: "Display competitive bits tags at the top of chats that have it enabled.",

View file

@ -565,7 +565,7 @@ FFZ.settings_info.stream_uptime = {
FFZ.settings_info.stream_title = {
type: "boolean",
value: true,
no_bttv: true,
no_bttv: 6,
no_mobile: true,
category: "Channel Metadata",

View file

@ -373,10 +373,13 @@ FFZ.prototype.modify_chat_input = function(component) {
if ( ! t || ! t.length )
f.error("Cannot find textarea in Twitch Chat Input.");
t.off("keydown");
t.off("keyup");
t.on("keypress", this._ffzKeyPress.bind(this));
t.on("keydown", this._ffzKeyDown.bind(this));
if ( ! this.has_bttv ) {
t.off("keydown");
t.off("keyup");
t.on("keypress", this._ffzKeyPress.bind(this));
t.on("keydown", this._ffzKeyDown.bind(this));
}
t.on("paste", this._ffzPaste.bind(this));
t.attr('rows', 1);
@ -825,9 +828,6 @@ FFZ.prototype.modify_chat_input = function(component) {
prefix_length = f.settings.input_complete_without_prefix && is_sub_set ? utils.find_common_prefix(_.pluck(emote_set, 'code'), true) : 0;
sort_factor = is_sub_set ? 1 : 9;
if ( is_sub_set )
f.log("Sub Set: " + set_name + " -- Common Prefix: " + prefix_length + " [" + emote_set[0].code.substr(0, prefix_length) + "]", emote_set);
for(var i = 0; i < emote_set.length; i++) {
emote = emote_set[i];
if ( used_ids.indexOf(emote.id) !== -1 )

View file

@ -23,7 +23,7 @@ FFZ.basic_settings.delayed_chat = {
},
category: "Chat",
no_bttv: true,
no_bttv: 6,
name: "Delay and Filter Chat",
help: "Delay the appearance of chat messages to allow time for moderation and completely hide removed messages.",
@ -109,7 +109,7 @@ FFZ.settings_info.chat_batching = {
value: 0,
category: "Chat Appearance",
no_bttv: true,
no_bttv: 6,
name: "Chat Message Batching",
help: "Display chat messages in batches to improve performance in <em>extremely</em> fast chats.",
@ -141,7 +141,7 @@ FFZ.settings_info.chat_delay = {
value: -1,
category: "Chat Appearance",
no_bttv: true,
no_bttv: 6,
name: "Artificial Chat Delay",
help: "Delay the appearance of chat messages to allow for moderation before you see them.",
@ -173,7 +173,7 @@ FFZ.settings_info.remove_filtered = {
process_value: utils.process_int(0),
category: "Chat Filtering",
no_bttv: true,
no_bttv: 6,
name: "Remove Messages with Banned Words",
help: "Mark messages with banned words as deleted or outright remove them from chat.",
@ -184,14 +184,14 @@ FFZ.settings_info.remove_deleted = {
type: "boolean",
value: false,
no_bttv: true,
no_bttv: 6,
category: "Chat Filtering",
name: "Remove Deleted Messages",
help: "Remove deleted messages from chat entirely rather than leaving behind a clickable &lt;deleted message&gt;.",
on_update: function(val) {
if ( this.has_bttv || ! this.rooms || ! val )
if ( this.has_bttv_6 || ! this.rooms || ! val )
return;
for(var room_id in this.rooms) {
@ -219,7 +219,7 @@ FFZ.settings_info.remove_bot_ban_notices = {
type: "boolean",
value: false,
no_bttv: true,
no_bttv: 6,
category: "Chat Filtering",
name: "Remove Bot Ban Notices",
@ -231,14 +231,14 @@ FFZ.settings_info.prevent_clear = {
type: "boolean",
value: false,
no_bttv: true,
no_bttv: 6,
category: "Chat Filtering",
name: "Show Deleted Messages",
help: "Fade deleted messages instead of replacing them, and prevent chat from being cleared.",
on_update: function(val) {
if ( this.has_bttv || ! this.rooms )
if ( this.has_bttv_6 || ! this.rooms )
return;
for(var room_id in this.rooms) {
@ -281,14 +281,14 @@ FFZ.settings_info.group_tabs = {
process_value: utils.process_int(0, 0, 3),
no_bttv: true,
no_bttv: 6,
category: "Chat Appearance",
name: "Chat Room Tabs",
help: "Display tabs for chat rooms with recent activity at the top of the chat window for more convenient chatting.",
on_update: function(val) {
if ( this.has_bttv || ! this._chatv )
if ( this.has_bttv_6 || ! this._chatv )
return;
if ( val )
@ -321,7 +321,7 @@ FFZ.settings_info.visible_rooms = {
FFZ.prototype.refresh_chat = function() {
var parents, lines = jQuery('ul.chat-lines');
if ( this.has_bttv || ! lines || ! lines.length )
if ( this.has_bttv_6 || ! lines || ! lines.length )
return;
parents = lines.parents('.chatReplay');
@ -358,7 +358,7 @@ FFZ.prototype.setup_chatview = function() {
},
ffzUpdateChannels: function() {
if ( ! f._chatv || f.has_bttv )
if ( ! f._chatv || f.has_bttv_6 )
return;
f._chatv.ffzRebuildMenu();
@ -395,7 +395,7 @@ FFZ.prototype.setup_chatview = function() {
}.observes("currentChannelRoom"),
ffzUpdateInvites: function() {
if ( ! f._chatv || f.has_bttv )
if ( ! f._chatv || f.has_bttv_6 )
return;
f._chatv.ffzUpdateMenuUnread();
@ -407,7 +407,7 @@ FFZ.prototype.setup_chatview = function() {
}.observes('currentRoom'),
notificationsCount: function() {
if ( ! f._chatv || f.has_bttv )
if ( ! f._chatv || f.has_bttv_6 )
return this._super();
var total = this.get('invitedPrivateGroupRooms.length') || 0;
@ -450,7 +450,7 @@ FFZ.prototype.setup_chatview = function() {
}.observes("privateGroupRooms.@each"),
removeCurrentChannelRoom: function() {
if ( f.has_bttv )
if ( f.has_bttv_6 )
return this._super();
var room = this.get("currentChannelRoom"),
@ -573,7 +573,7 @@ FFZ.prototype.modify_chat_room_manager = function(component) {
this.$('.textarea-contain').append(f.build_ui_link(this));
if ( ! f.has_bttv ) {
if ( ! f.has_bttv_6 ) {
if ( f.settings.group_tabs )
this.ffzEnableTabs();
@ -738,7 +738,7 @@ FFZ.prototype.modify_chat_room_manager = function(component) {
updated = false;
if ( f.has_bttv )
if ( f.has_bttv_6 )
return;
if ( target ) {
@ -1071,7 +1071,7 @@ FFZ.prototype.modify_chat_room_manager = function(component) {
// Group Tabs
ffzEnableTabs: function() {
if ( f.has_bttv || ! f.settings.group_tabs || this._ffz_tabs )
if ( f.has_bttv_6 || ! f.settings.group_tabs || this._ffz_tabs )
return;
// Hide the existing chat UI.
@ -1110,7 +1110,7 @@ FFZ.prototype.modify_chat_room_manager = function(component) {
tabs.innerHTML = "";
if ( f.has_bttv || ! f.settings.group_tabs )
if ( f.has_bttv_6 || ! f.settings.group_tabs )
return;
var link = utils.createElement('a', 'button button--icon-only'),
@ -1285,7 +1285,7 @@ FFZ.prototype.connect_extra_chat = function() {
}
// We don't join extra rooms with BTTV.
if ( this.has_bttv )
if ( this.has_bttv_6 )
return;
for(var i=0; i < this.settings.pinned_rooms.length; i++)
@ -1345,7 +1345,7 @@ FFZ.prototype._join_room = function(room_id, no_rebuild) {
// Rebuild the chat UI.
if ( ! no_rebuild && ! this.has_bttv && this._chatv ) {
if ( ! no_rebuild && ! this.has_bttv_6 && this._chatv ) {
if ( this.settings.group_tabs )
this._chatv.ffzRebuildTabs();
@ -1383,7 +1383,7 @@ FFZ.prototype._leave_room = function(room_id, no_rebuild) {
// Rebuild the chat UI.
if ( ! no_rebuild && ! this.has_bttv && this._chatv ) {
if ( ! no_rebuild && ! this.has_bttv_6 && this._chatv ) {
if ( this.settings.group_tabs )
this._chatv.ffzRebuildTabs();
@ -1399,7 +1399,7 @@ FFZ.prototype._leave_room = function(room_id, no_rebuild) {
// ----------------------
FFZ.chat_commands.join = function(room, args) {
if ( this.has_bttv )
if ( this.has_bttv_6 )
return "Pinned Rooms are not available with BetterTTV installed.";
if ( ! args || ! args.length || args.length > 1 )
@ -1415,13 +1415,13 @@ FFZ.chat_commands.join = function(room, args) {
return "You have already joined " + room_id + ". Please use \"/part " + room_id + "\" to leave it.";
}
FFZ.chat_commands.join.no_bttv = true;
FFZ.chat_commands.join.no_bttv = 6;
FFZ.chat_commands.join.label = '/join &lt;channel&gt;';
FFZ.chat_commands.join.info = 'Add Channel to Pinned Rooms';
FFZ.chat_commands.part = function(room, args) {
if ( this.has_bttv )
if ( this.has_bttv_6 )
return "Pinned Rooms are not available with BetterTTV installed.";
if ( ! args || ! args.length || args.length > 1 )
@ -1439,6 +1439,6 @@ FFZ.chat_commands.part = function(room, args) {
return "You are not in " + room_id + ".";
}
FFZ.chat_commands.part.no_bttv = true;
FFZ.chat_commands.part.no_bttv = 6;
FFZ.chat_commands.part.label = '/part &lt;channel&gt;';
FFZ.chat_commands.part.info = 'Remove Channel from Pinned Rooms';

View file

@ -38,14 +38,14 @@ FFZ.settings_info.top_conversations = {
FFZ.settings_info.hide_whispers_in_embedded_chat = {
type: "boolean",
value: false,
no_bttv: true,
no_bttv: 6,
category: "Whispers",
name: "Hide Whispers in Embedded Chat",
help: "Do not display whispers on the dashboard, in pop-out chat, or in chat embedded into other websites.",
on_update: function(val) {
if ( ! val || this.has_bttv )
if ( ! val || this.has_bttv_6 )
return;
for(var room_id in this.rooms) {
@ -117,7 +117,7 @@ FFZ.prototype.modify_conversation_menu = function(component) {
el = this.get('element'),
sections = el && el.querySelectorAll('.options-section');
if ( ! user || ! user.length || f.has_bttv )
if ( ! user || ! user.length || f.has_bttv_6 )
return;
if ( sections && sections.length )

View file

@ -37,7 +37,7 @@ FFZ.settings_info.username_display = {
},
category: "Chat Appearance",
no_bttv: true,
no_bttv: 6,
name: "Username Display",
help: "How a user's name should be rendered when their display name differs from the username.",
@ -83,8 +83,6 @@ FFZ.settings_info.replace_bad_emotes = {
value: true,
category: "Chat Appearance",
warn_bttv: "Only affects Whispers when BetterTTV is enabled.",
name: "Fix Low Quality Twitch Global Emoticons",
help: "Replace emoticons such as DansGame and RedCoat with cleaned up versions that don't have pixels around the edges or white backgrounds for nicer display on dark chat."
};
@ -95,7 +93,7 @@ FFZ.settings_info.parse_links = {
value: true,
category: "Chat Appearance",
no_bttv: true,
no_bttv: 6,
name: "Make Links Clickable",
help: "Display links as real, clickable hyperlinks rather than just text."
@ -107,7 +105,7 @@ FFZ.settings_info.parse_emoticons = {
value: true,
category: "Chat Appearance",
no_bttv: true,
no_bttv: 6,
name: "Display Emoticons",
help: "Display emoticons in chat messages rather than just text."
@ -138,7 +136,7 @@ FFZ.settings_info.scrollback_length = {
value: 150,
category: "Chat Appearance",
no_bttv: true,
no_bttv: 6,
name: "Scrollback Length",
help: "Set the maximum number of lines to keep in chat.",
@ -179,7 +177,7 @@ FFZ.settings_info.hosted_sub_notices = {
value: true,
category: "Chat Filtering",
no_bttv: true,
no_bttv: 6,
name: "Show Hosted Channel Subscriber Notices",
help: "Display (or more specifically <i>hides</i> when disabled) notices in chat when someone subscribes to the hosted channel."
@ -188,11 +186,9 @@ FFZ.settings_info.hosted_sub_notices = {
FFZ.settings_info.filter_whispered_links = {
type: "boolean",
value: true,
value: 6,
category: "Chat Filtering",
warn_bttv: "Only affects Whispers when BetterTTV is enabled.",
name: "Auto-Hide Potentially Dangerous Whispered Links",
help: "Removes whispered links and displays a placeholder, with a warning that the link has not been approved by moderation or staff. Links remain accessible with an additional click."
};
@ -204,8 +200,6 @@ FFZ.settings_info.banned_words = {
category: "Chat Filtering",
warn_bttv: "Only affects Whispers when BetterTTV is enabled.",
name: "Banned Words",
help: "Set a list of words that will be locally removed from chat messages.",
@ -244,8 +238,6 @@ FFZ.settings_info.keywords = {
category: "Chat Filtering",
warn_bttv: "Only affects Whispers when BetterTTV is enabled.",
name: "Highlight Keywords",
help: "Set additional keywords that will be highlighted in chat.",
@ -284,7 +276,6 @@ FFZ.settings_info.clickable_emoticons = {
value: false,
category: "Chat Tooltips",
warn_bttv: "Only affects Whispers when BetterTTV is enabled.",
no_mobile: true,
name: "Emoticon Information Pages",
@ -297,7 +288,7 @@ FFZ.settings_info.link_info = {
value: true,
category: "Chat Tooltips",
no_bttv: true,
no_bttv: 6,
name: "Link Information <span>Beta</span>",
help: "Check links against known bad websites, unshorten URLs, and show YouTube info."
@ -309,7 +300,7 @@ FFZ.settings_info.link_image_hover = {
value: false,
category: "Chat Tooltips",
no_bttv: true,
no_bttv: 6,
no_mobile: true,
name: "Image Preview",
@ -337,7 +328,7 @@ FFZ.settings_info.image_hover_all_domains = {
value: false,
category: "Chat Tooltips",
no_bttv: true,
no_bttv: 6,
no_mobile: true,
name: "Image Preview - All Domains",
@ -407,7 +398,7 @@ FFZ.settings_info.old_sub_notices = {
value: false,
category: "Chat Appearance",
no_bttv: true,
no_bttv: 6,
name: "Old-Style Subscriber Notices",
help: "Display the old style subscriber notices, with the message on a separate line."
@ -933,15 +924,43 @@ FFZ.prototype._modify_chat_line = function(component, is_vod) {
style = colors ? 'color:' + (is_dark ? colors[1] : colors[0]) : '',
colored = colors ? ' has-color' + (is_replay ? ' replay-color' : '') : '',
results = f.format_display_name(raw_display, username);
results = f.format_display_name(raw_display, username),
tag = f.settings.disable_bttv_mod_cards ? 'fspan' : 'span';
return '<span class="' + (is_recipient ? 'to' : 'from') + (alias ? ' ffz-alias' : '') + (results[1] ? ' html-tooltip' : '') + colored + '" style="' + style + (colors ? '" data-color="' + raw_color : '') + (results[1] ? '" title="' + utils.quote_attr(results[1]) : '') + '">' + results[0] + '</span>';
return '<' + tag + ' class="' + (is_recipient ? 'to' : 'from') + (alias ? ' ffz-alias' : '') + (results[1] ? ' html-tooltip' : '') + colored + '" style="' + style + (colors ? '" data-color="' + raw_color : '') + (results[1] ? '" title="' + utils.quote_attr(results[1]) : '') + '">' + results[0] + '</' + tag + '>';
},
buildSystemMessageHTML: function() {
return this.get('hasSystemMsg') ?
'<div class="system-msg">' + utils.sanitize(this.get('systemMsg')) + '</div>' :
'';
if ( ! this.get('hasSystemMsg') )
return '';
var tags = this.get('msgObject.tags') || {},
msg_type = tags['msg-id'],
out = '';
if ( msg_type === 'bits-hashtag' )
out = f.render_token(true,false,true, {type: "bits", prefix: "Cheer", amount: parseInt(tags['msg-param-total'])}) +
utils.sanitize(tags['system-msg'] || '')
.replace('{hashtag}', '<strong>#' + utils.sanitize(tags['msg-param-hashtag']) + '</strong>')
.replace('{link}', '<a target="_blank" href="' + utils.quote_san(tags['msg-param-link']) + '">' + utils.sanitize(tags['msg-param-linkname']) + '</a>')
else if ( msg_type === 'purchase' ) {
var Intl = utils.ember_lookup('service:intl');
out = Intl && ('<p class="purchase-message-title pd-t-0 float-left">' +
Intl.tHtml('gameCommerce.purchaseNotifications.message', {
userName: tags['login'],
purchaseTitle: tags['msg-param-title']
}).string +
'</p><div><img class="purchase-notif__box-art float-right mg-t-0 mg-1-1" src="' +
utils.quote_san(tags['msg-param-imageURL']) +
'"></div>');
}
else
out = utils.sanitize(this.get('systemMsg'));
return out ? '<div class="system-msg">' + out + '</div>' : '';
},
buildBadgesHTML: function() {

View file

@ -34,6 +34,32 @@ try {
// Settings
// ----------------
FFZ.settings_info.disable_bttv_mod_cards = {
type: "boolean",
value: false,
require_bttv: 7,
category: "Chat Moderation",
name: "Disable BTTV Mod Cards",
help: "This disables mod cards from BetterTTV, forcing FFZ mod cards to show instead.",
on_update: function(val) {
var CL = utils.ember_resolve('component:chat/chat-line'),
views = CL ? utils.ember_views() : [];
for(var vid in views) {
var view = views[vid];
if ( view instanceof CL && view.buildFromHTML ) {
view.$('.from').replaceWith(view.buildFromHTML());
if ( view.get('msgObject.to') )
view.$('.to').replaceWith(view.buildFromHTML(true));
}
}
}
};
FFZ.basic_settings.enhanced_moderation_cards = {
type: "boolean",
@ -60,7 +86,7 @@ FFZ.basic_settings.enhanced_moderation_cards = {
FFZ.basic_settings.chat_hover_pause = {
type: "boolean",
no_bttv: true,
no_bttv: 6,
category: "Chat",
name: "Pause Chat Scrolling on Mouse Hover",
@ -121,7 +147,7 @@ FFZ.settings_info.chat_mod_icon_visibility = {
process_value: utils.process_int(0),
no_bttv: true,
no_bttv: 6,
category: "Chat Moderation",
name: "Display In-Line Mod Icons",
@ -154,7 +180,7 @@ FFZ.settings_info.chat_hover_pause = {
value: 0,
process_value: utils.process_int(0, 0, 1),
no_bttv: true,
no_bttv: 6,
category: "Chat Moderation",
name: "Pause Chat Scrolling",
@ -182,7 +208,7 @@ FFZ.settings_info.short_commands = {
type: "boolean",
value: true,
no_bttv: true,
no_bttv: 6,
category: "Chat Moderation",
name: "Short Moderation Commands",
@ -225,7 +251,7 @@ FFZ.settings_info.timeout_notices = {
value: 1,
process_value: utils.process_int(1),
no_bttv: true,
no_bttv: 6,
category: "Chat Moderation",
name: "Display Timeout / Ban Notices",
@ -276,7 +302,7 @@ FFZ.settings_info.mod_button_context = {
value: 3,
process_value: utils.process_int(3),
no_bttv: true,
no_bttv: 6,
category: "Chat Moderation",
name: "Mod Icon Context Menus",
@ -296,7 +322,7 @@ FFZ.settings_info.mod_card_reasons = {
],
category: "Chat Moderation",
no_bttv: true,
no_bttv: 6,
name: "Ban / Timeout Reasons",
help: "Change the available options in the chat ban reasons list shown in moderation cards and when right-clicking an in-line ban or timeout button.",
@ -339,7 +365,7 @@ FFZ.settings_info.mod_buttons = {
// integer = Timeout (that amount of time)
value: [['', false, false], ['',600, false]], //, ['', 1, false]],
no_bttv: true,
no_bttv: 6,
category: "Chat Moderation",
name: "Custom In-Line Moderation Icons",
@ -910,7 +936,7 @@ FFZ.prototype.modify_moderation_card = function(component) {
},
ffz_init: function() {
if ( f.has_bttv )
if ( f.has_bttv_6 )
return;
f._mod_card = this;

View file

@ -663,13 +663,15 @@ FFZ.prototype.modify_room_component = function(component) {
ffz_init: function() {
f._roomv = this;
if ( ! f.has_bttv ) {
if ( ! f.has_bttv_6 ) {
this.ffzFixStickyBottom();
this.ffzAddKeyHook();
if ( f.settings.chat_hover_pause )
this.ffzEnableFreeze();
}
if ( ! f.has_bttv ) {
if ( f.settings.room_status )
this.ffzUpdateStatus();
}
@ -810,7 +812,7 @@ FFZ.ffz_commands = {};
FFZ.prototype.room_message = function(room, text) {
if ( this.has_bttv ) {
if ( this.has_bttv_6 ) {
var lines = text.split("\n");
for(var i=0; i < lines.length; i++)
BetterTTV.chat.handlers.onPrivmsg(room.id, {style: 'admin', date: new Date(), from: 'jtv', message: lines[i]});
@ -1329,7 +1331,7 @@ FFZ.prototype._modify_room = function(room) {
addFriendsWatchingMessage: function(msg) {
this.addMessage({
style: 'admin' + (f.has_bttv ? '' : ' friend-watching'),
style: 'admin' + (f.has_bttv_6 ? '' : ' friend-watching'),
message: msg,
tags: {
emotes: tmimotes && tmimotes(this.get('userEmotes').tryParseEmotes(msg))
@ -1386,7 +1388,7 @@ FFZ.prototype._modify_room = function(room) {
//f.log("Login Moderation for " + this.get('id') + ' [' + room_id + ']', event);
// In case we get unexpected input, do the other thing.
if ( f.has_bttv || ["ban", "unban", "timeout", "untimeout"].indexOf(event.moderation_action) === -1 )
if ( f.has_bttv_6 || ["ban", "unban", "timeout", "untimeout"].indexOf(event.moderation_action) === -1 )
return this._super(event);
var msg_id,

View file

@ -83,7 +83,7 @@ FFZ.prototype.modify_vod_chat_display = function(component) {
Room && Room.findOne(room_id);
}
if ( ! f.has_bttv ) {
if ( ! f.has_bttv_6 ) {
this.ffzFixStickyBottom();
this.ffzAddKeyHook();