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

« back to all changes in this revision

Viewing changes to console/console.js

  • Committer: dilshan_a
  • Date: 2008-01-23 04:54:10 UTC
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:trunk:270
Initial check in for test framework, and example problems

Show diffs side-by-side

added added

removed removed

Lines of Context:
71
71
 
72
72
var hist = new History();
73
73
 
 
74
function make_query_string(pagename, args)
 
75
{
 
76
    var first = true;
 
77
    var qs = pagename;
 
78
    for (key in args)
 
79
    {
 
80
        vals = args[key];
 
81
        // vals can be an array, to make multiple args with the same name
 
82
        // To handle this, make non-array objects into an array, then loop
 
83
        if (!(vals instanceof Array))
 
84
            vals = [vals];
 
85
        for each (val in vals)
 
86
        {
 
87
            if (first)
 
88
            {
 
89
                qs += "?";
 
90
                first = false;
 
91
            }
 
92
            else
 
93
            {
 
94
                qs += "&";
 
95
            }
 
96
            qs += encodeURIComponent(key) + "=" + encodeURIComponent(val);
 
97
        }
 
98
    }
 
99
    return qs;
 
100
}
 
101
 
74
102
function make_post_body(args)
75
103
{
 
104
    var first = true;
76
105
    var qs = '';
77
106
    for (key in args)
78
107
    {
81
110
        // To handle this, make non-array objects into an array, then loop
82
111
        if (!(vals instanceof Array))
83
112
            vals = [vals];
84
 
        var i;
85
 
        for (i=0; i<vals.length; i++)
 
113
        for each (val in vals)
86
114
        {
87
 
            if (i > 0)
 
115
            if (first)
 
116
            {
 
117
                first = false;
 
118
            }
 
119
            else
88
120
            {
89
121
                qs += "&";
90
122
            }
91
 
            qs += encodeURIComponent(key) + "=" + encodeURIComponent(vals[i]);
 
123
            qs += encodeURIComponent(key) + "=" + encodeURIComponent(val);
92
124
        }
93
125
    }
94
126
    return qs;