Ticket #1064: GeoRSS.patch
| File GeoRSS.patch, 2.4 kB (added by thijsbrentjens, 1 year ago) |
|---|
-
GeoRSS.js
old new 1 /* Copyright (c) 2006-2007 MetaCarta, Inc., published under a modifiedBSD license.2 * See http://svn.openlayers.org/trunk/openlayers/re pository-license.txt1 /* Copyright (c) 2006-2007 MetaCarta, Inc., published under the BSD license. 2 * See http://svn.openlayers.org/trunk/openlayers/release-license.txt 3 3 * for the full text of the license. */ 4 4 5 5 … … 149 149 "title")[0].firstChild.nodeValue; 150 150 } 151 151 catch (e) { title="Untitled"; } 152 152 153 /* CUSTOM: add as a property of the feature */ 154 data.title = title; 155 153 156 /* First try RSS descriptions, then Atom summaries */ 154 157 var descr_nodes = null; 155 158 try { … … 175 178 } 176 179 catch (e) { description="No description."; } 177 180 181 /* CUSTOM: add as a property of the feature */ 182 data.description = description; 183 178 184 /* If no link URL is found in the first child node, try the 179 185 href attribute */ 180 186 try { … … 187 193 catch (e) {} 188 194 } 189 195 196 /* CUSTOM: add as a property of the feature */ 197 data.link = link; 198 190 199 data.icon = this.icon == null ? 191 200 OpenLayers.Marker.defaultIcon() : 192 201 this.icon.clone(); … … 253 262 } 254 263 }, 255 264 265 /** 266 * Method: refresh 267 * Refreshes the GeoRSS layer. All old features will be removed, the feed's data is parsed again. 268 * Location of the feed gets an additional parameter called "currenttime" holding the currenttime in milliseconds to make sure the feed is not retrieved from the browser's cache. 269 * CUSTOM 270 * Thijs, 04-10-2007 271 */ 272 refresh: function() { 273 var currentTime = new Date(); 274 var url = this.location; 275 var uniquePrefix = "?currenttime="; 276 if (url.indexOf(uniquePrefix) > 0) 277 { 278 url = url.substring(0,url.indexOf(uniquePrefix)); 279 } 280 this.location = url + uniquePrefix + currentTime.getTime(); 281 this.clearFeatures(); // or move clearFeatures to parseData? To make sure that ONLY the items from the last feed are shown? 282 this.initialize(this.name, this.location, this.options); 283 }, 284 256 285 /** @final @type String */ 257 286 CLASS_NAME: "OpenLayers.Layer.GeoRSS" 258 287 });
