~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-02-25 23:05:08 UTC
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:trunk:590
console: Added disabling of the input box when waiting for a response from the
    server.
    Waits 100ms before greying out the box.

Show diffs side-by-side

added added

removed removed

Lines of Context:
215
215
 * to its response by writing to the output box.
216
216
 * Also maximize the console window if not already.
217
217
 */
218
 
function console_enter_line(inputline, which)
 
218
function console_enter_line(inputbox, which)
219
219
{
 
220
    GLOBAL_inputbox = inputbox;     /* For timer */
 
221
    var inputline = inputbox.value;
220
222
    var args = {"key": server_key, "text":inputline};
 
223
    var graytimer = setTimeout("GLOBAL_inputbox.setAttribute(\"class\", "
 
224
        + "\"disabled\");", 100);
221
225
    var callback = function(xhr)
222
226
        {
223
227
            console_response(inputline, xhr.responseText);
 
228
            /* Re-enable the text box */
 
229
            clearTimeout(graytimer);
 
230
            inputbox.removeAttribute("disabled");
 
231
            inputbox.removeAttribute("class");
224
232
        }
 
233
    /* Disable the text box */
 
234
    inputbox.setAttribute("disabled", "disabled");
225
235
    ajax_call(callback, "consoleservice", which, args, "POST");
226
236
}
227
237
 
326
336
        var callback = function()
327
337
        {
328
338
            /* Send the line of text to the server */
329
 
            console_enter_line(inp.value, "chat");
 
339
            console_enter_line(inp, "chat");
330
340
            hist.submit(inp.value);
331
341
            inp.value = hist.curr();
332
342
        }