1
0
Fork 0
mirror of https://github.com/FrankerFaceZ/FrankerFaceZ.git synced 2025-07-26 04:28:31 +00:00

Fix issues with scrolling and removing old chat lines when we can't find Twitch's own chat line type mapping.

This commit is contained in:
SirStendec 2017-11-16 14:24:17 -05:00
parent c86895797c
commit a887425602
2 changed files with 26 additions and 5 deletions

View file

@ -1,3 +1,16 @@
<div class="list-header">4.0.0-beta1.3<span>@bdf2ec93761131252233</span> <time datetime="2017-11-16">(2017-11-16)</time></div>
<ul class="chat-menu-content menu-side-padding">
<li>Fixed: Issue with chat scrolling when the world doesn't make any sense.</li>
</ul>
<div class="list-header">4.0.0-beta1.3<span>@3feb3c14c65d7ebbed91</span> <time datetime="2017-11-16">(2017-11-16)</time></div>
<ul class="chat-menu-content menu-side-padding">
<li>Added: Temporary legacy API implementation to allow FFZ:AP channel and global emotes to work.</li>
<li>Added: A few options for the player, including scroll to change volume.</li>
<li>Fixed: Height of the FFZ control center.</li>
<li>Changed: Just another minor scroller change to make absolutely sure any issues aren't the result of FFZ.</li>
</ul>
<div class="list-header">4.0.0-beta1.3<span>@f855394a01c28a59836c</span> <time datetime="2017-11-15">(2017-11-15)</time></div> <div class="list-header">4.0.0-beta1.3<span>@f855394a01c28a59836c</span> <time datetime="2017-11-15">(2017-11-15)</time></div>
<ul class="chat-menu-content menu-side-padding"> <ul class="chat-menu-content menu-side-padding">
<li>Changed: Simplify the Chat Freeze code just a bit more to reduce the chance of bugs.</li> <li>Changed: Simplify the Chat Freeze code just a bit more to reduce the chance of bugs.</li>

View file

@ -13,6 +13,7 @@ import Module from 'utilities/module';
import Scroller from './scroller'; import Scroller from './scroller';
import ChatLine from './line'; import ChatLine from './line';
import SettingsMenu from './settings_menu'; import SettingsMenu from './settings_menu';
//import EmoteMenu from './emote_menu';
const ChatTypes = (e => { const ChatTypes = (e => {
@ -44,7 +45,8 @@ const ChatTypes = (e => {
e[e.Notice = 25] = "Notice", e[e.Notice = 25] = "Notice",
e[e.Info = 26] = "Info",*/ e[e.Info = 26] = "Info",*/
e[e.BadgesUpdated = 27] = "BadgesUpdated"; e[e.BadgesUpdated = 27] = "BadgesUpdated";
//e[e.Purchase = 28] = "Purchase" //e[e.Purchase = 28] = "Purchase";
return e;
})({}); })({});
@ -101,6 +103,7 @@ export default class ChatHook extends Module {
this.inject(Scroller); this.inject(Scroller);
this.inject(ChatLine); this.inject(ChatLine);
this.inject(SettingsMenu); this.inject(SettingsMenu);
//this.inject(EmoteMenu);
this.ChatController = this.fine.define( this.ChatController = this.fine.define(
@ -272,8 +275,13 @@ export default class ChatHook extends Module {
onEnable() { onEnable() {
this.on('site.web_munch:loaded', () => {
const ct = this.web_munch.getModule('chat-types');
this.chatTypes = ct && ct.a || ChatTypes;
})
const ct = this.web_munch.getModule('chat-types'); const ct = this.web_munch.getModule('chat-types');
this.chatTypes = ct ? ct.a : ChatTypes; this.chatTypes = ct && ct.a || ChatTypes;
this.chat.context.on('changed:chat.width', this.updateChatCSS, this); this.chat.context.on('changed:chat.width', this.updateChatCSS, this);
this.chat.context.on('changed:chat.font-size', this.updateChatCSS, this); this.chat.context.on('changed:chat.font-size', this.updateChatCSS, this);
@ -352,7 +360,7 @@ export default class ChatHook extends Module {
cls.prototype.toArray = function() { cls.prototype.toArray = function() {
const buf = this.buffer, const buf = this.buffer,
ct = t.chatTypes, ct = t.chatTypes || ChatTypes,
target = buf.length - this.maxSize; target = buf.length - this.maxSize;
if ( target > 0 ) { if ( target > 0 ) {
@ -363,10 +371,10 @@ export default class ChatHook extends Module {
last = i; last = i;
} }
this.buffer = buf.slice(removed % 2 === 0 ? target : last); this.buffer = buf.slice(removed % 2 === 0 ? target : Math.max(target - 10, last));
} else } else
// Make a shallow copy of the array because other code expects it to change. // Make a shallow copy of the array because other code expects it to change.
this.buffer = Array.from(buf); this.buffer = buf.slice(target);
this._isDirty = false; this._isDirty = false;
return this.buffer; return this.buffer;