<commit_before>var game = require('game').game;
var xhr = require('./xhr');
var m = require('mithril');

module.exports = function(ctrl, key) {

  this.value = lichess.storage.get(key) === '1';

  var store = function() {
    lichess.storage.set(key, this.value ? '1' : '0');
  }.bind(this);

  this.toggle = function() {
    this.value = !this.value;
    store();
    this.next();
    return this.value;
  }.bind(this);

  this.get = function() {
    return this.value;
  }.bind(this);

  this.set = function(v) {
    this.value = v;
    store();
  }.bind(this);

  this.next = function() {
    if (!this.value || ctrl.data.player.spectator || ctrl.data.game.tournamentId || game.isPlayerTurn(ctrl.data)) return;
    ctrl.vm.redirecting = true;
    lichess.hasToReload = true;
    location.href = ctrl.router.Round.next(ctrl.data.game.id).url;
    m.redraw();
  }.bind(this);
};<commit_msg>only move on during simuls<commit_after>var game = require('game').game;
var xhr = require('./xhr');
var m = require('mithril');

module.exports = function(ctrl, key) {

  this.value = lichess.storage.get(key) === '1';

  var store = function() {
    lichess.storage.set(key, this.value ? '1' : '0');
  }.bind(this);

  this.toggle = function() {
    this.value = !this.value;
    store();
    this.next();
    return this.value;
  }.bind(this);

  this.get = function() {
    return this.value;
  }.bind(this);

  this.set = function(v) {
    this.value = v;
    store();
  }.bind(this);

  this.next = function() {
    if (!ctrl.data.simul) return;
    if (!this.value || ctrl.data.player.spectator || ctrl.data.game.tournamentId || game.isPlayerTurn(ctrl.data)) return;
    ctrl.vm.redirecting = true;
    lichess.hasToReload = true;
    location.href = ctrl.router.Round.next(ctrl.data.game.id).url;
    m.redraw();
  }.bind(this);
};
{'fraction_non_alphanumeric': 0.1913613996719519, 'fraction_numerical': 0.0032804811372334607, 'mean_word_length': 3.159090909090909, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2062404', 'n_tokens_mistral': 677, 'n_tokens_neox': 644, 'n_words': 125}