@@ -7,6 +7,7 @@ const conf = {
77 nick : 'justinfan64537' , // same as anonymous chatterino
88 joins : opt . getAll ( 'join' ) ,
99 timeout : parseInt ( opt . get ( 'time' ) , 10 ) * 1000 ,
10+ maxReplyLen : 100 ,
1011 emoteStyle : opt . has ( 'static' ) ? 'static' : 'default' ,
1112 emoteScale : ( { 2 : '2' , 3 : '3' } ) [ opt . get ( 'scale' ) ] ?? '1' ,
1213 avatarSize : ( { 2 : '50x50' , 3 : '70x70' } ) [ opt . get ( 'scale' ) ] ?? '28x28' ,
@@ -99,7 +100,7 @@ function receive (event)
99100 {
100101 for ( const del of conf . chat . querySelectorAll
101102 ( `.chat-line[data-room-id="${ rid } "][data-user-id="${ uid } "]` ) )
102- del . remove ( ) ;
103+ deleteMessage ( del ) ;
103104 const seconds = msg . tags [ 'ban-duration' ] ;
104105 const action = seconds
105106 ? 'timed out for ' + conf . duration . format ( { seconds } )
@@ -111,7 +112,7 @@ function receive (event)
111112 {
112113 for ( const del of conf . chat . querySelectorAll
113114 ( `.chat-line[data-room-id="${ rid } "]` ) )
114- del . remove ( ) ;
115+ deleteMessage ( del ) ;
115116 msg . source = '' ;
116117 msg . params [ 1 ] = 'The chat has been cleared.' ;
117118 }
@@ -120,8 +121,7 @@ function receive (event)
120121 break ;
121122
122123 case 'CLEARMSG' :
123- document . getElementById ( msg . tags [ 'target-msg-id' ] )
124- ?. remove ( ) ;
124+ deleteMessage ( document . getElementById ( msg . tags [ 'target-msg-id' ] ) ) ;
125125 break ;
126126
127127 case 'JOIN' :
@@ -173,6 +173,16 @@ function reduceColors ()
173173 delete conf . colors [ uid ] ;
174174}
175175
176+ function deleteMessage ( msg )
177+ {
178+ if ( ! msg )
179+ return ;
180+ if ( opt . has ( 'rm' ) )
181+ msg . classList . add ( 'delete' ) ;
182+ else
183+ msg . remove ( ) ;
184+ }
185+
176186async function joinedRoom ( rid )
177187{
178188 if ( conf . joinedRooms . includes ( rid ) )
@@ -407,10 +417,12 @@ function formatChat (msg, p)
407417 if ( msg . tags [ 'msg-param-color' ] == 'PRIMARY' )
408418 p . style . borderRightColor = conf . badges . room [ rid ] ?. primary ?? '' ;
409419
410- const replyTo = msg . tags [ 'reply-parent-msg-body' ] ;
420+ let replyTo = msg . tags [ 'reply-parent-msg-body' ] ;
411421 if ( replyTo )
412422 {
413423 const reply = conf . template . reply . cloneNode ( true ) ;
424+ if ( opt . has ( 'style' , 'wrap' ) && replyTo . length > conf . maxReplyLen )
425+ replyTo = replyTo . slice ( 0 , conf . maxReplyLen ) + '…' ;
414426 reply . firstElementChild . textContent = replyTo ;
415427 const replyMsg = reply . querySelector ( '.message' ) ;
416428 replyMsg . replaceChildren ( ...message . childNodes ) ;
@@ -556,6 +568,7 @@ function extEmotes (msg, rid, uid, message)
556568 prefix . previousSibling . remove ( ) ;
557569 prefix . classList . remove ( 'prefix' ) ;
558570 prefix . nextSibling . classList . add ( ...prefix . classList ) ;
571+ prefix . nextSibling . title = prefix . alt + ' ' + prefix . nextSibling . title ;
559572 prefix . remove ( ) ;
560573 }
561574 }
@@ -569,6 +582,7 @@ function extEmotes (msg, rid, uid, message)
569582 {
570583 suffix . classList . remove ( 'suffix' ) ;
571584 suffix . previousSibling . classList . add ( ...suffix . classList ) ;
585+ suffix . previousSibling . title += ' ' + suffix . alt ;
572586 suffix . remove ( ) ;
573587 }
574588 }
0 commit comments