$(function() {

  var ghost = $("#ghost");

  function setup_ghost() {
    ghost.attr("src", CONF.ghost.asset.default);
    change_ghost_size();
  }

  function change_ghost_size() {
    ghost.css({width: CONF.ghost.size});
  }

  var cc = setInterval(function() {
    if (CONF) {
      window.electron.ipcRenderer.send('ghostconf-message', JSON.stringify(CONF));
      clearInterval(cc);
    }
  }, 500);

  $("#ghost_clickarea").on("dblclick", function() {
    window.electron.ipcRenderer.send('menuopen-message', "1");
  });

  setup_ghost();

});
