Changeset 7616 for extensions/GMaps/js/gmapsMarkup.js
- Timestamp:
- Nov 4, 2010, 1:42:14 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/GMaps/js/gmapsMarkup.js
r7500 r7616 2 2 * ----------------------------------------------------------------------------- 3 3 * file: gmapsMarkup.js 4 * file version: 1. 0.05 * date: 2010-1 0-284 * file version: 1.1.0 5 * date: 2010-11-04 6 6 */ 7 7 8 8 var markerImgProp = [ 9 null, 10 { w:32, h:32, x:15, y:31 }, // s01 11 { w:32, h:32, x:15, y:31 }, // s02 12 { w:32, h:32, x:10, y:31 }, // s03 13 { w:30, h:40, x:4, y:39 }, // s04 14 ]; 15 16 17 /** 18 * create the map 19 * 20 * @param Object properties : map properties 21 * @param Integer gmapsIndex : index in the map list 22 */ 23 function createMap(properties, gmapsIndex) 9 null, 10 { w:32, h:32, x:15, y:31 }, // s01 11 { w:32, h:32, x:15, y:31 }, // s02 12 { w:32, h:32, x:10, y:31 }, // s03 13 { w:30, h:40, x:4, y:39 }, // s04 14 ]; 15 16 17 function markupMaps() 24 18 { 25 var bounds = new google.maps.LatLngBounds( 26 new google.maps.LatLng(properties.mapBounds.south, properties.mapBounds.west), 27 new google.maps.LatLng(properties.mapBounds.north, properties.mapBounds.east) 28 ), 29 map = new google.maps.Map($("#"+properties.id).get(0), 30 { 31 backgroundColor:'#ffffff', 32 mapTypeId: properties.mapType, 33 zoom: properties.zoomLevel, 34 center: bounds.getCenter(), 35 navigationControl: (properties.navigationControl==-1)?false:true, 36 scrollwheel: (properties.navigationControl==-1)?false:true, 37 scaleControl: (properties.scaleControl=='n')?false:true, 38 streetViewControl: (properties.streetViewControl=='n')?false:true, 39 mapTypeControl:(properties.mapTypeControl==-1)?false:true, 40 mapTypeControlOptions: 19 /** 20 * create the map 21 * 22 * @param Object properties : map properties 23 * @param Integer gmapsIndex : index in the map list 24 */ 25 this.createMap = function (properties, gmapsIndex) 26 { 27 var bounds = new google.maps.LatLngBounds( 28 new google.maps.LatLng(properties.mapBounds.south, properties.mapBounds.west), 29 new google.maps.LatLng(properties.mapBounds.north, properties.mapBounds.east) 30 ), 31 map = new google.maps.Map($("#"+properties.id).get(0), 32 { 33 backgroundColor:'#ffffff', 34 mapTypeId: properties.mapType, 35 zoom: properties.zoomLevel, 36 center: bounds.getCenter(), 37 navigationControl: (properties.navigationControl==-1)?false:true, 38 scrollwheel: (properties.navigationControl==-1)?false:true, 39 scaleControl: (properties.scaleControl=='n')?false:true, 40 streetViewControl: (properties.streetViewControl=='n')?false:true, 41 mapTypeControl:(properties.mapTypeControl==-1)?false:true, 42 mapTypeControlOptions: 43 { 44 style:properties.mapTypeControl 45 }, 46 markerTitle:'', 47 } 48 ); 49 50 if(properties.kmlFileUrl!='') 51 { 52 kmlFile = new google.maps.KmlLayer(properties.kmlFileUrl, 53 { 54 preserveViewport:true 55 } 56 ); 57 kmlFile.setMap(map); 58 } 59 else 60 { 61 kmlFile=null; 62 } 63 64 re=/^mS(\d\d)_.*/i; 65 iM=re.exec(properties.markerImg); 66 if(iM!=null) iM=new Number(iM[1]); 67 68 if(iM!=null) 69 { 70 map.markerImg = new google.maps.MarkerImage('plugins/GMaps/img/'+properties.markerImg, 71 new google.maps.Size(markerImgProp[iM].w, markerImgProp[iM].h), 72 new google.maps.Point(0,0), 73 new google.maps.Point(markerImgProp[iM].x, markerImgProp[iM].y)); 74 } 75 else 76 { 77 map.markerImg = null; 78 } 79 80 map.bounds=bounds; 81 map.kmlFile=kmlFile; 82 map.markers=new Array(); 83 map.gmapsIndex=gmapsIndex; 84 map.width=properties.width; 85 map.height=properties.height; 86 map.callId=0; 87 map.allowBubble=properties.allowBubble; 88 map.initialized=false; 89 properties.gMap=map; 90 91 92 if(properties.geolocated) 93 { 94 if(properties.fitToBounds) 95 { 96 fitToBounds(map.bounds, gmapsIndex); 97 } 98 else 99 { 100 map.setCenter(map.bounds.getCenter()); 101 } 102 } 103 104 if(properties.markerVisible) 105 { 106 loadMarkers(map); 107 } 108 else 109 { 110 initializeMapViewport(gmapsIndex); 111 } 112 }; 113 114 /** 115 * load markers from the server 116 * 117 * @param Map map : the map 118 */ 119 var loadMarkers = function(map) 120 { 121 if(map.getBounds()==null) return(false); 122 map.callId++; 123 124 datas={ 125 requestId:gmapsMarkup.requestId, 126 callId:map.callId, 127 bounds:{ 128 north:map.getBounds().getNorthEast().lat(), 129 east:map.getBounds().getNorthEast().lng(), 130 south:map.getBounds().getSouthWest().lat(), 131 west:map.getBounds().getSouthWest().lng() 132 }, 133 width:map.width, 134 height:map.height, 135 distanceTreshold:20, 136 loadIndex:map.gmapsIndex, 137 }; 138 139 $.ajax( 140 { 141 type: "POST", 142 url: "plugins/GMaps/gmaps_ajax.php", 143 async: true, 144 data: { ajaxfct:"public.maps.getMarkers", datas:datas }, 145 success: 146 function(msg) 147 { 148 tmp=$.parseJSON(msg); 149 if(gmapsMarkup.maps[tmp.loadIndex].gMap.callId==tmp.callId) 41 150 { 42 style:properties.mapTypeControl 43 }, 44 markerTitle:'', 151 tmp.markers.sort(compareMarkers); 152 applyMarkers(gmapsMarkup.maps[tmp.loadIndex].gMap, tmp.markers); 153 initializeMapViewport(tmp.loadIndex); 154 } 155 } 156 } 157 ); 158 }; 159 160 /** 161 * apply markers to map 162 * 163 * @param Map map : the google map object 164 * @param Array markers : array of markers properties 165 * each marker is an object with properties : 166 * latitude, longitude, nbImg 167 */ 168 var applyMarkers = function(map, markers) 169 { 170 if(map==null) return(false); 171 172 /* 173 * deleting markers from the map only if they are not in the new list 174 */ 175 if(map.markers.length>0) 176 { 177 var i=0; 178 while(i<map.markers.length) 179 { 180 newListIndex=markerInList(map.markers[i].uId, markers); 181 if(newListIndex==-1) 182 { 183 map.markers[i].marker.setMap(null); 184 map.markers.splice(i, 1); 185 } 186 else 187 { 188 markers.splice(newListIndex,1); 189 i++; 190 } 191 } 192 } 193 194 /* 195 * add new markers on the map 196 */ 197 for(var i=0;i<markers.length;i++) 198 { 199 var marker = new google.maps.Marker( 200 { 201 position:new google.maps.LatLng(markers[i].lat, markers[i].lng), 202 map: map, 203 title:markers[i].nbImgTxt 45 204 } 46 205 ); 47 206 48 if(properties.kmlFileUrl!='') 49 { 50 kmlFile = new google.maps.KmlLayer(properties.kmlFileUrl, 51 { 52 preserveViewport:true 53 } 54 ); 55 kmlFile.setMap(map); 56 } 57 else 58 { 59 kmlFile=null; 60 } 61 62 re=/^mS(\d\d)_.*/i; 63 iM=re.exec(properties.markerImg); 64 if(iM!=null) iM=new Number(iM[1]); 65 66 if(iM!=null) 67 { 68 map.markerImg = new google.maps.MarkerImage('plugins/GMaps/img/'+properties.markerImg, 69 new google.maps.Size(markerImgProp[iM].w, markerImgProp[iM].h), 70 new google.maps.Point(0,0), 71 new google.maps.Point(markerImgProp[iM].x, markerImgProp[iM].y)); 72 } 73 else 74 { 75 map.markerImg = null; 76 } 77 78 map.bounds=bounds; 79 map.kmlFile=kmlFile; 80 map.markers=new Array(); 81 map.gmapsIndex=gmapsIndex; 82 map.width=properties.width; 83 map.height=properties.height; 84 map.callId=0; 85 map.allowBubble=properties.allowBubble; 86 map.initialized=false; 87 properties.gMap=map; 88 89 90 if(properties.geolocated) 91 { 92 if(properties.fitToBounds) 93 { 94 fitToBounds(map.bounds, gmapsIndex); 207 if(map.markerImg!=null) marker.setIcon(map.markerImg); 208 209 marker.info=markers[i]; 210 marker.info.displayed=0; 211 212 map.markers.push( 213 { 214 marker:marker, 215 uId:markers[i].uId 216 } 217 ); 218 219 if(map.allowBubble) 220 { 221 google.maps.event.addListener( 222 marker, 223 'click', 224 function () 225 { 226 displayWindowInfo(this); 227 } 228 ); 229 } 230 231 for(var index=0;index<marker.info.imgTn.length;index++) 232 { 233 switch(marker.info.imgTn[index].charAt(0)) 234 { 235 case 'G': 236 marker.info.imgTn[index]='./galleries/'+marker.info.imgTn[index].substr(1); 237 break; 238 case 'U': 239 marker.info.imgTn[index]='./upload/'+marker.info.imgTn[index].substr(1); 240 break; 241 } 242 } 243 } 244 }; 245 246 var compareMarkers=function(m1,m2) 247 { 248 if(m1.uId<m2.uId) 249 { 250 return(-1); 251 } 252 else if(m1.uId<m2.uId) 253 { 254 return(1); 255 } 256 return(0); 257 }; 258 259 var markerInList=function(uniqueId, markerList) 260 { 261 for(var i=0;i<markerList.length;i++) 262 { 263 if(markerList[i].uId==uniqueId) return(i) 264 } 265 return(-1); 266 }; 267 268 /** 269 * display the infowindow 270 * 271 * @param Marker marker : the marker 272 */ 273 var displayWindowInfo=function(marker) 274 { 275 gmapsMarkup.currentInfo=marker.info; 276 gmapsMarkup.infoWindow.close(); 277 gmapsMarkup.infoWindow.setContent($('#iGMapsInfoWindowContent').clone().each(renameId).get(0)); 278 gmapsMarkup.infoWindow.open(marker.map, marker); 279 displayPictureInfo(gmapsMarkup.currentInfo.displayed); 280 }; 281 var renameId=function(i, e) 282 { 283 if(e.id!='') e.id='c'+e.id; 284 $(e).children().each(renameId); 285 }; 286 287 288 /** 289 * 290 */ 291 var displayPictureInfo=function(index) 292 { 293 gmapsMarkup.currentInfo.displayed=index; 294 if(gmapsMarkup.currentInfo.imgName[index]=='') 295 { 296 $('#ciGMIWC_title').html(' '); 95 297 } 96 298 else 97 299 { 98 map.setCenter(map.bounds.getCenter()); 99 } 100 } 101 102 if(properties.markerVisible) 103 { 104 loadMarkers(map); 105 } 106 else 107 { 108 initializeMapViewport(gmapsIndex); 109 } 300 $('#ciGMIWC_title').html(gmapsMarkup.currentInfo.imgName[index]); 301 } 302 $('#ciGMIWC_img').attr('src', gmapsMarkup.currentInfo.imgTn[index]); 303 304 $('#ciGMIWC_img').unbind(); 305 if(gmapsMarkup.currentInfo.imgCatsUrl[index].length==1) 306 { 307 $('#ciGMIWC_img').bind('click', 308 function () 309 { 310 window.location=gmapsMarkup.currentInfo.imgCatsUrl[gmapsMarkup.currentInfo.displayed][0]; 311 } 312 ); 313 } 314 else 315 { 316 $('#ciGMIWC_showcatList').html(''); 317 for(var i=0;i<gmapsMarkup.currentInfo.imgCatsUrl[index].length;i++) 318 { 319 $('#ciGMIWC_showcatList') 320 .append('<li><a href="'+gmapsMarkup.currentInfo.imgCatsUrl[index][i]+'">'+gmapsMarkup.currentInfo.imgCatsNames[index][i]+'</a></li>'); 321 } 322 $('#ciGMIWC_img, #ciGMIWC_showcat') 323 .bind('mouseenter', function () { $('#ciGMIWC_showcat').css('display', 'block'); } ) 324 .bind('mouseleave', function () { $('#ciGMIWC_showcat').css('display', 'none'); } ); 325 } 326 327 if(gmapsMarkup.currentInfo.nbImg>1) 328 { 329 $('#ciGMIWC_picnum').html((index+1)+'/'+gmapsMarkup.currentInfo.nbImgTxt); 330 $('#ciWALeft, #ciWARight').css('display', 'inline-block'); 331 } 332 else 333 { 334 $('#ciGMIWC_picnum').html(gmapsMarkup.currentInfo.nbImgTxt); 335 $('#ciWALeft, #ciWARight').css('display', 'none'); 336 } 337 }; 338 339 /** 340 * 341 */ 342 this.displayPicturePrev=function() 343 { 344 gmapsMarkup.currentInfo.displayed--; 345 if(gmapsMarkup.currentInfo.displayed<0) gmapsMarkup.currentInfo.displayed=gmapsMarkup.currentInfo.nbImg-1; 346 displayPictureInfo(gmapsMarkup.currentInfo.displayed); 347 }; 348 349 /** 350 * 351 */ 352 this.displayPictureNext=function() 353 { 354 gmapsMarkup.currentInfo.displayed++; 355 if(gmapsMarkup.currentInfo.displayed>=gmapsMarkup.currentInfo.nbImg) gmapsMarkup.currentInfo.displayed=0; 356 displayPictureInfo(gmapsMarkup.currentInfo.displayed); 357 }; 358 359 360 /** 361 * check if zoomLevel 362 */ 363 var fitToBounds=function(bounds, mapIndex) 364 { 365 gmapsMarkup.maps[mapIndex].gMap.fitBounds(bounds); 366 367 if(gmapsMarkup.maps[mapIndex].zoomLevelMaxActivated && 368 gmapsMarkup.maps[mapIndex].gMap.getZoom() > gmapsMarkup.maps[mapIndex].zoomLevel) 369 { 370 gmapsMarkup.maps[mapIndex].gMap.setZoom(gmapsMarkup.maps[mapIndex].zoomLevel); 371 } 372 }; 373 374 var initializeMapViewport=function(mapIndex) 375 { 376 if(mapIndex>-1 && !gmapsMarkup.maps[mapIndex].gMap.initialized) 377 { 378 // reduce copyright size... ^_^ 379 $('#'+gmapsMarkup.maps[mapIndex].id+' span, #'+gmapsMarkup.maps[mapIndex].id+' a').css('font-size', '55.0%'); 380 381 if(gmapsMarkup.maps[mapIndex].markerVisible) 382 { 383 google.maps.event.addListener( 384 gmapsMarkup.maps[mapIndex].gMap, 385 'dragend', 386 function() 387 { 388 loadMarkers(this); 389 } 390 ); 391 392 google.maps.event.addListener( 393 gmapsMarkup.maps[mapIndex].gMap, 394 'zoom_changed', 395 function() 396 { 397 loadMarkers(this); 398 gmapsMarkup.infoWindow.close(); 399 } 400 ); 401 } 402 403 404 if(gmapsMarkup.maps[mapIndex].kmlZoom && gmapsMarkup.maps[mapIndex].gMap.kmlFile!=null) 405 { 406 google.maps.event.addListenerOnce( 407 gmapsMarkup.maps[mapIndex].gMap.kmlFile, 408 'defaultviewport_changed', 409 function() 410 { 411 fitToBounds(gmapsMarkup.maps[mapIndex].gMap.kmlFile.getDefaultViewport(), mapIndex); 412 } 413 ); 414 415 } 416 417 gmapsMarkup.maps[mapIndex].gMap.initialized=true; 418 } 419 }; 420 110 421 } 111 422 112 /**113 * load markers from the server114 *115 * @param Map map : the map116 */117 function loadMarkers(map)118 {119 if(map.getBounds()==null) return(false);120 map.callId++;121 122 datas={123 requestId:gmapsMarkup.requestId,124 callId:map.callId,125 bounds:{126 north:map.getBounds().getNorthEast().lat(),127 east:map.getBounds().getNorthEast().lng(),128 south:map.getBounds().getSouthWest().lat(),129 west:map.getBounds().getSouthWest().lng()130 },131 width:map.width,132 height:map.height,133 distanceTreshold:20,134 loadIndex:map.gmapsIndex,135 };136 137 $.ajax(138 {139 type: "POST",140 url: "plugins/GMaps/gmaps_ajax.php",141 async: true,142 data: { ajaxfct:"public.maps.getMarkers", datas:datas },143 success:144 function(msg)145 {146 tmp=$.parseJSON(msg);147 if(gmaps.maps[tmp.loadIndex].gMap.callId==tmp.callId)148 {149 tmp.markers.sort(compareMarkers);150 applyMarkers(gmapsMarkup.maps[tmp.loadIndex].gMap, tmp.markers);151 initializeMapViewport(tmp.loadIndex);152 }153 }154 }155 );156 }157 158 /**159 * apply markers to map160 *161 * @param Map map : the google map object162 * @param Array markers : array of markers properties163 * each marker is an object with properties :164 * latitude, longitude, nbImg165 */166 function applyMarkers(map, markers)167 {168 if(map==null) return(false);169 170 /*171 * deleting markers from the map only if they are not in the new list172 */173 if(map.markers.length>0)174 {175 var i=0;176 while(i<map.markers.length)177 {178 newListIndex=markerInList(map.markers[i].uId, markers);179 if(newListIndex==-1)180 {181 map.markers[i].marker.setMap(null);182 map.markers.splice(i, 1);183 }184 else185 {186 markers.splice(newListIndex,1);187 i++;188 }189 }190 }191 192 /*193 * add new markers on the map194 */195 for(var i=0;i<markers.length;i++)196 {197 var marker = new google.maps.Marker(198 {199 position:new google.maps.LatLng(markers[i].lat, markers[i].lng),200 map: map,201 title:markers[i].nbImgTxt202 }203 );204 205 if(map.markerImg!=null) marker.setIcon(map.markerImg);206 207 marker.info=markers[i];208 marker.info.displayed=0;209 210 map.markers.push(211 {212 marker:marker,213 uId:markers[i].uId214 }215 );216 217 if(map.allowBubble)218 {219 google.maps.event.addListener(220 marker,221 'click',222 function ()223 {224 displayWindowInfo(this);225 }226 );227 }228 229 for(var index=0;index<marker.info.imgTn.length;index++)230 {231 switch(marker.info.imgTn[index].charAt(0))232 {233 case 'G':234 marker.info.imgTn[index]='./galleries/'+marker.info.imgTn[index].substr(1);235 break;236 case 'U':237 marker.info.imgTn[index]='./upload/'+marker.info.imgTn[index].substr(1);238 break;239 }240 }241 }242 }243 244 function compareMarkers(m1,m2)245 {246 if(m1.uId<m2.uId)247 {248 return(-1);249 }250 else if(m1.uId<m2.uId)251 {252 return(1);253 }254 return(0);255 }256 257 function markerInList(uniqueId, markerList)258 {259 for(var i=0;i<markerList.length;i++)260 {261 if(markerList[i].uId==uniqueId) return(i)262 }263 return(-1);264 }265 266 /**267 * display the infowindow268 *269 * @param Marker marker : the marker270 */271 function displayWindowInfo(marker)272 {273 gmapsMarkup.currentInfo=marker.info;274 gmapsMarkup.infoWindow.close();275 gmapsMarkup.infoWindow.setContent($('#iGMapsInfoWindowContent').clone().each(renameId).get(0));276 gmapsMarkup.infoWindow.open(marker.map, marker);277 displayPictureInfo(gmapsMarkup.currentInfo.displayed);278 }279 function renameId(i, e)280 {281 if(e.id!='') e.id='c'+e.id;282 $(e).children().each(renameId);283 }284 285 286 /**287 *288 */289 function displayPictureInfo(index)290 {291 gmapsMarkup.currentInfo.displayed=index;292 if(gmapsMarkup.currentInfo.imgName[index]=='')293 {294 $('#ciGMIWC_title').html(' ');295 }296 else297 {298 $('#ciGMIWC_title').html(gmapsMarkup.currentInfo.imgName[index]);299 }300 $('#ciGMIWC_img').attr('src', gmapsMarkup.currentInfo.imgTn[index]);301 302 $('#ciGMIWC_img').unbind();303 if(gmapsMarkup.currentInfo.imgCatsUrl[index].length==1)304 {305 $('#ciGMIWC_img').bind('click',306 function ()307 {308 window.location=gmapsMarkup.currentInfo.imgCatsUrl[gmapsMarkup.currentInfo.displayed][0];309 }310 );311 }312 else313 {314 $('#ciGMIWC_showcatList').html('');315 for(var i=0;i<gmapsMarkup.currentInfo.imgCatsUrl[index].length;i++)316 {317 $('#ciGMIWC_showcatList')318 .append('<li><a href="'+gmapsMarkup.currentInfo.imgCatsUrl[index][i]+'">'+gmapsMarkup.currentInfo.imgCatsNames[index][i]+'</a></li>');319 }320 $('#ciGMIWC_img, #ciGMIWC_showcat')321 .bind('mouseenter', function () { $('#ciGMIWC_showcat').css('display', 'block'); } )322 .bind('mouseleave', function () { $('#ciGMIWC_showcat').css('display', 'none'); } );323 }324 325 if(gmapsMarkup.currentInfo.nbImg>1)326 {327 $('#ciGMIWC_picnum').html((index+1)+'/'+gmapsMarkup.currentInfo.nbImgTxt);328 $('#ciWALeft, #ciWARight').css('display', 'inline-block');329 }330 else331 {332 $('#ciGMIWC_picnum').html(gmapsMarkup.currentInfo.nbImgTxt);333 $('#ciWALeft, #ciWARight').css('display', 'none');334 }335 }336 337 /**338 *339 */340 function displayPicturePrev()341 {342 gmapsMarkup.currentInfo.displayed--;343 if(gmapsMarkup.currentInfo.displayed<0) gmapsMarkup.currentInfo.displayed=gmapsMarkup.currentInfo.nbImg-1;344 displayPictureInfo(gmapsMarkup.currentInfo.displayed);345 }346 347 /**348 *349 */350 function displayPictureNext()351 {352 gmapsMarkup.currentInfo.displayed++;353 if(gmapsMarkup.currentInfo.displayed>=gmapsMarkup.currentInfo.nbImg) gmapsMarkup.currentInfo.displayed=0;354 displayPictureInfo(gmapsMarkup.currentInfo.displayed);355 }356 357 358 /**359 * check if zoomLevel360 */361 function fitToBounds(bounds, mapIndex)362 {363 gmapsMarkup.maps[mapIndex].gMap.fitBounds(bounds);364 365 if(gmapsMarkup.maps[mapIndex].zoomLevelMaxActivated &&366 gmapsMarkup.maps[mapIndex].gMap.getZoom() > gmapsMarkup.maps[mapIndex].zoomLevel)367 {368 gmapsMarkup.maps[mapIndex].gMap.setZoom(gmapsMarkup.maps[mapIndex].zoomLevel);369 }370 }371 372 function initializeMapViewport(mapIndex)373 {374 if(mapIndex>-1 && !gmapsMarkup.maps[mapIndex].gMap.initialized)375 {376 // reduce copyright size... ^_^377 $('#'+gmapsMarkup.maps[mapIndex].id+' span, #'+gmapsMarkup.maps[mapIndex].id+' a').css('font-size', '55.0%');378 379 if(gmapsMarkup.maps[mapIndex].markerVisible)380 {381 google.maps.event.addListener(382 gmapsMarkup.maps[mapIndex].gMap,383 'dragend',384 function()385 {386 loadMarkers(this);387 }388 );389 390 google.maps.event.addListener(391 gmapsMarkup.maps[mapIndex].gMap,392 'zoom_changed',393 function()394 {395 loadMarkers(this);396 gmapsMarkup.infoWindow.close();397 }398 );399 }400 401 402 if(gmapsMarkup.maps[mapIndex].kmlZoom && gmapsMarkup.maps[mapIndex].gMap.kmlFile!=null)403 {404 google.maps.event.addListenerOnce(405 gmapsMarkup.maps[mapIndex].gMap.kmlFile,406 'defaultviewport_changed',407 function()408 {409 fitToBounds(gmapsMarkup.maps[mapIndex].gMap.kmlFile.getDefaultViewport(), mapIndex);410 }411 );412 413 }414 415 gmapsMarkup.maps[mapIndex].gMap.initialized=true;416 }417 }418 419 423 420 424 $(window).load(function () 421 425 { 426 var mm=new markupMaps(); 427 422 428 // all maps have the same initials bounds 423 429 gmapsMarkup.currentInfo=null; … … 428 434 'closeclick', 429 435 function () { 430 $('body').append($('#iGMapsInfoWindowContent'));436 //$('body').append($('#iGMapsInfoWindowContent')); 431 437 gmapsMarkup.infoWindow.setContent(''); 432 438 $('#ciGMIWC_img').unbind(); … … 459 465 ); 460 466 461 createMap(gmapsMarkup.maps[i], i);467 mm.createMap(gmapsMarkup.maps[i], i); 462 468 } 463 469 } … … 466 472 467 473 468 469 $('body').append($('<div/>', 474 if($('#iGMapsInfoWindow').length==0) 475 { 476 $('body').append($('<div/>', 470 477 { 471 478 id:'iGMapsInfoWindow', … … 491 498 css:{width:'28px'} 492 499 } 493 ).append($('<div id="iWALeft" onclick=" displayPicturePrev();"/>')500 ).append($('<div id="iWALeft" onclick="mm.displayPicturePrev();"/>') 494 501 ) 495 502 ) … … 506 513 css:{width:'28px'} 507 514 } 508 ).append($('<div id="iWARight" onclick=" displayPictureNext();">')515 ).append($('<div id="iWARight" onclick="mm.displayPictureNext();">') 509 516 ) 510 517 ) … … 538 545 ) 539 546 ); 547 } 540 548 541 549 }
Note: See TracChangeset
for help on using the changeset viewer.