Skip to content

Commit

Permalink
Also include a persistent auto ignore opponent toggle (#1557)
Browse files Browse the repository at this point in the history
  • Loading branch information
scheibo authored Jul 15, 2020
1 parent 5bbd8e5 commit dfa8948
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
9 changes: 8 additions & 1 deletion js/client-battle.js
Original file line number Diff line number Diff line change
Expand Up @@ -1407,6 +1407,7 @@
buf += '<p><strong>All battles</strong></p>';
buf += '<p><label class="optlabel"><input type="checkbox" name="ignorenicks"' + (Dex.prefs('ignorenicks') ? ' checked' : '') + ' /> Ignore nicknames</label></p>';
buf += '<p><label class="optlabel"><input type="checkbox" name="allignorespects"' + (Dex.prefs('ignorespects') ? ' checked' : '') + '/> Ignore spectators</label></p>';
buf += '<p><label class="optlabel"><input type="checkbox" name="allignoreopp"' + (Dex.prefs('ignoreopp') ? ' checked' : '') + '/> Ignore opponent</label></p>';
buf += '<p><label class="optlabel"><input type="checkbox" name="autotimer"' + (Dex.prefs('autotimer') ? ' checked' : '') + '/> Automatically start timer</label></p>';
if (rightPanelBattlesPossible) buf += '<p><label class="optlabel"><input type="checkbox" name="rightpanelbattles"' + (Dex.prefs('rightpanelbattles') ? ' checked' : '') + ' /> Open new battles on the right side</label></p>';
buf += '<p><button name="close">Close</button></p>';
Expand All @@ -1418,6 +1419,7 @@
'change input[name=ignoreopp]': 'toggleIgnoreOpponent',
'change input[name=hardcoremode]': 'toggleHardcoreMode',
'change input[name=allignorespects]': 'toggleAllIgnoreSpects',
'change input[name=allignoreopp]': 'toggleAllIgnoreOpponent',
'change input[name=autotimer]': 'toggleAutoTimer',
'change input[name=rightpanelbattles]': 'toggleRightPanelBattles'
},
Expand All @@ -1443,7 +1445,7 @@
toggleAllIgnoreSpects: function (e) {
var ignoreSpects = !!e.currentTarget.checked;
Dex.prefs('ignorespects', ignoreSpects);
if (ignoreSpects && !this.battle.ignoreSpects) this.$el.find('input[name=ignoreSpects]').click();
if (ignoreSpects && !this.battle.ignoreSpects) this.$el.find('input[name=ignorespects]').click();
},
toggleIgnoreNicks: function (e) {
this.battle.ignoreNicks = !!e.currentTarget.checked;
Expand All @@ -1456,6 +1458,11 @@
this.battle.add('Opponent ' + (this.battle.ignoreOpponent ? '' : 'no longer ') + 'ignored.');
this.battle.resetToCurrentTurn();
},
toggleAllIgnoreOpponent: function (e) {
var ignoreOpponent = !!e.currentTarget.checked;
Dex.prefs('ignoreopp', ignoreOpponent);
if (ignoreOpponent && !this.battle.ignoreOpponent) this.$el.find('input[name=ignoreopp]').click();
},
toggleAutoTimer: function (e) {
var autoTimer = !!e.currentTarget.checked;
Dex.prefs('autotimer', autoTimer);
Expand Down
2 changes: 1 addition & 1 deletion src/battle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1077,7 +1077,7 @@ class Battle {
roomid = '';
hardcoreMode = false;
ignoreNicks = !!Dex.prefs('ignorenicks');
ignoreOpponent = false;
ignoreOpponent = !!Dex.prefs('ignoreopp');
ignoreSpects = !!Dex.prefs('ignorespects');
debug = false;
joinButtons = false;
Expand Down

0 comments on commit dfa8948

Please sign in to comment.