//= require jquery
//= require spice-html5-bower
//= require_tree ../locale
//= require gettext/all

$(function() {
  var host = window.location.hostname;
  var encrypt = window.location.protocol === 'https:';
  var port = encrypt ? 443 : 80;
  if (window.location.port) {
    port = window.location.port;
  }

  $('#ctrlaltdel').click(sendCtrlAltDel);

  var spice = new SpiceMainConn({
    uri: (encrypt ? 'wss://' : 'ws://') + host + ':' + port + '/' + $('#remote-console').attr('data-url'),
    screen_id: "remote-console",
    password: $('#remote-console').attr('data-secret'),
    onerror: function(e) {
      spice.stop();
      $('#connection-status').removeClass('label-success label-warning').addClass('label-danger');
      $('#connection-status').text(__('Disconnected'));
      console.error("SPICE", e);
    },
    onsuccess: function() {
      $('#connection-status').removeClass('label-danger label-warning').addClass('label-success');
      $('#connection-status').text(__('Connected'));
    },
  });
});

//= require jquery
//= require spice-html5-bower
//= require_tree ../locale
//= require gettext/all

$(function() {
  var host = window.location.hostname;
  var encrypt = window.location.protocol === 'https:';
  var port = encrypt ? 443 : 80;
  if (window.location.port) {
    port = window.location.port;
  }

  $('#ctrlaltdel').click(sendCtrlAltDel);

  sc = new SpiceMainConn({
    uri: (encrypt ? 'wss://' : 'ws://') + host + ':' + port + '/' + $('#remote-console').attr('data-url'),
    screen_id: "remote-console",
    password: $('#remote-console').attr('data-secret'),
    onerror: function(e) {
      spice.stop();
      $('#connection-status').removeClass('label-success label-warning').addClass('label-danger');
      $('#connection-status').text(__('Disconnected'));
      console.error("SPICE", e);
    },
    onsuccess: function() {
      $('#connection-status').removeClass('label-danger label-warning').addClass('label-success');
      $('#connection-status').text(__('Connected'));
    },
  });
});

Fix CTRL-ALT-DEL button on Spice consoles
Fix CTRL-ALT-DEL button on Spice consoles

Appears that the current Spice JS library requires polluting the global namespace for this feature to work.
https://github.com/himdel/spice-html5-bower/blob/master/spiceHTML5/TODO#L28

https://bugzilla.redhat.com/show_bug.cgi?id=1491387
