Geomap

Error on geomap script

Hi,

There was an error on geomap script. It use the getElementsByClassName method, which is no more supported in recent navigators. So I uses this script found on about.com

  /**
   * Implement the getElementsByClassName
   */    
  document.getElementsByClassName = function(cl) {
    var retnode = [];
    var myclass = new RegExp('\\b'+cl+'\\b');
    var elem = this.getElementsByTagName('*');
    for (var i = 0; i < elem.length; i++) {
      var classes = elem[i].className;
      if (myclass.test(classes)) {
        retnode.push(elem[i]);
      }
    }
    return retnode;
  };

You just have to insert this code in the script.

Modified version of geomap javascript

I made this because I was very unable to understand the jquery.googlemap.js code using in the geomap module. The purpose of this module is to parse geo microformats in a page and display corresponding markers on a google map.

If you are working with Google maps maybe this wil be useful to you. I make it working with location module by formatting the display of locations infos as geo microformat :

<div class="geo" title="'. $node->title .'">
<p>
<strong>Street : </strong>'.$location['street'].'
</p>
<p>
<strong>House number : </strong>'.$location['name'].'
</p>
<p>
'.$location['city'].', '.$location['province'].', '.$location['postal_code'].'
</p>
<span class="latitude" title="'. $location['latitude'] .'"/>
  <span class="longitude" title="'. $location['longitude'] .'"/>
</div>

You can get the file here.

Syndicate content