<commit_before>var sock

var currentGoal
  , targetTitle = document.querySelector('#target-title')
  , targetHint = document.querySelector('#target-hint')
  , goButton = document.querySelector('#go')
  , goPrivButton = document.querySelector('#go-priv')
  , gameLinkWrapEl = document.querySelector('#game-link')
  , gameLinkEl = gameLinkWrapEl.querySelector('input')
  , backlinksEl = document.querySelector('#backlinks')
  , backlinksList = backlinksEl.querySelector('ul')
  , backlinksInfo = document.querySelector('#show-backlinks')
  , backlinksInput = backlinksInfo.querySelector('input')
  , cachedPages = {}
  , _players = {}
  , me = Player(document.querySelector('#left')
              , document.querySelector('#left-mask'))
  , opponent = Player(document.querySelector('#right')
                    , document.querySelector('#right-mask'))
  , game = {}
  , _private = false

function Player(area, mask) {
  if (!(this instanceof Player)) return new Player(area, mask)
  this.area = area
  this.mask = mask
  this.title = area.querySelector('.current-title')
  this.content = area.querySelector('.content')
  this.path = []
}

goButton.addEventListener('click', go, false)
goPrivButton.addEventListener('click', goPriv, false)

if (location.hash.substr(0, 6) === '#game:') {
  document.querySelector('#game-id').innerHTML = location.hash.substr(1)
  document.querySelector('#friend').style.display = 'none'
  addClass(document.body, 'invited')
}

function go() {
  me.content.addEventListener('click', onClick, false)
  me.area.addEventListener('mousewheel', throttle(onScroll, 50), false)
  opponent.content.addEventListener('click', preventDefault, false)
  opponent.content.addEventListener('mousewheel', preventDefault, false)

  sock = io.connect(location.protocol + '//' + location.hostname + ':' + location.port)
  sock.on('start', onStart)
  sock.on('navigated', onOpponentNavigated)
  sock.on('won', onWon)
  sock.on('lost', onLost)
  sock.on('paths', onReceivePaths)
  sock.on('scrolled', onOpponentScrolled)
  sock.on('hint', onHint)
  sock.on('backlinks', onBacklinks)
  sock.on('id', function (id) { me.id = id, _players[id] = me })
  sock.on('connection', function (id) { opponent.id = id, _players[id] = opponent })

  var connectType = _private ? 'new' : 'pair'
    , connectId = null
  if (!_private && location.hash.substr(0, 6) === '#game:') {
    connectType = 'join'
    connectId = location.hash.substr(1)
  }
  sock.emit('gameType', connectType, connectId, function (err, gameId, playerId, status) {
    if (err) {
      alert(err)
      return
    }
    game.id = gameId
    location.hash = gameId
    me.id = playerId
    if (status === 'wait') {
      waiting()
    }
  })

  goButton.disabled = true
  goButton.removeEventListener('click', go)
  goPrivButton.disabled = true
  goPrivButton.removeEventListener('click', goPriv)
}
function goPriv() {
  _private = true
  go(true)
}

function restart() {<commit_msg>don't set location hash fragment for "random" opponent games<commit_after>var sock

var currentGoal
  , targetTitle = document.querySelector('#target-title')
  , targetHint = document.querySelector('#target-hint')
  , goButton = document.querySelector('#go')
  , goPrivButton = document.querySelector('#go-priv')
  , gameLinkWrapEl = document.querySelector('#game-link')
  , gameLinkEl = gameLinkWrapEl.querySelector('input')
  , backlinksEl = document.querySelector('#backlinks')
  , backlinksList = backlinksEl.querySelector('ul')
  , backlinksInfo = document.querySelector('#show-backlinks')
  , backlinksInput = backlinksInfo.querySelector('input')
  , cachedPages = {}
  , _players = {}
  , me = Player(document.querySelector('#left')
              , document.querySelector('#left-mask'))
  , opponent = Player(document.querySelector('#right')
                    , document.querySelector('#right-mask'))
  , game = {}
  , _private = false

function Player(area, mask) {
  if (!(this instanceof Player)) return new Player(area, mask)
  this.area = area
  this.mask = mask
  this.title = area.querySelector('.current-title')
  this.content = area.querySelector('.content')
  this.path = []
}

goButton.addEventListener('click', go, false)
goPrivButton.addEventListener('click', goPriv, false)

if (location.hash.substr(0, 6) === '#game:') {
  document.querySelector('#game-id').innerHTML = location.hash.substr(1)
  document.querySelector('#friend').style.display = 'none'
  addClass(document.body, 'invited')
}

function go() {
  me.content.addEventListener('click', onClick, false)
  me.area.addEventListener('mousewheel', throttle(onScroll, 50), false)
  opponent.content.addEventListener('click', preventDefault, false)
  opponent.content.addEventListener('mousewheel', preventDefault, false)

  sock = io.connect(location.protocol + '//' + location.hostname + ':' + location.port)
  sock.on('start', onStart)
  sock.on('navigated', onOpponentNavigated)
  sock.on('won', onWon)
  sock.on('lost', onLost)
  sock.on('paths', onReceivePaths)
  sock.on('scrolled', onOpponentScrolled)
  sock.on('hint', onHint)
  sock.on('backlinks', onBacklinks)
  sock.on('id', function (id) { me.id = id, _players[id] = me })
  sock.on('connection', function (id) { opponent.id = id, _players[id] = opponent })

  var connectType = _private ? 'new' : 'pair'
    , connectId = null
  if (!_private && location.hash.substr(0, 6) === '#game:') {
    connectType = 'join'
    connectId = location.hash.substr(1)
  }
  sock.emit('gameType', connectType, connectId, function (err, gameId, playerId, status) {
    if (err) {
      alert(err)
      return
    }
    game.id = gameId
    me.id = playerId
    if (connectType !== 'pair') {
      location.hash = gameId
    }
    if (status === 'wait') {
      waiting()
    }
  })

  goButton.disabled = true
  goButton.removeEventListener('click', go)
  goPrivButton.disabled = true
  goPrivButton.removeEventListener('click', goPriv)
}
function goPriv() {
  _private = true
  go(true)
}

function restart() {
{'fraction_non_alphanumeric': 0.15890502420297112, 'fraction_numerical': 0.002670672675680187, 'mean_word_length': 4.316770186335404, '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': '1174354', 'n_tokens_mistral': 1859, 'n_tokens_neox': 1861, 'n_words': 357}