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

« back to all changes in this revision

Viewing changes to console/console.js

  • Committer: mattgiuca
  • Date: 2008-01-23 06:17:35 UTC
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:trunk:274
console/console.js: Removed make_query_string (not being used, and mostly
    duplicated with make_post_body).
    Fixed "for each" loop over Array, changed to explicit i counted for loop.

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
 
 
102
74
function make_post_body(args)
103
75
{
104
76
    var first = true;
110
82
        // To handle this, make non-array objects into an array, then loop
111
83
        if (!(vals instanceof Array))
112
84
            vals = [vals];
113
 
        for each (val in vals)
 
85
        var i;
 
86
        for (i=0; i<vals.length; i++)
114
87
        {
115
88
            if (first)
116
89
            {
120
93
            {
121
94
                qs += "&";
122
95
            }
123
 
            qs += encodeURIComponent(key) + "=" + encodeURIComponent(val);
 
96
            qs += encodeURIComponent(key) + "=" + encodeURIComponent(vals[i]);
124
97
        }
125
98
    }
126
99
    return qs;