Advertisement
Sdelkadrom

Untitled

Feb 23rd, 2019
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.11 KB | None | 0 0
  1. function reInitMap(){
  2. address = "";
  3.  
  4. if($("#Apartment_customCity").is(":visible") && $("#Apartment_customCity").length){
  5. address += addAddressString($("#ap_country option:selected").html());
  6. address += addAddressString($("#Apartment_customCity").val());
  7. }
  8. else {
  9. if($("#Apartment_city_id").length){
  10. address += addAddressString($("#Apartment_city_id option:selected").html());
  11. } else {
  12. address += addAddressString($("#ap_country option:selected").html());
  13. var region = addAddressString($("#ap_region option:selected").html());
  14. var area = addAddressString($("#ap_area option:selected").html());
  15. var city = addAddressString($("#ap_city option:selected").html());
  16.  
  17. if (region !== city) {
  18. address += region;
  19. }
  20.  
  21. if (area !== city && area !== region) {
  22. address += area;
  23. }
  24.  
  25. address += city;
  26. }
  27. }
  28.  
  29. if ($("#id_Apartmentaddress_"+lang).val()) {
  30. address += addAddressString($("#id_Apartmentaddress_"+lang).val());
  31. }
  32. else if ($("input[name=\'Apartment[address_"+lang+"]\']").val()) {
  33. address += addAddressString($("input[name=\'Apartment[address_"+lang+"]\']").val());
  34. }
  35.  
  36. $("#address_for_map").val(address);
  37.  
  38. // place code to end of queue
  39. if(useGoogleMap){
  40. setTimeout(function(){
  41. var tmpGmapCenter = mapGMap.getCenter();
  42.  
  43. google.maps.event.trigger($("#googleMap")[0], "resize");
  44. mapGMap.setCenter(tmpGmapCenter);
  45. }, 0);
  46. }
  47.  
  48. if(useYandexMap){
  49. setTimeout(function(){
  50. ymaps.ready(function () {
  51. globalYMap.container.fitToViewport();
  52. globalYMap.setCenter(globalYMap.getCenter());
  53. });
  54. }, 0);
  55. }
  56.  
  57. if(useOSMap){
  58. setTimeout(function(){
  59. L.Util.requestAnimFrame(mapOSMap.invalidateSize,mapOSMap,!1,mapOSMap._container);
  60. }, 0);
  61. }
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement