1
0
Fork 0
mirror of https://github.com/FrankerFaceZ/FrankerFaceZ.git synced 2025-07-01 08:38:32 +00:00

3.5.148. Fix tokenize_emotes not using hasOwnProperty to check if a key exists in an object, causing some words to get eaten in chat on Firefox.

This commit is contained in:
SirStendec 2016-03-27 02:15:32 -04:00
parent 46dee22d83
commit 5bb64a0904
6 changed files with 39 additions and 15 deletions

View file

@ -116,6 +116,18 @@ FFZ.settings_info.input_complete_emotes = {
} }
FFZ.settings_info.input_complete_name_at = {
type: "boolean",
value: true,
category: "Chat Input",
no_bttv: true,
name: "Tab-Complete Usernames with At Sign",
help: "When enabled, tab-completed usernames will have an @ sign before them if you typed one. This is default Twitch behavior, but unnecessary."
}
FFZ.settings_info.input_complete_without_prefix = { FFZ.settings_info.input_complete_without_prefix = {
type: "boolean", type: "boolean",
value: true, value: true,
@ -160,12 +172,17 @@ FFZ.prototype.setup_chat_input = function() {
this._modify_chat_input(Input); this._modify_chat_input(Input);
try { Input.create().destroy()
} catch(err) { }
var views = utils.ember_views(); var views = utils.ember_views();
for(var key in views) { for(var key in views) {
var v = views[key]; var v = views[key];
if ( v instanceof Input ) { if ( v instanceof Input ) {
this.log("Manually modifying Chat Input component.", v); this.log("Manually modifying Chat Input component.", v);
this._modify_chat_input(v); if ( ! v.ffzInit )
this._modify_chat_input(v);
v.ffzInit(); v.ffzInit();
} }
} }
@ -439,8 +456,9 @@ FFZ.prototype._modify_chat_input = function(component) {
ind = this.get('ffz_partial_word_start'), ind = this.get('ffz_partial_word_start'),
text = this.get('textareaValue'), text = this.get('textareaValue'),
content = (item.command_content && text.charAt(0) === '/' ? content = ((f.settings.input_complete_name_at && item.type === 'user' && this.get('ffz_partial_word').charAt(0) === '@') ? '@' : '') +
item.command_content : item.content) || item.label, ((item.command_content && text.charAt(0) === '/' ?
item.command_content : item.content) || item.label),
trail = text.substr(ind + this.get('ffz_partial_word').length), trail = text.substr(ind + this.get('ffz_partial_word').length),
prefix = text.substr(0, ind) + content + (trail ? '' : ' '); prefix = text.substr(0, ind) + content + (trail ? '' : ' ');
@ -931,10 +949,10 @@ FFZ.prototype._modify_chat_input = function(component) {
} }
} }
}); });
break;
} }
break;
case KEYCODES.ENTER: case KEYCODES.ENTER:
if ( e.shiftKey || e.shiftLeft ) if ( e.shiftKey || e.shiftLeft )

View file

@ -456,6 +456,7 @@ FFZ.prototype.setup_chatview = function() {
Chat.create().destroy(); Chat.create().destroy();
} catch(err) { } } catch(err) { }
// Modify all existing Chat views. // Modify all existing Chat views.
var views = utils.ember_views(); var views = utils.ember_views();
for(var key in views) { for(var key in views) {

View file

@ -56,14 +56,20 @@ FFZ.prototype.setup_conversations = function() {
this.log("Hooking the Ember Conversation Window component."); this.log("Hooking the Ember Conversation Window component.");
var ConvWindow = utils.ember_resolve('component:conversation-window'); var ConvWindow = utils.ember_resolve('component:conversation-window');
if ( ConvWindow ) if ( ConvWindow ) {
this._modify_conversation_window(ConvWindow); this._modify_conversation_window(ConvWindow);
try { ConvWindow.create().destroy() }
catch(err) { }
}
this.log("Hooking the Ember Conversation Line component."); this.log("Hooking the Ember Conversation Line component.");
var ConvLine = utils.ember_resolve('component:conversation-line'); var ConvLine = utils.ember_resolve('component:conversation-line');
if ( ConvLine ) if ( ConvLine ) {
this._modify_conversation_line(ConvLine); this._modify_conversation_line(ConvLine);
try { ConvLine.create().destroy() }
catch(err) { }
}
// TODO: Make this better later. // TODO: Make this better later.
jQuery('.conversations-list').find('.html-tooltip').tipsy({live: true, html: true, gravity: utils.tooltip_placement(2*constants.TOOLTIP_DISTANCE, 'n')}); jQuery('.conversations-list').find('.html-tooltip').tipsy({live: true, html: true, gravity: utils.tooltip_placement(2*constants.TOOLTIP_DISTANCE, 'n')});

View file

@ -256,7 +256,7 @@ FFZ.prototype.setup_bttv = function(delay) {
if ( emote_set && emote_set.emoticons ) if ( emote_set && emote_set.emoticons )
for(var emote_id in emote_set.emoticons) { for(var emote_id in emote_set.emoticons) {
emote = emote_set.emoticons[emote_id]; emote = emote_set.emoticons[emote_id];
if ( ! emotes[emote.name] ) if ( ! emotes.hasOwnProperty(emote.name) )
emotes[emote.name] = emote; emotes[emote.name] = emote;
} }
} }
@ -274,9 +274,8 @@ FFZ.prototype.setup_bttv = function(delay) {
for(var x=0,y=segments.length; x < y; x++) { for(var x=0,y=segments.length; x < y; x++) {
segment = segments[x]; segment = segments[x];
emote = emotes[segment]; if ( emotes.hasOwnProperty(segment) ) {
emote = emotes[segment];
if ( emote ) {
if ( text.length ) { if ( text.length ) {
var toks = parse_emoji(text.join(' ') + ' '); var toks = parse_emoji(text.join(' ') + ' ');
for(var q=0; q < toks.length; q++) for(var q=0; q < toks.length; q++)

View file

@ -35,7 +35,7 @@ FFZ.msg_commands = {};
// Version // Version
var VER = FFZ.version_info = { var VER = FFZ.version_info = {
major: 3, minor: 5, revision: 145, major: 3, minor: 5, revision: 148,
toString: function() { toString: function() {
return [VER.major, VER.minor, VER.revision].join(".") + (VER.extra || ""); return [VER.major, VER.minor, VER.revision].join(".") + (VER.extra || "");
} }

View file

@ -756,7 +756,7 @@ FFZ.prototype.tokenize_emotes = function(user, room, tokens, do_report) {
if ( emote_set && emote_set.emoticons ) if ( emote_set && emote_set.emoticons )
for(var emote_id in emote_set.emoticons) { for(var emote_id in emote_set.emoticons) {
emote = emote_set.emoticons[emote_id]; emote = emote_set.emoticons[emote_id];
if ( ! emotes[emote.name] ) if ( ! emotes.hasOwnProperty(emote.name) )
emotes[emote.name] = emote; emotes[emote.name] = emote;
} }
} }
@ -783,9 +783,9 @@ FFZ.prototype.tokenize_emotes = function(user, room, tokens, do_report) {
for(var x=0,y=segments.length; x < y; x++) { for(var x=0,y=segments.length; x < y; x++) {
segment = segments[x]; segment = segments[x];
emote = emotes[segment]; if ( emotes.hasOwnProperty(segment) ) {
emote = emotes[segment];
if ( emote ) {
if ( text.length ) { if ( text.length ) {
// We have pending text. Join it together, with an extra space // We have pending text. Join it together, with an extra space
// on the end for good measure. // on the end for good measure.