X-Git-Url: https://projects.mako.cc/source/selectricity-live/blobdiff_plain/baf9ff0ec39c13f52ee8d4f087641dc5fcc9c53b..fcc68b4dc198b7cb0cf93467d96038b0844675fe:/vendor/plugins/ym4r_gm/javascript/geoRssOverlay.js diff --git a/vendor/plugins/ym4r_gm/javascript/geoRssOverlay.js b/vendor/plugins/ym4r_gm/javascript/geoRssOverlay.js new file mode 100644 index 0000000..315c26d --- /dev/null +++ b/vendor/plugins/ym4r_gm/javascript/geoRssOverlay.js @@ -0,0 +1,194 @@ +// GeoRssOverlay: GMaps API extension to display a group of markers from +// a RSS feed +// +// Copyright 2006 Mikel Maron (email: mikel_maron yahoo com) +// +// The original version of this code is called MGeoRSS and can be found +// at the following address: +// http://brainoff.com/gmaps/mgeorss.html +// +// Modified by Andrew Turner to add support for the GeoRss Simple vocabulary +// +// Modified and bundled with YM4R in accordance with the following +// license: +// +// This work is public domain + +function GeoRssOverlay(rssurl,icon,proxyurl,options){ + this.rssurl = rssurl; + this.icon = icon; + this.proxyurl = proxyurl; + if(options['visible'] == undefined) + this.visible = true; + else + this.visible = options['visible']; + this.listDiv = options['listDiv']; //ID of the item list DIV + this.contentDiv = options['contentDiv']; //ID of the content DIV + this.listItemClass = options['listItemClass']; //Class of the list item DIV + this.limitItems = options['limit']; //Maximum number of displayed entries + this.request = false; + this.markers = []; +} + +GeoRssOverlay.prototype = new GOverlay(); + +GeoRssOverlay.prototype.initialize=function(map) { + this.map = map; + this.load(); +} + +GeoRssOverlay.prototype.redraw = function(force){ + //nothing to do : the markers are already taken care of +} + +GeoRssOverlay.prototype.remove = function(){ + for(var i= 0, len = this.markers.length ; i< len; i++){ + this.map.removeOverlay(this.markers[i]); + } +} + +GeoRssOverlay.prototype.showHide=function() { + if (this.visible) { + for (var i=0;i" + title + "

" + description; + + if(this.contentDiv == undefined){ + GEvent.addListener(marker, "click", function() { + marker.openInfoWindowHtml(html); + }); + }else{ + var contentDiv = this.contentDiv; + GEvent.addListener(marker, "click", function() { + document.getElementById(contentDiv).innerHTML = html; + }); + } + + if(this.listDiv != undefined){ + var a = document.createElement('a'); + a.innerHTML = title; + a.setAttribute("href","#"); + var georss = this; + a.onclick = function(){ + georss.showMarker(index); + return false; + }; + var div = document.createElement('div'); + if(this.listItemClass != undefined){ + div.setAttribute("class",this.listItemClass); + } + div.appendChild(a); + document.getElementById(this.listDiv).appendChild(div); + } + + return marker; +}