~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:54:56 UTC
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:trunk:593
console.js: Fixed not working when you pass a string to console_enter_line
    (now accepts strings OR nodes).

Show diffs side-by-side

added added

removed removed

Lines of Context:
217
217
 */
218
218
function console_enter_line(inputbox, which)
219
219
{
220
 
    GLOBAL_inputbox = inputbox;     /* For timer */
221
 
    var inputline = inputbox.value;
 
220
    if (typeof(inputbox) == "string")
 
221
    {
 
222
        var inputline = inputbox;
 
223
        inputbox = null;
 
224
        var graytimer = null;
 
225
    }
 
226
    else
 
227
    {
 
228
        GLOBAL_inputbox = inputbox;     /* For timer */
 
229
        var inputline = inputbox.value;
 
230
        var graytimer = setTimeout("GLOBAL_inputbox.setAttribute(\"class\", "
 
231
            + "\"disabled\");", 100);
 
232
    }
222
233
    var args = {"key": server_key, "text":inputline};
223
 
    var graytimer = setTimeout("GLOBAL_inputbox.setAttribute(\"class\", "
224
 
        + "\"disabled\");", 100);
225
234
    var callback = function(xhr)
226
235
        {
227
236
            console_response(inputline, xhr.responseText);
228
 
            /* Re-enable the text box */
229
 
            clearTimeout(graytimer);
230
 
            inputbox.removeAttribute("disabled");
231
 
            inputbox.removeAttribute("class");
 
237
            if (inputbox != null)
 
238
            {
 
239
                /* Re-enable the text box */
 
240
                clearTimeout(graytimer);
 
241
                inputbox.removeAttribute("disabled");
 
242
                inputbox.removeAttribute("class");
 
243
            }
232
244
        }
233
245
    /* Disable the text box */
234
 
    inputbox.setAttribute("disabled", "disabled");
 
246
    if (inputbox != null)
 
247
        inputbox.setAttribute("disabled", "disabled");
235
248
    ajax_call(callback, "consoleservice", which, args, "POST");
236
249
}
237
250