// Javascript Service Definition //////////////////////////////// objx.requires("IODataService", "IOStarService"); var IOStarService = objx.Class(IOService, { onSave: objx.event, /* * 'save' method * PUT /stars */ save: function(stars) { // make the request this.makeRequest({ url: "/stars", type: "PUT", dataType: "json", contentType: "json", data: $.toJSON(stars,true), success: objx.bind(this.save_success, this), status: "Saving your starred items", errorStatus: "Unable to save your starred items" }); }, save_success: function( response ) { this.onSave( response.data ); } }); // default instance var IOStars = new IOStarService(); objx.provides("IOStarService"); // JavaScript Control ///////////////////// objx.requires("objx.Class", "IODirections") .requires("IOControl", "IODirections"); var IODirections = objx.Class(IOControl, { getPolyline: true, getSteps: true, travelMode: G_TRAVEL_MODE_DRIVING, onDirectionsLoaded: objx.event, // ( Array data ) triggered when all directions have been loaded getDirections: function(locations,options){ var options = options || {}; for (var property in options){ this[property] = options[property]; } var dir = new GDirections(); locations = objx(locations).collect(function(item) { return item.lat+","+item.lng; }).obj(); GEvent.addListener(dir, "load", objx.bind(this.directions_load, this, dir)); GEvent.addListener(dir, "error", function(){ $.log(dir.getStatus().code); }); dir.loadFromWaypoints(locations, { getPolyline:this.getPolyline, getSteps:this.getSteps, travelMode:options.travelMode ? options.travelMode : this.travelMode }); }, getDirectionsHtml: function(dir){ var list = $("