<commit_before>mediator = require 'mediator'

module.exports = class DialogManager
  constructor: ->
    @source = document.getElementById 'dialog-template'
    @template = Handlebars.compile(@source.innerText)
    mediator.dialogManager = @

  showDialog: (data, callback) =>
    result = $ @template(data)
    that = this

    result.children('.dialog-option').click (event) ->
      that.hideDialog()
      id = parseInt( $(this).prop('id') )
      callback(id + 1) if callback

    $('#dialog').append(result).
    css('left', 0).
    css('top', homepageview.canvas.height + 2).
    css('width', homepageview.canvas.width).
    fadeIn()


  hideDialog: () =><commit_msg>Fix dialogmanager only working in debug mode<commit_after>mediator = require 'mediator'

module.exports = class DialogManager
  constructor: ->
    @source = document.getElementById 'dialog-template'
    @template = Handlebars.compile(@source.innerText)
    @canvas = document.getElementById 'game-canvas'
    mediator.dialogManager = @

  showDialog: (data, callback) =>
    result = $ @template(data)
    that = this

    result.children('.dialog-option').click (event) ->
      that.hideDialog()
      id = parseInt( $(this).prop('id') )
      callback(id + 1) if callback

    $('#dialog').append(result).
    css('left', 0).
    css('top', @canvas.height + 2).
    css('width', @canvas.width).
    fadeIn()


  hideDialog: () =>
{'fraction_non_alphanumeric': 0.15778251599147122, 'fraction_numerical': 0.0042643923240938165, 'mean_word_length': 3.3591331269349847, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, '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': '339161', 'n_tokens_mistral': 427, 'n_tokens_neox': 412, 'n_words': 89}