Skip to content

Commit

Permalink
Add a preferences setting
Browse files Browse the repository at this point in the history
  • Loading branch information
Tayyyyyyy committed Dec 25, 2017
1 parent 7ce91f8 commit 8eb50ae
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
3 changes: 2 additions & 1 deletion goon/browserassets/html/browserOutput.html
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
<a href="#" class="decreaseFont" id="decreaseFont"><span>Decrease font size</span> <i class="icon-font">-</i></a>
<a href="#" class="increaseFont" id="increaseFont"><span>Increase font size</span> <i class="icon-font">+</i></a>
<a href="#" class="chooseFont" id="chooseFont">Change font <i class="icon-font"></i></a>
<a href="#" class="toggleHideSpam" id="toggleHideSpam"><span>Condense chat</span> <i class="icon-font">Ø</i></a>
<a href="#" class="togglePing" id="togglePing"><span>Toggle ping display</span> <i class="icon-circle"></i></a>
<a href="#" class="highlightTerm" id="highlightTerm"><span>Highlight string</span> <i class="icon-tag"></i></a>
<a href="#" class="saveLog" id="saveLog"><span>Save chat log</span> <i class="icon-save"></i></a>
Expand All @@ -66,4 +67,4 @@
</script>
<![endif]-->
</body>
</html>
</html>
14 changes: 13 additions & 1 deletion goon/browserassets/js/browserOutput.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ var opts = {
'restarting': false, //Is the round restarting?
'previousMessage': '',
'previousMessageCount': 1,
'hideSpam': false,

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

if (entry.innerHTML === opts.previousMessage) {
if (opts.hideSpam && entry.innerHTML === opts.previousMessage) {
opts.previousMessageCount++;
var lastIndex = $messages[0].children.length - 1;
var countBadge = '<span class="repeatBadge">x' + opts.previousMessageCount + '</span>';
Expand Down Expand Up @@ -545,6 +546,7 @@ $(function() {
'spingDisabled': getCookie('pingdisabled'),
'shighlightTerms': getCookie('highlightterms'),
'shighlightColor': getCookie('highlightcolor'),
'shideSpam': getCookie('hidespam'),
};

if (savedConfig.sfontSize) {
Expand Down Expand Up @@ -580,6 +582,10 @@ $(function() {
opts.highlightColor = savedConfig.shighlightColor;
internalOutput('<span class="internal boldnshit">Loaded highlight color of: '+savedConfig.shighlightColor+'</span>', 'internal');
}
if (savedConfig.shideSpam) {
opts.hideSpam = $.parseJSON(savedConfig.shideSpam);
internalOutput('<span class="internal boldnshit">Loaded hide spam preference of: ' + savedConfig.shideSpam + '</span>', 'internal');
}

(function() {
var dataCookie = getCookie('connData');
Expand Down Expand Up @@ -839,6 +845,12 @@ $(function() {
setCookie('fonttype', font, 365);
});

$('#toggleHideSpam').click(function(e) {
opts.hideSpam = !opts.hideSpam;
setCookie('hidespam', opts.hideSpam, 365);
internalOutput('<span class="internal boldnshit">Duplicate chat line condensing set to ' + opts.hideSpam + '</span>', 'internal');
});

$('#togglePing').click(function(e) {
if (opts.pingDisabled) {
$('#ping').slideDown('fast');
Expand Down

0 comments on commit 8eb50ae

Please sign in to comment.