Track last chatMsg time, and ignore reconnect spam
This commit is contained in:
parent
aa04f0d034
commit
a398e3a6fa
|
@ -1170,6 +1170,8 @@ const Callbacks = {
|
|||
|
||||
window.Callbacks = Callbacks;
|
||||
|
||||
// For sanity, do this
|
||||
// localStorage.setItem('cytube_socket_omissions', '["mediaUpdate"]')
|
||||
var SOCKET_DEBUG = {
|
||||
enabled: (localStorage.getItem('cytube_socket_debug') === 'true'),
|
||||
omit: (((data)=>{
|
||||
|
|
|
@ -49,7 +49,8 @@ var CHATMAXSIZE = 100;
|
|||
var SCROLLCHAT = true;
|
||||
var IGNORE_SCROLL_EVENT = false;
|
||||
var LASTCHAT = {
|
||||
name: ""
|
||||
name: "",
|
||||
time: 0
|
||||
};
|
||||
var FOCUSED = true;
|
||||
var PAGETITLE = "CyTube";
|
||||
|
|
|
@ -1563,6 +1563,14 @@ function addChatMessage(data) {
|
|||
if (data.meta.shadow && !USEROPTS.show_shadowchat) {
|
||||
return;
|
||||
}
|
||||
// This is so we discard repeated messages
|
||||
// which become annoying when the user is experiencing repeated socketio reconnects
|
||||
if (data.time < LASTCHAT.time) {
|
||||
return;
|
||||
} else {
|
||||
LASTCHAT.time = data.time;
|
||||
}
|
||||
|
||||
var msgBuf = $("#messagebuffer");
|
||||
var div = formatChatMessage(data, LASTCHAT);
|
||||
// Incoming: a bunch of crap for the feature where if you hover over
|
||||
|
|
Loading…
Reference in a new issue