diff --git a/js/client-battle.js b/js/client-battle.js index 17c4db821..f701f34d0 100644 --- a/js/client-battle.js +++ b/js/client-battle.js @@ -47,6 +47,7 @@ this.battle.startCallback = function () { self.updateControls(); }; this.battle.stagnateCallback = function () { self.updateControls(); }; + if (Dex.prefs('autotimer')) this.setTimer('on'); this.battle.play(); }, events: { @@ -1393,10 +1394,12 @@ var rightPanelBattlesPossible = (MainMenuRoom.prototype.bestWidth + BattleRoom.prototype.minWidth < $(window).width()); var buf = '
In this battle
'; buf += ''; - buf += ''; - buf += ''; + buf += ''; + buf += ''; buf += 'All battles
'; buf += ''; + buf += ''; + buf += ''; if (rightPanelBattlesPossible) buf += ''; buf += ''; this.$el.html(buf); @@ -1406,6 +1409,8 @@ 'change input[name=ignorenicks]': 'toggleIgnoreNicks', 'change input[name=ignoreopp]': 'toggleIgnoreOpponent', 'change input[name=hardcoremode]': 'toggleHardcoreMode', + 'change input[name=allignorespects]': 'toggleAllIgnoreSpects', + 'change input[name=autotimer]': 'toggleAutoTimer', 'change input[name=rightpanelbattles]': 'toggleRightPanelBattles' }, toggleHardcoreMode: function (e) { @@ -1427,6 +1432,11 @@ $messages.show(); } }, + toggleAllIgnoreSpects: function (e) { + var ignoreSpects = !!e.currentTarget.checked; + Dex.prefs('ignorespects', ignoreSpects); + if (ignoreSpects && !this.battle.ignoreSpects) this.$el.find('input[name=ignoreSpects]').click(); + }, toggleIgnoreNicks: function (e) { this.battle.ignoreNicks = !!e.currentTarget.checked; Dex.prefs('ignorenicks', this.battle.ignoreNicks); @@ -1438,6 +1448,11 @@ this.battle.add('Opponent ' + (this.battle.ignoreOpponent ? '' : 'no longer ') + 'ignored.'); this.battle.resetToCurrentTurn(); }, + toggleAutoTimer: function (e) { + var autoTimer = !!e.currentTarget.checked; + Dex.prefs('autotimer', autoTimer); + if (autoTimer) this.room.setTimer('on'); + }, toggleRightPanelBattles: function (e) { Dex.prefs('rightpanelbattles', !!e.currentTarget.checked); } diff --git a/src/battle.ts b/src/battle.ts index 51be765d7..9051f1da4 100644 --- a/src/battle.ts +++ b/src/battle.ts @@ -1076,9 +1076,9 @@ class Battle { id = ''; roomid = ''; hardcoreMode = false; - ignoreNicks = Dex.prefs('ignorenicks'); + ignoreNicks = !!Dex.prefs('ignorenicks'); ignoreOpponent = false; - ignoreSpects = false; + ignoreSpects = !!Dex.prefs('ignorespects'); debug = false; joinButtons = false;