goosh.module.place = function(){ this.name = "place"; this.aliases = new Array("places","place","map","p"); this.mode = true; this.start = 0; this.args =""; this.parameters = "[address]"; this.help = "google maps search"; this.helptext = "examples:
"+ "place New York - show new york in a map
"; this.query = function(cmdstr,query) { //output.innerHTML += "COMMAND:"+cmdstr+"/"+query+"/"+this.name+".
"; // debug goosh.ajax.query("http://maps.google.com/maps/geo?q="+encodeURIComponent(query)+"&output=json&callback=goosh.modobj."+this.name+".render&key="+goosh.config.apikey+"&lang="+goosh.config.lang); } this.call = function(args){ if(args.length > 0) this.start = 0; this.results = new Array(); this.args = args.join(" "); this.query(this.name,args.join(" ")); } this.render = function(results){ if(goosh.ajax.iscontext(goosh.ajax.lastcontext)){ if(results && results.Placemark){ results.results = new Array(); for(i=0;i= 4) detail = 10; if(acc >= 6) detail = 14; results.results[i] = new Array(); results.results[i].title = r.address; results.results[i].unescapedUrl = "http://maps.google.com/maps?f=q&hl="+goosh.config.lang+"&q="+encodeURIComponent(r.address)+"¢er="+r.Point.coordinates[1]+","+r.Point.coordinates[0]+"&zoom="+(detail); results.results[i].content = ""; results.results[i].thumb = ""; } } this.hasmore = true; this.results = results.results; this.renderResult(goosh.ajax.lastcontext, results); } else { goosh.gui.error("Place ""+this.args+"" not found."); } if(this.results.length <= this.start+ parseInt(goosh.config.numres)){ this.hasmore = false; moreobj = false; } goosh.gui.showinput(); goosh.gui.focusinput(); goosh.gui.scroll(); } return true; } this.more = function(){ if(this.args){ this.start += parseInt(goosh.config.numres); //this.query(this.name,this.args); if(this.results.length <= this.start+ parseInt(goosh.config.numres)){ this.hasmore = false; moreobj = false; } this.renderResult(); } } } goosh.modules.register("place","web");