 # Callback for when the user's games are retrieved from the server. Sets up
 # some reactive functions and handles facebook ?request_ids params
 onSubscribe = ->
-  # Update the URL when the game ID changes
-  Meteor.autorun ->
-    gameId = Session.get("gameId")
-    if gameId then window.history.pushState({}, "", "/#{gameId}")
-
   # Update game scale when scaleFactor changes
   Meteor.autorun ->
     scaleFactor = Session.get("scaleFactor")


  # Called whenever the game state changes to noughts.state.PLAY, initializes the
  # game and hooks up the appropriate game click event handlers.
  onResetEvent: ->
    gameId = Session.get("gameId")
    window.history.pushState({}, "", "/#{gameId}")
    $(".nGame").children().hide()
    $(".nGame").css({border: "none"})
    $(".nMain canvas").show()

noughts.maybeInitialize = _.after 2, ->
  cacheFacebookData() if Session.get("useFacebook")
  Meteor.subscribe("myGames", onSubscribe)

  $(window).on "popstate", ->
    setStateFromUrl()

# Inspects the URL and sets the initial game state accordingly.
setStateFromUrl = ->
