Ignore:
Timestamp:
Sep 23, 2011, 10:44:08 PM (13 years ago)
Author:
grum
Message:

fix bugs
bug:2346 - Preview / next arrow do not work with [gmaps] tag in description
bug:2063 - Incompatibility with slideshow mode

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/GMaps/js/gmapsCategory.min.js

    r10551 r12204  
    1 /* file: gmapsCategory.js - v1.2.1 | minified on 2011/04/21 with http://jscompress.com/ */
    2 var markerImgProp=[null,{w:32,h:32,x:15,y:31},{w:32,h:32,x:15,y:31},{w:32,h:32,x:10,y:31},{w:30,h:40,x:4,y:39}];function createMap(properties,gmapsIndex)
    3 {var map=new google.maps.Map($("#"+properties.id).get(0),{backgroundColor:'#ffffff',mapTypeId:properties.mapType,zoom:properties.zoomLevel,center:gmaps.bounds.getCenter(),navigationControl:(properties.navigationControl==-1)?false:true,scrollwheel:(properties.navigationControl==-1)?false:true,scaleControl:(properties.scaleControl=='n')?false:true,streetViewControl:(properties.streetViewControl=='n')?false:true,mapTypeControl:(properties.mapTypeControl==-1)?false:true,mapTypeControlOptions:{style:properties.mapTypeControl},markerTitle:''});if(properties.kmlFileUrl!='')
    4 {kmlFile=new google.maps.KmlLayer(properties.kmlFileUrl,{preserveViewport:true});kmlFile.setMap(map);}
    5 else
    6 {kmlFile=null;}
    7 re=/^mS(\d\d)_.*/i;iM=re.exec(properties.markerImg);if(iM!=null)iM=new Number(iM[1]);if(iM!=null)
    8 {map.markerImg=new google.maps.MarkerImage('plugins/GMaps/img/'+properties.markerImg,new google.maps.Size(markerImgProp[iM].w,markerImgProp[iM].h),new google.maps.Point(0,0),new google.maps.Point(markerImgProp[iM].x,markerImgProp[iM].y));}
    9 else
    10 {map.markerImg=null;}
    11 map.kmlFile=kmlFile;map.markers=new Array();map.gmapsIndex=gmapsIndex;map.viewportInitialized=false;map.callId=0;properties.gMap=map;}
    12 function loadMarkers(map)
    13 {map.callId++;datas={requestId:gmaps.requestId,callId:map.callId,bounds:{north:map.getBounds().getNorthEast().lat(),east:map.getBounds().getNorthEast().lng(),south:map.getBounds().getSouthWest().lat(),west:map.getBounds().getSouthWest().lng()},width:$(map.getDiv()).width(),height:$(map.getDiv()).height(),distanceTreshold:20,loadIndex:map.gmapsIndex,};$('#gmapsLoading').css('display','inline-block');$('#gmapsNbPhotos').html('');$.ajax({type:"POST",url:"plugins/GMaps/gmaps_ajax.php",async:true,data:{ajaxfct:"public.maps.getMarkers",datas:datas},success:function(msg)
    14 {tmp=$.parseJSON(msg);if(gmaps.maps[tmp.loadIndex].gMap.callId==tmp.callId)
    15 {tmp.markers.sort(compareMarkers);applyMarkers(gmaps.maps[tmp.loadIndex].gMap,tmp.markers);$('#gmapsLoading').css('display','none');$('#gmapsNbPhotos').html('['+tmp.datas.nbPhotos+']');}}});}
    16 function applyMarkers(map,markers)
    17 {if(map.markers.length>0)
    18 {var i=0;while(i<map.markers.length)
    19 {newListIndex=markerInList(map.markers[i].uId,markers);if(newListIndex==-1)
    20 {map.markers[i].marker.setMap(null);map.markers.splice(i,1);}
    21 else
    22 {markers.splice(newListIndex,1);i++;}}}
    23 for(var i=0;i<markers.length;i++)
    24 {var marker=new google.maps.Marker({position:new google.maps.LatLng(markers[i].lat,markers[i].lng),map:map,title:markers[i].nbImgTxt});if(map.markerImg!=null)marker.setIcon(map.markerImg);marker.info=markers[i];marker.info.displayed=0;map.markers.push({marker:marker,uId:markers[i].uId});google.maps.event.addListener(marker,'click',function()
    25 {displayWindowInfo(this);});for(var index=0;index<marker.info.imgTn.length;index++)
    26 {switch(marker.info.imgTn[index].charAt(0))
    27 {case'G':marker.info.imgTn[index]='./galleries/'+marker.info.imgTn[index].substr(1);break;case'U':marker.info.imgTn[index]='./upload/'+marker.info.imgTn[index].substr(1);break;}}}}
    28 function compareMarkers(m1,m2)
    29 {if(m1.uId<m2.uId)
    30 {return(-1);}
    31 else if(m1.uId<m2.uId)
    32 {return(1);}
    33 return(0);}
    34 function markerInList(uniqueId,markerList)
    35 {for(var i=0;i<markerList.length;i++)
    36 {if(markerList[i].uId==uniqueId)return(i)}
    37 return(-1);}
    38 function displayWindowInfo(marker)
    39 {gmaps.currentInfo=marker.info;gmaps.infoWindow.close();gmaps.infoWindow.setContent($('#iGMapsInfoWindowContent').clone().each(renameId).get(0));gmaps.infoWindow.open(marker.map,marker);displayPictureInfo(gmaps.currentInfo.displayed);}
    40 function renameId(i,e)
    41 {if(e.id!='')e.id='c'+e.id;$(e).children().each(renameId);}
    42 function displayPictureInfo(index)
    43 {gmaps.currentInfo.displayed=index;if(gmaps.currentInfo.imgName[index]=='')
    44 {$('#ciGMIWC_title').html(' ');}
    45 else
    46 {$('#ciGMIWC_title').html(gmaps.currentInfo.imgName[index]);}
    47 $('#ciGMIWC_img').attr('src',gmaps.currentInfo.imgTn[index]);$('#ciGMIWC_img').unbind();if(gmaps.currentInfo.imgCatsUrl[index].length==1)
    48 {$('#ciGMIWC_img').bind('click',function()
    49 {window.location=gmaps.currentInfo.imgCatsUrl[gmaps.currentInfo.displayed][0];});}
    50 else
    51 {$('#ciGMIWC_showcatList').html('');for(var i=0;i<gmaps.currentInfo.imgCatsUrl[index].length;i++)
    52 {$('#ciGMIWC_showcatList').append('<li><a href="'+gmaps.currentInfo.imgCatsUrl[index][i]+'">'+gmaps.currentInfo.imgCatsNames[index][i]+'</a></li>');}
    53 $('#ciGMIWC_img, #ciGMIWC_showcat').bind('mouseenter',function(){$('#ciGMIWC_showcat').css('display','block');}).bind('mouseleave',function(){$('#ciGMIWC_showcat').css('display','none');});}
    54 if(gmaps.currentInfo.nbImg>1)
    55 {$('#ciGMIWC_picnum').html((index+1)+'/'+gmaps.currentInfo.nbImgTxt);$('#ciWALeft, #ciWARight').css('display','inline-block');}
    56 else
    57 {$('#ciGMIWC_picnum').html(gmaps.currentInfo.nbImgTxt);$('#ciWALeft, #ciWARight').css('display','none');}}
    58 function displayPicturePrev()
    59 {gmaps.currentInfo.displayed--;if(gmaps.currentInfo.displayed<0)gmaps.currentInfo.displayed=gmaps.currentInfo.nbImg-1;displayPictureInfo(gmaps.currentInfo.displayed);}
    60 function displayPictureNext()
    61 {gmaps.currentInfo.displayed++;if(gmaps.currentInfo.displayed>=gmaps.currentInfo.nbImg)gmaps.currentInfo.displayed=0;displayPictureInfo(gmaps.currentInfo.displayed);}
    62 function fitToBounds(bounds,mapIndex)
    63 {gmaps.maps[mapIndex].gMap.fitBounds(bounds);if(gmaps.maps[mapIndex].zoomLevelMaxActivated&&gmaps.maps[mapIndex].gMap.getZoom()>gmaps.maps[mapIndex].zoomLevel)
    64 {gmaps.maps[mapIndex].gMap.setZoom(gmaps.maps[mapIndex].zoomLevel);}}
    65 function initializeMapViewport(mode,mapIndex)
    66 {if(mapIndex>-1&&($('#'+gmaps.maps[mapIndex].id+'Content').dialog('isOpen')&&mode=='loaded'||mode=='open')&&(gmaps.maps[mapIndex].gMap.viewportInitialized==false))
    67 {google.maps.event.trigger(gmaps.maps[mapIndex].gMap,'resize');$('#'+gmaps.maps[mapIndex].id+' span, #'+gmaps.maps[mapIndex].id+' a').css('font-size','55.0%');if(gmaps.geolocated)
    68 {if(gmaps.maps[mapIndex].fitToBounds)
    69 {fitToBounds(gmaps.bounds,mapIndex);}
    70 else
    71 {gmaps.maps[mapIndex].gMap.setCenter(gmaps.bounds.getCenter());}}
    72 else
    73 {fitToBounds(gmaps.maps[mapIndex].gMap.kmlFile.getDefaultViewport(),mapIndex);}
    74 google.maps.event.addListener(gmaps.maps[mapIndex].gMap,'dragend',function()
    75 {loadMarkers(this);$('#gmapsBoundMap').css('display','inline');$('#gmapsBoundKml').css('display','inline');});google.maps.event.addListener(gmaps.maps[mapIndex].gMap,'zoom_changed',function()
    76 {loadMarkers(this);gmaps.infoWindow.close();$('#gmapsBoundMap').css('display','inline');$('#gmapsBoundKml').css('display','inline');});gmaps.maps[mapIndex].gMap.viewportInitialized=true;loadMarkers(gmaps.maps[mapIndex].gMap);}}
    77 $(window).load(function()
    78 {gmaps.currentInfo=null;gmaps.bounds=new google.maps.LatLngBounds(new google.maps.LatLng(gmaps.bounds.south,gmaps.bounds.west),new google.maps.LatLng(gmaps.bounds.north,gmaps.bounds.east));gmaps.infoWindow=new google.maps.InfoWindow();google.maps.event.addListener(gmaps.infoWindow,'closeclick',function(){gmaps.infoWindow.setContent('');$('#ciGMIWC_img').unbind();});for(var i=0;i<gmaps.maps.length;i++)
    79 {createMap(gmaps.maps[i],i);if(gmaps.maps[i].sizeMode=='A')
    80 {$('#'+gmaps.maps[i].id).css({width:($(window).width()*gmaps.popupAutomaticSize)+'px',height:($(window).height()*gmaps.popupAutomaticSize)+'px'});}
    81 $('#'+gmaps.maps[i].id+'Content').dialog({autoOpen:false,width:$('#'+gmaps.maps[i].id).width(),height:'auto',modal:true,closeText:'X',dialogClass:'gmapsPopup',title:gmaps.maps[i].title,open:function()
    82 {$.ajax({type:"POST",url:"plugins/GMaps/gmaps_ajax.php",async:true,data:{ajaxfct:"public.maps.init",category:gmaps.categoryId,mapId:'n'},success:function(msg)
    83 {gmaps.requestId=msg;for(var i=0;i<gmaps.maps.length;i++)
    84 {initializeMapViewport('loaded',i);}}});}}).data('index',i);if(gmaps.geolocated)
    85 {$('div.gmapsPopup div.ui-dialog-titlebar').append('<a href="#" id="gmapsBoundMap" style="display:none;" onclick="fitToBounds(gmaps.bounds, '+i+'); $(this).css(\'display\', \'none\').blur(); return(false);">'+'<span>∴</span></a>');$('#gmapsBoundMap').attr('title',gmaps.lang.boundmap);}
    86 if(gmaps.maps[i].gMap.kmlFile!=null)
    87 {$('div.gmapsPopup div.ui-dialog-titlebar').append('<a href="#" id="gmapsBoundKml" onclick="fitToBounds(gmaps.maps['+i+'].gMap.kmlFile.getDefaultViewport(), '+i+'); $(this).css(\'display\', \'none\').blur(); return(false);">'+'<span>∼</span></a>');$('#gmapsBoundKml').attr('title',gmaps.lang.boundkml);}
    88 $('div.gmapsPopup div.ui-dialog-titlebar').append('<span id="gmapsLoading" style="display:none;"><img src="./plugins/GrumPluginClasses/icons/processing.gif"><span>'+gmaps.lang.loading+'</span></span>');$('#ui-dialog-title-iGMapsIconContent').append('<span id="gmapsNbPhotos"></span>');}});
     1/* file: gmapsCategory.js - v1.2.2 | minified on 2011/09/23 with http://jscompress.com/ */
     2function categoryMaps(){var a=[null,{w:32,h:32,x:15,y:31},{w:32,h:32,x:15,y:31},{w:32,h:32,x:10,y:31},{w:30,h:40,x:4,y:39}],b={width:-1,height:-1};this.createMap=function(b,c){var d=new google.maps.Map($("#"+b.id).get(0),{backgroundColor:"#ffffff",mapTypeId:b.mapType,zoom:b.zoomLevel,center:gmaps.bounds.getCenter(),navigationControl:b.navigationControl==-1?false:true,scrollwheel:b.navigationControl==-1?false:true,scaleControl:b.scaleControl=="n"?false:true,streetViewControl:b.streetViewControl=="n"?false:true,mapTypeControl:b.mapTypeControl==-1?false:true,mapTypeControlOptions:{style:b.mapTypeControl},markerTitle:""});if(b.kmlFileUrl!=""){kmlFile=new google.maps.KmlLayer(b.kmlFileUrl,{preserveViewport:true});kmlFile.setMap(d)}else{kmlFile=null}re=/^mS(\d\d)_.*/i;iM=re.exec(b.markerImg);if(iM!=null)iM=new Number(iM[1]);if(iM!=null){d.markerImg=new google.maps.MarkerImage("plugins/GMaps/img/"+b.markerImg,new google.maps.Size(a[iM].w,a[iM].h),new google.maps.Point(0,0),new google.maps.Point(a[iM].x,a[iM].y))}else{d.markerImg=null}d.kmlFile=kmlFile;d.markers=new Array;d.gmapsIndex=c;d.viewportInitialized=false;d.callId=0;b.gMap=d};this.loadMarkers=function(a){var b=this;a.callId++;datas={requestId:gmaps.requestId,callId:a.callId,bounds:{north:a.getBounds().getNorthEast().lat(),east:a.getBounds().getNorthEast().lng(),south:a.getBounds().getSouthWest().lat(),west:a.getBounds().getSouthWest().lng()},width:$(a.getDiv()).width(),height:$(a.getDiv()).height(),distanceTreshold:20,loadIndex:a.gmapsIndex};$("#gmapsLoading").css("display","inline-block");$("#gmapsNbPhotos").html("");$.ajax({type:"POST",url:"plugins/GMaps/gmaps_ajax.php",async:true,data:{ajaxfct:"public.maps.getMarkers",datas:datas},success:function(a){tmp=$.parseJSON(a);if(gmaps.maps[tmp.loadIndex].gMap.callId==tmp.callId){tmp.markers.sort(c);b.applyMarkers(gmaps.maps[tmp.loadIndex].gMap,tmp.markers);$("#gmapsLoading").css("display","none");$("#gmapsNbPhotos").html("["+tmp.datas.nbPhotos+"]")}}})};this.applyMarkers=function(a,b){var c=this;if(a.markers.length>0){var d=0;while(d<a.markers.length){newListIndex=this.markerInList(a.markers[d].uId,b);if(newListIndex==-1){a.markers[d].marker.setMap(null);a.markers.splice(d,1)}else{b.splice(newListIndex,1);d++}}}for(var d=0;d<b.length;d++){var e=new google.maps.Marker({position:new google.maps.LatLng(b[d].lat,b[d].lng),map:a,title:b[d].nbImgTxt});if(a.markerImg!=null)e.setIcon(a.markerImg);e.info=b[d];e.info.displayed=0;a.markers.push({marker:e,uId:b[d].uId});google.maps.event.addListener(e,"click",function(){c.displayWindowInfo(this)});for(var f=0;f<e.info.imgTn.length;f++){switch(e.info.imgTn[f].charAt(0)){case"G":e.info.imgTn[f]="./galleries/"+e.info.imgTn[f].substr(1);break;case"U":e.info.imgTn[f]="./upload/"+e.info.imgTn[f].substr(1);break}}}};var c=function(a,b){if(a.uId<b.uId){return-1}else if(a.uId<b.uId){return 1}return 0};this.markerInList=function(a,b){for(var c=0;c<b.length;c++){if(b[c].uId==a)return c}return-1};this.displayWindowInfo=function(a){var c=this;if(gmapsMM!=null&&gmapsMM instanceof markupMaps)gmapsMM.closePictureInfo();b.width=-1;b.width=-1;gmaps.currentMarker=a;gmaps.currentInfo=a.info;gmaps.infoWindow.close();gmaps.infoWindow.setContent($("#iGMapsInfoWindowContent").clone().each(d).get(0));gmaps.infoWindow.open(a.map,a);$("#ciWALeft, #ciWARight").unbind("click");$("#ciWARight").bind("click",function(a){c.displayPictureNext()});$("#ciWALeft").bind("click",function(a){c.displayPicturePrev()});this.displayPictureInfo(gmaps.currentInfo.displayed)};var d=function(a,b){if(b.id!="")b.id="c"+b.id;$(b).children().each(d)};this.closePictureInfo=function(){gmaps.currentMarker=null;gmaps.currentInfo=null;gmaps.infoWindow.setContent("");gmaps.infoWindow.close();$("#ciGMIWC_img").unbind("click");$("#ciWALeft, #ciWARight").unbind("click")};this.displayPictureInfo=function(a){var b=a,c=this;gmaps.currentInfo.displayed=a;if(gmaps.currentInfo.imgName[a]==""){$("#ciGMIWC_title").html(" ")}else{$("#ciGMIWC_title").html(gmaps.currentInfo.imgName[a])}$("#ciGMIWC_img").attr("src",gmaps.currentInfo.imgTn[a]).bind("load",function(a){});$("#ciGMIWC_img").unbind("click");if(gmaps.currentInfo.imgCatsUrl[a].length==1){$("#ciGMIWC_img").bind("click",function(){window.location=gmaps.currentInfo.imgCatsUrl[gmaps.currentInfo.displayed][0]})}else{$("#ciGMIWC_showcatList").html("");for(var d=0;d<gmaps.currentInfo.imgCatsUrl[a].length;d++){$("#ciGMIWC_showcatList").append('<li><a href="'+gmaps.currentInfo.imgCatsUrl[a][d]+'">'+gmaps.currentInfo.imgCatsNames[a][d]+"</a></li>")}$("#ciGMIWC_img, #ciGMIWC_showcat").bind("mouseenter",function(){$("#ciGMIWC_showcat").css("display","block")}).bind("mouseleave",function(){$("#ciGMIWC_showcat").css("display","none")})}if(gmaps.currentInfo.nbImg>1){$("#ciGMIWC_picnum").html(a+1+"/"+gmaps.currentInfo.nbImgTxt);$("#ciWALeft, #ciWARight").css("display","inline-block")}else{$("#ciGMIWC_picnum").html(gmaps.currentInfo.nbImgTxt);$("#ciWALeft, #ciWARight").css("display","none")}};this.displayPicturePrev=function(){gmaps.currentInfo.displayed--;if(gmaps.currentInfo.displayed<0)gmaps.currentInfo.displayed=gmaps.currentInfo.nbImg-1;this.displayPictureInfo(gmaps.currentInfo.displayed)};this.displayPictureNext=function(){gmaps.currentInfo.displayed++;if(gmaps.currentInfo.displayed>=gmaps.currentInfo.nbImg)gmaps.currentInfo.displayed=0;this.displayPictureInfo(gmaps.currentInfo.displayed)};this.fitToBounds=function(a,b){gmaps.maps[b].gMap.fitBounds(a);if(gmaps.maps[b].zoomLevelMaxActivated&&gmaps.maps[b].gMap.getZoom()>gmaps.maps[b].zoomLevel){gmaps.maps[b].gMap.setZoom(gmaps.maps[b].zoomLevel)}};this.initializeMapViewport=function(a,b){var c=this;if(b>-1&&($("#"+gmaps.maps[b].id+"Content").dialog("isOpen")&&a=="loaded"||a=="open")&&gmaps.maps[b].gMap.viewportInitialized==false){google.maps.event.trigger(gmaps.maps[b].gMap,"resize");$("#"+gmaps.maps[b].id+" span, #"+gmaps.maps[b].id+" a").css("font-size","55.0%");if(gmaps.geolocated){if(gmaps.maps[b].fitToBounds){this.fitToBounds(gmaps.bounds,b)}else{gmaps.maps[b].gMap.setCenter(gmaps.bounds.getCenter())}}else{this.fitToBounds(gmaps.maps[b].gMap.kmlFile.getDefaultViewport(),b)}google.maps.event.addListener(gmaps.maps[b].gMap,"dragend",function(){c.loadMarkers(this);$("#gmapsBoundMap").css("display","inline");$("#gmapsBoundKml").css("display","inline")});google.maps.event.addListener(gmaps.maps[b].gMap,"zoom_changed",function(){c.loadMarkers(this);gmaps.infoWindow.close();$("#gmapsBoundMap").css("display","inline");$("#gmapsBoundKml").css("display","inline")});gmaps.maps[b].gMap.viewportInitialized=true;this.loadMarkers(gmaps.maps[b].gMap)}}}var gmapsCM=null,gmapsMM=null;$(window).load(function(){gmapsCM=new categoryMaps;initInfoWindow();gmaps.currentInfo=null;gmaps.currentMarker=null;gmaps.bounds=new google.maps.LatLngBounds(new google.maps.LatLng(gmaps.bounds.south,gmaps.bounds.west),new google.maps.LatLng(gmaps.bounds.north,gmaps.bounds.east));gmaps.infoWindow=new google.maps.InfoWindow;google.maps.event.addListener(gmaps.infoWindow,"closeclick",function(){gmaps.infoWindow.setContent("");$("#ciGMIWC_img").unbind("click")});for(var a=0;a<gmaps.maps.length;a++){gmapsCM.createMap(gmaps.maps[a],a);if(gmaps.maps[a].sizeMode=="A"){$("#"+gmaps.maps[a].id).css({width:$(window).width()*gmaps.popupAutomaticSize+"px",height:$(window).height()*gmaps.popupAutomaticSize+"px"})}$("#"+gmaps.maps[a].id+"Content").dialog({autoOpen:false,width:$("#"+gmaps.maps[a].id).width(),height:"auto",modal:true,closeText:"X",dialogClass:"gmapsPopup",title:gmaps.maps[a].title,open:function(){$.ajax({type:"POST",url:"plugins/GMaps/gmaps_ajax.php",async:true,data:{ajaxfct:"public.maps.init",category:gmaps.categoryId,mapId:"n"},success:function(a){gmaps.requestId=a;for(var b=0;b<gmaps.maps.length;b++){gmapsCM.initializeMapViewport("loaded",b)}}})}}).data("index",a);if(gmaps.geolocated){$("div.gmapsPopup div.ui-dialog-titlebar").append('<a href="#" id="gmapsBoundMap" style="display:none;"><span>∴</span></a>');$("#gmapsBoundMap").attr("title",gmaps.lang.boundmap).bind("click",a,function(a){gmapsCM.fitToBounds(gmaps.bounds,a.data);$(this).css("display","none").blur();return false})}if(gmaps.maps[a].gMap.kmlFile!=null){$("div.gmapsPopup div.ui-dialog-titlebar").append('<a href="#" id="gmapsBoundKml"><span>∼</span></a>');$("#gmapsBoundKml").attr("title",gmaps.lang.boundkml).bind("click",a,function(a){gmapsCM.fitToBounds(gmaps.maps[a.data].gMap.kmlFile.getDefaultViewport(),a.data);$(this).css("display","none").blur();return false})}$("div.gmapsPopup div.ui-dialog-titlebar").append('<span id="gmapsLoading" style="display:none;"><img src="./plugins/GrumPluginClasses/icons/processing.gif"><span>'+gmaps.lang.loading+"</span></span>");$("#ui-dialog-title-iGMapsIconContent").append('<span id="gmapsNbPhotos"></span>')}})
Note: See TracChangeset for help on using the changeset viewer.