Permalink
Browse files

updated extensions description and documentation

  • Loading branch information...
mmarcon committed Nov 21, 2012
1 parent f4209e7 commit 5ebd740336f3f0865beb67163a56d40392628fcf
Showing with 50 additions and 2 deletions.
  1. +30 −1 EXTENSIONS.md
  2. +1 −1 src/extensions/route.js
  3. +19 −0 src/jhere.js
View
@@ -26,4 +26,33 @@ When this extension is included a map is automatically initialized on a containe
This extension packaged together with the plugin enables *HTML developers* to insert a map in their pages without having to write a single line of JavaScript.
###routing extension
When this extension is include it is possible to add routes to the map by simply doing the following:
`$('.selector').jHERE('route', from, to, routeOptions);`
`from` and `to` can be objects of type
`{latitude: -43, longitude: 55}`
or an array
`[-43, 55]`
`routeOptions` is optional and can be an object of type
{
marker: {},
type: 'shortest', //can be shortest, fastest, fastestNow, directDrive, scenic
transportMode: 'car', //can be car, pedestrian, publicTransport, truck
options: '', //can be avoidTollroad, avoidMotorway, avoidBoatFerry,
//avoidRailFerry, avoidPublicTransport, avoidTunnel,
//avoidDirtRoad, avoidPark, preferHOVLane, avoidStairs
trafficMode: 'default', //can be enabled, disabled, default
width: 4, //width in px of the route drawn on the map
color: '#ff6347' //color of the route drawn on the map
}
`marker` is an object containing the same options used for
`$('.selector').jHERE('marker')`. Options apply to both start and destionation markers.
View
@@ -41,7 +41,7 @@
//}</code></pre>
//
//`marker` is an object containing the same options used for
//`$('.selector').jHERE('marker'). Options apply to both start and destionation markers.
//`$('.selector').jHERE('marker')`. Options apply to both start and destionation markers.
route = function(from, to, options){
var router, wp, done;
_ns = _ns || nokia.maps;
View
@@ -471,6 +471,25 @@
/*Open up prototype for extensions*/
$[plugin] = {};
//###Extend jHERE
//jHERE can be easily extended with additional features. Some example of
//extensions are located [here](https://github.com/mmarcon/jhere/blob/master/EXTENSIONS.md).
//An extension should be implemented within a self-invoking function.
//Add the function(s)
//that will be called via
//
//`$('.selector').jHERE('myextension', param1, param2);`
//
//as follows:
//
//<pre><code class="dark">$.jHERE.extend('myextension', function(param1, param2){
// //this is the plugin object
// //this.element is the DOM element
// //this.map is the JSLA map
//});</code></pre>
//
//A good example of extension is the [routing extension](https://github.com/mmarcon/jhere/blob/master/src/extensions/route.js).
$[plugin].extend = function(name, fn){
if (typeof name === 'string' && isFunction(fn)) {
H[name] = fn;

0 comments on commit 5ebd740

Please sign in to comment.