I would like to extend the funtionality of OpenLayers that appends, on-the-fly as the user zooms and pans the map, the longitude/latitude parameters as a anchor to the URL in the browser's address bar, e.g.
http://mywebsite.com/#zoom=12&lat=50.90306&lon=-1.38329&layers=BT
I would like certain other links on the same page, outside of the map, to have the the anchor #zoom=12&lat=50.90306&lon=-1.38329&layers=BT
appended to them.
The reason is so that when these links are clicked on, the map will be loaded at the same pan and zoom position. These links contain other 'arguments' that determine what data appears in the overlay. The site runs on the Drupal 7 content management system, with the OpenLayers module and these other arguments control a Drupal View to control what is displayed in the overlay.
So my approach is to implement some self-contained javascript/jquery that doesn't change openlayers javascript (to avoid overheads of burdening the authors with testing, commits to the source etc) but instead is loaded after openlayers javascript, this self-contained code would at run time 'register'/'bind' as necessary to be able to listen to pan and zoom events and obtain the longitude and latitude anchor data and add these to the certain other links. I would identify those certain other links with a class attribute in the html <a />
element and use the JQuery DOM functions to search for the class and prepend the anchor.
What I need is to know how the OpenLayers code is updating the location field/address bar with the # anchor in order to figure out how to write some separate code to listen for the pan zoom events.
Please share your thoughts. Thanks.