Ignore:
Timestamp:
Jan 7, 2011, 6:13:48 PM (13 years ago)
Author:
cljosse
Message:

[edit_gmaps] Improvement of the display.


File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/edit_gmaps/admin/js/JScript.js

    r8466 r8501  
    99function onLoad() {
    1010    var reg = new RegExp('/', "g");
    11    
    12   coordinates.ADRESSE=  coordinates.ADRESSE.replace("/",", ");
     11   
     12    if (coordinates.ADRESSE)
     13        coordinates.ADRESSE = coordinates.ADRESSE.replace("/", ", ");
    1314
    1415          document.getElementById("match").value = coordinates.ADRESSE;
    1516                geocoder = new google.maps.Geocoder();
    1617                    var mapElement = document.getElementById("map");
    17              if  ( coordinates.LAT  <= 90 ) {
    18                
    19                  n = coordinates.ADRESSE.indexOf("/");
    20                  if (n>0)
    21                      zoom = 5;
    22                      else
    23                             zoom = 18 ;
     18                    if (coordinates.LAT <= 90 && coordinates.LAT != " " && coordinates.LAT != "" ) {
     19
    2420                        } else {
    2521                            coordinates.LAT=49 ;coordinates.LON = 3;
    26                        
     22                            coordinates.ZOOM = coordinates.ZOOM | 18;
    2723                            geocoder.geocode({ 'address': coordinates.ADRESSE }, function (results, status) {
    2824                                /* Si l'adresse a pu être géolocalisée */
     
    3632                                }
    3733                            });
    38                  
    39                             zoom = 4;
     34
     35                           
    4036                        }
    41  
     37  zoom = coordinates.ZOOM;
    4238   LatLng = new google.maps.LatLng(coordinates.LAT, coordinates.LON);
    4339 
     
    113109                document.Envoie.lat.value=latLng.lat() ;
    114110                document.Envoie.lon.value = latLng.lng();
     111               
    115112               
    116113                }
    117114           
    118            function updateMarkerAddress(str) {               
    119                   document.getElementById('markerAdress').innerHTML = str;
    120 
     115           function updateMarkerAddress(str) {
     116               document.getElementById('markerAdress').innerHTML = str;
     117       
     118               jQuery("#match").val(str);
    121119            }
    122120
     
    161159      }
    162160  });
    163         }
    164 
    165 
    166 
    167 
    168         jQuery().ready(function () {
    169 
    170 
    171             jQuery('.cluetip').cluetip({
    172                 width: 300, height: 100,
    173                 splitTitle: '|'
    174             }
     161}
     162
     163//=======================================================
     164function On_Click(a, b, c) {
     165    document.Envoie.lat.value = b;
     166    document.Envoie.lon.value = c;
     167
     168    coordinates = {LAT:a,
     169     LON : b} ;
     170    LatLng = new google.maps.LatLng(coordinates.LAT, coordinates.LON);
     171    updateMarkerPosition(LatLng);
     172
     173
     174}
     175
     176jQuery(window).load(
     177
     178      function () {
     179//Récupérer tous les inputs radios appartenant à un même groupe
     180 /*         a = jQuery('input[type=hidden][name=Selectthumbnail]');
     181          b = a.length;
     182          c = jQuery('input[type=hidden]:checked').length;
     183          d = jQuery('input[type=hidden][name="Selectthumbnail"]').attr('value');
     184*/
     185
     186        //  onLoad();
     187      });
     188
     189jQuery(document).ready(function () {
     190
     191
     192    jQuery('.cluetip').cluetip({
     193        width: 300, height: 100,
     194        splitTitle: '|'
     195    }
    175196  );
    176 
    177             // Resize possible 
    178             jQuery("#cadre").resizable({
    179                 handles: "all",
    180                 animate: true,
    181                 animateDuration: "slow",
    182                 animateEasing: "swing",
    183                 preventDefault: true,
    184                 preserveCursor: true,
    185                 autoHide: true,
    186                 ghost: true
    187             });
    188 
    189             jQuery("#match").keydown(function (e) {
    190 
    191                 // e.target         pour FireFox
    192                 // event.srcElement pour IE
    193                 var Obj = e ? e.target : event.srcElement;
    194                 if (Obj.tagName != "INPUT") return false;
    195 
    196 
    197                 var Code = e.keyCode || e.which;
    198                 if (Code != 13) return true;
    199                     coordinates.ADRESSE=   document.getElementById("match").value  ;
    200                     codeAddress();
    201                 return false;
    202             });
    203 
    204 
    205         });
    206 
     197  jQuery("#search").click(function (e) {
     198
     199        coordinates = { ADRESSE: jQuery("#match").val(),
     200                        LAT:0,LON:0,ZOOM: 18
     201                       };
     202        codeAddress();
     203        return false;
     204    });
     205
     206    jQuery("#match").keydown(function (e) {
     207        // e.target         pour FireFox
     208        // event.srcElement pour IE
     209        var Obj = e ? e.target : event.srcElement;
     210        if (Obj.tagName != "INPUT") return false;
     211        var Code = e.keyCode || e.which;
     212        if (Code != 13) return true;
     213        coordinates = { ADRESSE: jQuery("#match").val(),
     214                        LAT:0,LON:0,ZOOM: 18
     215                       };
     216        codeAddress();
     217        return false;
     218    });
     219
     220
     221});
     222
Note: See TracChangeset for help on using the changeset viewer.