forked from GitHub/gf-core
minibar/support.js: added function encodeArgs.
This commit is contained in:
@@ -17,10 +17,7 @@ function pgf_online(options) {
|
||||
http_get_json(this.grammars_url+"grammars.cgi",cont);
|
||||
},
|
||||
pgf_call: function(cmd,args,cont) {
|
||||
var url=this.current_grammar_url+"?command="+cmd;
|
||||
for(var arg in args)
|
||||
if(args[arg]!=undefined)
|
||||
url+="&"+arg+"="+encodeURIComponent(args[arg]);
|
||||
var url=this.current_grammar_url+"?command="+cmd+encodeArgs(args)
|
||||
http_get_json(url,cont);
|
||||
},
|
||||
|
||||
|
||||
@@ -112,6 +112,15 @@ function http_get_json(url,cont) {
|
||||
else jsonpf(url,cont);
|
||||
}
|
||||
|
||||
/* --- URL construction ----------------------------------------------------- */
|
||||
|
||||
function encodeArgs(args) {
|
||||
var q=""
|
||||
for(var arg in args)
|
||||
if(args[arg]!=undefined)
|
||||
q+="&"+arg+"="+encodeURIComponent(args[arg]);
|
||||
return q;
|
||||
}
|
||||
|
||||
/* --- HTML construction ---------------------------------------------------- */
|
||||
function text(s) { return document.createTextNode(s); }
|
||||
|
||||
Reference in New Issue
Block a user