 # You can use CoffeeScript in this file: http://coffeescript.org/
 
 $ ->
+  saving = false
+
   textEditor = ace.edit('text-editor')
   textEditor.setTheme('ace/theme/clouds')
   textEditor.setShowInvisibles(true)

  )

  window.onbeforeunload = (event) ->
    if session.getDocument().getValue().length > 0
      return '作成中のプログラムが消えてしまいます。'
    else
      return

      data =
        filename: filename
        source: session.getDocument().getValue()
      saving = true
      location.href = '/editor/save_file?' + $.param(data)

  $('#load-button').click ->
