PageSourceSearch

https://petachya.org.il/wp-content/plugins/listing-designs-for-google-maps/assets/js/wpgmp-layouts.js

js petachya.org.il collected 2026-09-25 11:13:49 UTC 4,028 bytes, 116 lines download raw bytes

1jQuery( document ).ready(function($) {
2			    
3    jQuery.fn.displayLocationOnHover = function ( options ) { 
4
5    	let settings = $.extend( { mapWidth: "50" }, options );
6
7		let map_obj = jQuery(settings.wpgmp_map_selector).data("wpgmp_maps");
8
9		let mapId = map_obj.map_data.map_property.map_id; 
10
11		let mapDivHeight = map_obj.map_data.map_options['height']; 
12
13		let listingDivHeight = '';
14
15		if( map_obj.map_data.listing !== undefined && parseInt(map_obj.map_data.places.length) > parseInt(map_obj.map_data.listing.pagination.listing_per_page) ){
16	 		listingDivHeight = mapDivHeight - 65;
17	 	}
18	 	else {
19	 		listingDivHeight = mapDivHeight;	
20		}
21		
22	 	let enable_zoom_on_hover = function(){
23
24	 		jQuery(map_obj.container).on("mouseenter", ".wpgmp_locations a[data-marker]", function() {
25	 			
26	 			let current_link = this;
27                let current_marker = $(this).data('marker');
28                setTimeout(function() {
29                    map_obj.open_infowindow($(current_link).data("marker"));
30                }, 600);
31                $.each(map_obj.map_data.places, function(key, place) {
32	                if (parseInt(place.id) == parseInt(current_marker) && place.marker.visible === true) {
33	                   		map_obj.map.setCenter(place.marker.getPosition());
34	                   		return false;
35	                }
36	            });
37                map_obj.map.setZoom(parseInt(8));
38                    
39            });
40            
41            jQuery(map_obj.container).on("mouseenter", ".map-listing-container .fc-feature-img img", function() {
42				
43				$(this).parent().parent().parent('li').next('li').find('.fc-itemcontent-padding').find('.fc-item-title').find('a[data-marker]').trigger('mouseenter');
44			}); 
45			
46	 	}
47
48		let apply_layout_changes = function(){ 
49
50			jQuery(map_obj.container).find('.location_listing'+mapId).css({"height": listingDivHeight+'px', "overflow": 'auto'}); 
51		}
52
53		let make_compatible_with_old_version = function(){ 
54
55			if(jQuery(map_obj.container).find('.wpgmp_filter_wrappers').length > 0 && jQuery(map_obj.container).find('.search-form-container').find('.wpgmp_filter_wrappers').html() == ''){ 
56
57			   jQuery(map_obj.container).find('.search-form-container').find('.wpgmp_filter_wrappers').remove();			
58			   jQuery(map_obj.container).find('.map_div').find('.wpgmp_filter_wrappers').clone(true,true).appendTo( jQuery(map_obj.container).find('.search-form-container') );
59
60			   jQuery(map_obj.container).find('.map_div').find('.wpgmp_filter_wrappers').remove();
61
62			}
63
64		}
65		
66	 	if (map_obj !== 'undefined' && map_obj.map_data.listing && map_obj.map_data.layoutManager) { 
67			make_compatible_with_old_version();
68	 		apply_layout_changes(); 		
69	 	}
70
71	 	if (map_obj !== 'undefined' && map_obj.map_data.listing && map_obj.map_data.zoomOnHover) { 
72	 		enable_zoom_on_hover(); 		
73	 	}
74
75	 	return this;
76	};
77
78	jQuery("div.wpgmp_map_container").each(function (index, element) { 
79
80		let wpgmp_map_selector = "#"+$(this).attr('rel');
81		let wpgmp_layout_args = {'wpgmp_map_selector' : wpgmp_map_selector};
82		jQuery(wpgmp_map_selector).displayLocationOnHover(wpgmp_layout_args);
83	    
84	});
85	
86	jQuery("input[name='extensions_fields[layout_settings][layout_id]").on("change", function($) {
87
88		$("input[name='extensions_fields[layout_settings][layout_id]").closest('div').find('.layout-img').removeClass("selected");
89    	if($(this).is(":checked")) {
90        	$(this).closest('div').find('.layout-img').addClass("selected");
91      	}
92    
93    });
94
95	if(jQuery('.wpgmp_layouts_demo').length > 0){
96
97		jQuery("ul.nav-tabs").find('li').on("click", function($) {
98
99			jQuery("div.wpgmp_map_container").each(function (index, element) { 
100				
101				let wpgmp_map_selector = "#"+jQuery(this).attr('rel');
102				let map_obj = jQuery(wpgmp_map_selector).data("wpgmp_maps");
103				var gmap = map_obj.map;
104		        var zoom = gmap.getZoom();
105		        var center = gmap.getCenter();
106		        google.maps.event.trigger(gmap, 'resize');
107		        gmap.setZoom(4);
108	   
109		    
110			});
111       
112		});    
113
114	}
115		
116});

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.