Changeset 6651 for extensions/rv_gmaps/trunk/template/data_handler.js
- Timestamp:
- Jul 2, 2010, 6:53:40 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/rv_gmaps/trunk/template/data_handler.js
r6245 r6651 10 10 , opts || {} ); 11 11 12 GEvent.addListener( map, "infowindowclose", function() {map.getInfoWindow().pwgMarker=null;} );12 google.maps.Event.addListener( map, "infowindowclose", function() {map.getInfoWindow().pwgMarker=null;} ); 13 13 } 14 14 … … 83 83 { 84 84 this._map.removeOverlay( marker ); 85 GEvent.clearListeners(marker, "click" );86 GEvent.clearListeners(marker, "dblclick" );85 google.maps.Event.clearListeners(marker, "click" ); 86 google.maps.Event.clearListeners(marker, "dblclick" ); 87 87 this._map.getInfoWindow().pwgMarker = infoWindowMarker = null; 88 if (document.is_debug) GLog.write('removed marker with infoWindow');88 if (document.is_debug) google.maps.Log.write('removed marker with infoWindow'); 89 89 marker = this._markers.pop(); 90 90 } … … 92 92 if (!marker) 93 93 { 94 marker = new GMarker( cluster.position, {title: theTitle, icon: this.options.icon } );95 GEvent.addListener( marker, "click", this._onMarkerClick.bind(this, marker) );96 GEvent.addListener( marker, "dblclick", this._onMarkerDblClick.bind(this, marker) );94 marker = new google.maps.Marker( cluster.position, {title: theTitle, icon: this.options.icon } ); 95 google.maps.Event.addListener( marker, "click", this._onMarkerClick.bind(this, marker) ); 96 google.maps.Event.addListener( marker, "dblclick", this._onMarkerDblClick.bind(this, marker) ); 97 97 this._map.addOverlay( marker ); 98 98 } … … 144 144 { 145 145 this._map.removeOverlay( this._markers[i] ); 146 GEvent.clearListeners(this._markers[i], "click" );147 GEvent.clearListeners(this._markers[i], "dblclick" );146 google.maps.Event.clearListeners(this._markers[i], "click" ); 147 google.maps.Event.clearListeners(this._markers[i], "dblclick" ); 148 148 } 149 149 … … 160 160 if (this._map.getInfoWindow().pwgMarker == marker ) 161 161 return; // already open 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 162 var content = ""; 163 if ( !marker.currentImageIndex ) 164 marker.currentImageIndex = 0; 165 content += '<div class="gmiw_header" style="' + (marker.pwg.images.length>1 ? '': 'display:none')+ '">'; 166 content += '<span id="pwgImageCounters">'+this.buildCurrentPictureCounterHtml(marker)+'</span> '; 167 content += '<a href="javascript:void(0);" id="'+this._navHtmlIds[0]+'">'; 168 content += '<span>'+ "« " + Localization.get('Prev') + '</span>'; 169 content += '</a>'; 170 content += " "; 171 content += '<a href="javascript:void(0);" id="'+this._navHtmlIds[1]+'">'; 172 content += '<span>'+Localization.get('Next') + " »"+'</span>'; 173 content += '</a>'; 174 content += " "; 175 var imgShowAll = ''; 176 if (this.options.show_all_img_src) 177 imgShowAll = '<img src="'+this.options.show_all_img_src+'" alt="" style="border:0" /> '; 178 content += '<a id="pwgImageBlowup" href="'+marker.pwg.blowup_url+'" onclick="return PwgDataHandler.blowupUrl(this.href);" title='+Localization.getQ('show all pictures around this location')+'>'+ 179 imgShowAll+ '<span>'+Localization.get('Show all')+'</span>'+ 180 '</a>'; 181 content += '</div>'; 182 content += '<div id="pwgImageDetail">' + this.buildCurrentPictureHtml( marker ) + '</div>'; 183 184 marker.openInfoWindowHtml( content ); 185 186 // bind to next / prev a little later because sometimes the nodes are not immediately created 187 if (this._timerBindPictureNavigation) clearTimeout(this._timerBindPictureNavigation); 188 this._timerBindPictureNavigation = null; 189 if (marker.pwg.images.length>1) 190 this._timerBindPictureNavigation = setTimeout( this._onTimeoutBindPictureNavigation.bind(this, marker), 250 ); 191 191 }, 192 192 193 193 _onMarkerDblClick: function( marker ) 194 194 { 195 195 this._map.setCenter( marker.pwg.bounds.getCenter(), this._map.getBoundsZoomLevel( marker.pwg.bounds ) ); 196 196 }, 197 197 198 198 buildCurrentPictureHtml: function( marker ) 199 199 { 200 201 202 203 200 var imageDetail = marker.pwg.images[marker.currentImageIndex]; 201 var res = ""; 202 res += '<div class="gmiw_imageTitle">' + imageDetail.name + "</div>"; 203 res += 204 204 '<div class="gmiw_imageContent">' + 205 205 '<div class="gmiw_imageWrap">'+ … … 209 209 '<div class="gmiw_imageComment">' + imageDetail.comment + '</div>' + 210 210 '</div>'; 211 211 return res; 212 212 }, 213 213 214 214 buildCurrentPictureCounterHtml: function( marker ) 215 215 { 216 217 218 219 220 221 222 216 var res = 217 '<b>'+(marker.currentImageIndex+1)+'</b>'+ 218 '/' + 219 '<b>'+marker.pwg.images.length+'</b>'; 220 if (marker.pwg.nb_items>marker.pwg.images.length) 221 res+= " "+Localization.fmt1("out of %d", marker.pwg.nb_items ); 222 return res; 223 223 }, 224 224 … … 226 226 _onTimeoutBindPictureNavigation: function( marker ) 227 227 { 228 229 230 231 232 233 234 235 GEvent.addDomListener(elt, "click", this._onPictureNavigate.bind(this, marker, i) );236 228 clearTimeout(this._timerBindPictureNavigation); 229 this._timerBindPictureNavigation = null; 230 this._map.getInfoWindow().pwgMarker = marker; 231 for (var i=0; i< this._navHtmlIds.length; i++) 232 { 233 var elt = document.getElementById( this._navHtmlIds[i] ); 234 if (elt) 235 google.maps.Event.addDomListener(elt, "click", this._onPictureNavigate.bind(this, marker, i) ); 236 } 237 237 }, 238 238 239 239 _onPictureNavigate: function(marker, dir ) 240 240 { 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 241 if (dir==0) dir=-1; 242 marker.currentImageIndex += dir; 243 if (marker.currentImageIndex<0) 244 marker.currentImageIndex = marker.pwg.images.length-1; 245 else if (marker.currentImageIndex >= marker.pwg.images.length) 246 marker.currentImageIndex = 0; 247 248 try { 249 var elt = document.getElementById( "pwgImageDetail" ); 250 elt.innerHTML = this.buildCurrentPictureHtml( marker ); 251 } 252 catch (e) 253 { 254 alert (e.message); 255 } 256 257 try { 258 var elt = document.getElementById( "pwgImageCounters" ); 259 elt.innerHTML = this.buildCurrentPictureCounterHtml( marker ); 260 } 261 catch (e) 262 { 263 alert (e.message); 264 } 265 return false; 266 266 } 267 267 … … 270 270 PwgDataHandler.blowupUrl = function(theUrl) 271 271 { 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 272 var win = new Window({ 273 title: document.title, 274 url: theUrl, 275 classname: "alphacube", 276 left: 0, top: 0, 277 width:"640", height:"480", 278 minimizable: false, 279 maximizable: false, 280 draggable: false, 281 resizable: false, 282 destroyOnClose: true, 283 hideEffect: Element.hide, 284 showEffectOptions: {duration:1.5} 285 }); 286 287 win.setConstraint(true, {top:20, left:20, bottom:30, right:20} ); 288 win.maximize(); 289 win.showCenter(true, 20, 20); 290 return false; 291 291 } 292 292 … … 294 294 String.prototype.urlNoHtm = function() 295 295 { 296 297 } 296 return this.replace( "&", "&" ); 297 }
Note: See TracChangeset
for help on using the changeset viewer.