Skip to content

Commit

Permalink
Reduce chat spam
Browse files Browse the repository at this point in the history
  • Loading branch information
Tayyyyyyy committed Dec 25, 2017
1 parent d8001c1 commit 7ce91f8
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
15 changes: 15 additions & 0 deletions goon/browserassets/css/browserOutput.css
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,21 @@ a.popt {text-decoration: none;}
/* ADD HERE FOR ITALIC */
.italic, .ghostdronesay.broadcast {font-style: italic;}

/* BADGE */
.repeatBadge {
display: inline-block;
min-width: 0.5em;
font-size: 0.7em;
padding: 0.2em 0.3em;
line-height: 1;
color: white;
text-align: center;
white-space: nowrap;
vertical-align: middle;
background-color: crimson;
border-radius: 10px;
}

/* OUTPUT COLORS */
.highlight {background: yellow;}
h1, h2, h3, h4, h5, h6 {color: #0000ff;font-family: Georgia, Verdana, sans-serif;}
Expand Down
14 changes: 14 additions & 0 deletions goon/browserassets/js/browserOutput.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ var opts = {
'chatMode': 'default', //The mode the chat is in
'priorChatHeight': 0, //Thing for height-resizing detection
'restarting': false, //Is the round restarting?
'previousMessage': '',
'previousMessageCount': 1,

//Options menu
'subOptionsLoop': null, //Contains the interval loop for closing the options menu
Expand Down Expand Up @@ -268,7 +270,17 @@ function output(message, flag) {
emojiparse(entry);
}

if (entry.innerHTML === opts.previousMessage) {
opts.previousMessageCount++;
var lastIndex = $messages[0].children.length - 1;
var countBadge = '<span class="repeatBadge">x' + opts.previousMessageCount + '</span>';
$messages[0].children[lastIndex].innerHTML = opts.previousMessage + countBadge;
return;
}


opts.previousMessage = entry.innerHTML;
opts.previousMessageCount = 1;
$messages[0].appendChild(entry);

//Actually do the snap
Expand Down Expand Up @@ -932,6 +944,8 @@ $(function() {
$('#clearMessages').click(function() {
$messages.empty();
opts.messageCount = 0;
opts.previousMessage = '';
opts.previousMessageCount = 1;
});

// Tell BYOND to give us a macro list.
Expand Down

0 comments on commit 7ce91f8

Please sign in to comment.