~azzar1/unity/add-show-desktop-key

« back to all changes in this revision

Viewing changes to www/media/console/console.js

  • Committer: mattgiuca
  • Date: 2008-01-09 21:33:56 UTC
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:trunk:144
Trunk, and all subdirectories with Python files:
    Added to svn:ignore all *.pyc *.pyo, to avoid compiled files
    showing up in svn st / diff / commit lists.
    Added to svn:ignore trampoline/trampoline.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
digest_constant = "hello";
2
 
 
3
 
/* Starts the console server.
4
 
 * Returns an object with fields "host", "port", "magic" describing the
5
 
 * server.
6
 
 */
7
 
function start_server()
8
 
{
9
 
    var xhr = ajax_call("consoleservice", "start", "", "POST");
10
 
    var json_text = xhr.responseText;
11
 
    return JSON.parse(json_text);
12
 
}
13
 
 
14
 
function onload()
15
 
{
16
 
    var consolebody = document.getElementById("consolebody");
17
 
    var iframe = document.createElement("iframe");
18
 
    consolebody.appendChild(iframe);
19
 
    iframe.setAttribute("width", "100%");
20
 
    /* TODO: Height 100%, once CSS is working */
21
 
    iframe.setAttribute("height", "600px");
22
 
 
23
 
    /* Start the server */
24
 
    var server_info = start_server();
25
 
 
26
 
    var digest = hex_md5(digest_constant + server_info.magic);
27
 
 
28
 
    var url = "http://"
29
 
        + server_info.host.toString() + ":"
30
 
        + server_info.port.toString() + "?digest=" + digest;
31
 
 
32
 
    iframe.setAttribute("src", url);
33
 
}