(function($, window, document, undefined){ "use strict"; function GoogleMaps(element, map_data){ var options; this.element=element; this.map_data=$.extend({}, {}, map_data); options=this.map_data.map_options; this.settings=$.extend({ "zoom": "5", "map_type_id": "ROADMAP", "scroll_wheel": true, "map_visual_refresh": false, "full_screen_control": false, "full_screen_control_position": "BOTTOM_RIGHT", "zoom_control": true, "zoom_control_style": "SMALL", "zoom_control_position": "TOP_LEFT", "map_type_control": true, "map_type_control_style": "HORIZONTAL_BAR", "map_type_control_position": "RIGHT_TOP", "scale_control": true, "street_view_control": true, "street_view_control_position": "TOP_LEFT", "overview_map_control": true, "center_lat": "40.6153983", "center_lng": "-74.2535216", "draggable": true }, {}, options); this.container=$("div[rel='" + $(this.element).attr("id") + "']"); var suppress_markers=false; if(this.map_data.map_tabs&&this.map_data.map_tabs.direction_tab){ suppress_markers=this.map_data.map_tabs.direction_tab.suppress_markers; } this.directionsService=new google.maps.DirectionsService(); this.directionsDisplay=new google.maps.DirectionsRenderer({ suppressMarkers: suppress_markers, }); this.drawingmanager={}; this.geocoder=new google.maps.Geocoder(); this.places=[]; this.show_places=[]; this.categories={}; this.tabs=[]; this.all_shapes=[]; this.wpgmp_polylines=[]; this.wpgmp_polygons=[]; this.wpgmp_circles=[]; this.wpgmp_shape_events=[]; this.wpgmp_rectangles=[]; this.per_page_value=0; this.current_amenities=[]; this.route_directions=[]; this.search_area=''; this.markerClusterer=null; this.infowindow_marker=new google.maps.InfoWindow(); this.init(); } GoogleMaps.prototype={ init: function(){ var map_obj=this; var center=new google.maps.LatLng(map_obj.settings.center_lat, map_obj.settings.center_lng); map_obj.map=new google.maps.Map(map_obj.element, { zoom: parseInt(map_obj.settings.zoom), center: center, disableDoubleClickZoom: (map_obj.settings.scroll_wheel!='false'), scrollwheel: map_obj.settings.scroll_wheel, zoomControl: (map_obj.settings.zoom_control===true), fullscreenControl: (map_obj.settings.full_screen_control===true), fullscreenControlOptions: { position: eval("google.maps.ControlPosition." + map_obj.settings.full_screen_control_position) }, zoomControlOptions: { style: eval("google.maps.ZoomControlStyle." + map_obj.settings.zoom_control_style), position: eval("google.maps.ControlPosition." + map_obj.settings.zoom_control_position) }, mapTypeControl: (map_obj.settings.map_type_control==true), mapTypeControlOptions: { style: eval("google.maps.MapTypeControlStyle." + map_obj.settings.map_type_control_style), position: eval("google.maps.ControlPosition." + map_obj.settings.map_type_control_position) }, scaleControl: (map_obj.settings.scale_control==true), streetViewControl: (map_obj.settings.street_view_control==true), streetViewControlOptions: { position: eval("google.maps.ControlPosition." + map_obj.settings.street_view_control_position) }, overviewMapControl: (map_obj.settings.overview_map_control==true), overviewMapControlOptions: { opened: map_obj.settings.overview_map_control }, draggable: map_obj.settings.draggable, mapTypeId: eval("google.maps.MapTypeId." + map_obj.settings.map_type_id), styles: eval(map_obj.map_data.styles) }); map_obj.map_loaded(); map_obj.responsive_map(); map_obj.create_markers(); map_obj.display_markers(); if(map_obj.map_data.street_view){ map_obj.set_streetview(center); } if(map_obj.map_data.bicyle_layer){ map_obj.set_bicyle_layer(); } if(map_obj.map_data.traffic_layer){ map_obj.set_traffic_layer(); } if(map_obj.map_data.transit_layer){ map_obj.set_transit_layer(); } if(map_obj.map_data.panoramio_layer){ map_obj.set_panoramic_layer(); } if(map_obj.settings.display_45_imagery=='45'){ map_obj.set_45_imagery(); } if(typeof map_obj.map_data.map_visual_refresh===true){ map_obj.set_visual_refresh(); } if(map_obj.settings.search_control==true){ map_obj.show_search_control(); } if(map_obj.map_data.listing){ $(map_obj.container).on('click', '.categories_filter_reset_btn', function(){ $(map_obj.container).find('.wpgmp_filter_wrappers select').each(function(){ $(this).find('option:first').attr('selected', 'selected'); }); $('.wpgmp_search_input').val(''); map_obj.update_filters(); }); $(map_obj.container).on('change', '[data-filter="dropdown"]', function(){ map_obj.update_filters(); }); $(map_obj.container).on('click', '[data-filter="checklist"]', function(){ map_obj.update_filters(); }); $(map_obj.container).on('click', '[data-filter="list"]', function(){ if($(this).hasClass('fc_selected')){ $(this).removeClass('fc_selected'); }else{ $(this).addClass('fc_selected'); } map_obj.update_filters(); }); map_obj.display_filters_listing(); $.each(map_obj.map_data.listing.filters, function(key, filter){ $(map_obj.container).find('select[name="' + filter + '"]').on('change', function(){ map_obj.update_filters(); }); }); $(map_obj.container).find('[data-name="radius"]').on('change', function(){ var search_data=$(map_obj.container).find('[data-input="wpgmp-search-text"]').val(); if(search_data.length >=2&&$(this).val()!=''){ map_obj.geocoder.geocode({ "address": search_data }, function(results, status){ if(status==google.maps.GeocoderStatus.OK){ map_obj.search_area=results[0].geometry.location; map_obj.update_filters(); }}); }else{ map_obj.search_area=''; map_obj.update_filters(); }}); $(map_obj.container).find('[data-filter="map-perpage-location-sorting"]').on('change', function(){ map_obj.per_page_value=$(this).val(); map_obj.update_filters(); }); $(map_obj.container).find('[data-input="wpgmp-search-text"]').on('keyup', function(){ var search_data=$(this).val(); $(map_obj.container).find('[data-filter="map-radius"]').val(''); map_obj.search_area=''; if(search_data.length >=2&&map_obj.map_data.listing.apply_default_radius==true){ if(search_data.length >=2){ map_obj.geocoder.geocode({ "address": search_data }, function(results, status){ if(status==google.maps.GeocoderStatus.OK){ map_obj.search_area=results[0].geometry.location; map_obj.update_filters(); }}); }}else{ map_obj.update_filters(); }}); } $("body").on("click", ".wpgmp_marker_link", function(){ map_obj.open_infowindow($(this).data("marker")); $('html, body').animate({ scrollTop: $(map_obj.container).offset().top - 150 }, 500); }); $(map_obj.container).on("click", "a[data-marker]", function(){ map_obj.open_infowindow($(this).data("marker")); $('html, body').animate({ scrollTop: $(map_obj.container).offset().top - 150 }, 500); }); $(map_obj.container).on("click", "a[data-marker]", function(){ map_obj.open_infowindow($(this).data("marker")); }); map_obj.google_auto_suggest($(".wpgmp_auto_suggest")); }, createMarker: function(place){ var map_obj=this; var map=map_obj.map; var placeLoc=place.geometry.location; var image={ url: place.icon, size: new google.maps.Size(25, 25), scaledSize: new google.maps.Size(25, 25) }; place.marker=new google.maps.Marker({ map: map, position: place.geometry.location, icon: image }); google.maps.event.addListener(place.marker, 'click', function(){ if(map_obj.settings.map_infowindow_customisations===true) map_obj.amenity_infowindow.setContent('
' + place.name + '
'); else map_obj.amenity_infowindow.setContent(place.name); map_obj.amenity_infowindow.open(map, this); }); map_obj.current_amenities.push(place); }, marker_bind: function(marker){ var map_obj=this; google.maps.event.addListener(marker, 'drag', function(){ var position=marker.getPosition(); map_obj.geocoder.geocode({ latLng: position }, function(results, status){ if(status==google.maps.GeocoderStatus.OK){ $("#googlemap_address").val(results[0].formatted_address); $(".google_city").val(map_obj.wpgmp_finddata(results[0], 'administrative_area_level_3')||map_obj.wpgmp_finddata(results[0], 'locality')); $(".google_state").val(map_obj.wpgmp_finddata(results[0], "administrative_area_level_1")); $(".google_country").val(map_obj.wpgmp_finddata(results[0], "country")); if(results[0].address_components){ for (var i=0; i < results[0].address_components.length; i++){ for (var j=0; j < results[0].address_components[i].types.length; j++){ if(results[0].address_components[i].types[j]=="postal_code"){ wpgmp_zip_code=results[0].address_components[i].long_name; $(".google_postal_code").val(wpgmp_zip_code); }} }} }}); $(".google_latitude").val(position.lat()); $(".google_longitude").val(position.lng()); }); }, google_auto_suggest: function(obj){ var map_obj=this; obj.each(function(){ var current_input=this; var autocomplete=new google.maps.places.Autocomplete(this); autocomplete.bindTo('bounds', map_obj.map); if($(this).attr("name")=='location_address'){ var infowindow=map_obj.infowindow_marker; var marker=new google.maps.Marker({ map: map_obj.map, draggable: true, anchorPoint: new google.maps.Point(0, -29) }); map_obj.marker_bind(marker); google.maps.event.addListener(autocomplete, 'place_changed', function(){ var place=autocomplete.getPlace(); if(!place.geometry){ return; } if(place.geometry.viewport){ map_obj.map.fitBounds(place.geometry.viewport); }else{ map_obj.map.setCenter(place.geometry.location); map_obj.map.setZoom(17); } $(".google_latitude").val(place.geometry.location.lat()); $(".google_longitude").val(place.geometry.location.lng()); $(".google_city").val(map_obj.wpgmp_finddata(place, 'administrative_area_level_3')||map_obj.wpgmp_finddata(place, 'locality')); $(".google_state").val(map_obj.wpgmp_finddata(place, "administrative_area_level_1")); $(".google_country").val(map_obj.wpgmp_finddata(place, "country")); if(place.address_components){ for (var i=0; i < place.address_components.length; i++){ for (var j=0; j < place.address_components[i].types.length; j++){ if(place.address_components[i].types[j]=="postal_code"){ wpgmp_zip_code=place.address_components[i].long_name; $(".google_postal_code").val(wpgmp_zip_code); }} }} marker.setPosition(place.geometry.location); marker.setVisible(true); }); }else{ google.maps.event.addListener(autocomplete, 'place_changed', function(){ var place=autocomplete.getPlace(); if(!place.geometry){ return; } $().val(place.geometry.location.lat()); $(current_input).data('longitude', place.geometry.location.lng()); $(current_input).data('latitude', place.geometry.location.lat()); }); }}); }, wpgmp_finddata: function(result, type){ var component_name=""; for (var i=0; i < result.address_components.length; ++i){ var component=result.address_components[i]; $.each(component.types, function(index, value){ if(value==type){ component_name=component.long_name; }}); } return component_name; }, open_infowindow: function(current_place){ var map_obj=this; $.each(this.map_data.places, function(key, place){ if(parseInt(place.id)==parseInt(current_place)&&place.marker.visible===true){ map_obj.openInfoWindow(place); }}); }, place_info: function(place_id){ var place_obj; $.each(this.places, function(index, place){ if(parseInt(place.id)==parseInt(place_id)){ place_obj=place; }}); return place_obj; }, event_listener: function(obj, type, func){ google.maps.event.addListener(obj, type, func); }, set_visual_refresh: function(){ google.maps.visualRefresh=true; }, set_45_imagery: function(){ this.map.setTilt(45); }, set_bicyle_layer: function(){ var bikeLayer=new google.maps.BicyclingLayer(); bikeLayer.setMap(this.map); }, set_traffic_layer: function(){ var traffic_layer=new google.maps.TrafficLayer(); traffic_layer.setMap(this.map); }, set_panoramic_layer: function(){ var panoramic_layer=new google.maps.panoramio.PanoramioLayer(); panoramic_layer.setMap(this.map); }, set_transit_layer: function(){ var transit_layer=new google.maps.TransitLayer(); transit_layer.setMap(this.map); }, set_streetview: function(latlng){ var panoOptions={ position: latlng, addressControlOptions: { position: google.maps.ControlPosition.BOTTOM_CENTER }, linksControl: this.map_data.street_view.links_control, panControl: this.map_data.street_view.street_view_pan_control, zoomControlOptions: { style: google.maps.ZoomControlStyle.SMALL }, enableCloseButton: this.map_data.street_view.street_view_close_button }; if(this.map_data.street_view.pov_heading&&this.map_data.street_view.pov_pitch){ panoOptions['pov']={ heading: parseInt(this.map_data.street_view.pov_heading), pitch: parseInt(this.map_data.street_view.pov_pitch) };} var panorama=new google.maps.StreetViewPanorama(this.element, panoOptions); }, sortByPlace: function(order_by, data_type){ return function(a, b){ if(b[order_by]&&a[order_by]){ if(a[order_by]&&b[order_by]){ var a_val=a[order_by].toLowerCase(); var b_val=b[order_by].toLowerCase(); if(data_type=='num'){ a_val=parseInt(a_val); b_val=parseInt(b_val); } return ((a_val < b_val) ? -1:((a_val > b_val) ? 1:0)); }} }}, sort_object_by_keyvalue: function(options, by, type, in_order){ var sortable=[]; for (var key in options){ sortable.push(options[key]); } sortable.sort(this.sortByPlace(by, type)); if(in_order=='desc'){ sortable.reverse(); } return sortable; }, create_filters: function(){ var map_obj=this; var options=''; var filters={}; var places=this.map_data.places; var wpgmp_listing_filter=this.map_data.listing; $.each(places, function(index, place){ if(typeof place.categories=='undefined'){ place.categories={};} $.each(place.categories, function(cat_index, category){ if(typeof filters[category.type]=='undefined'){ filters[category.type]={};} if(category.name){ if(category.extension_fields&&category.extension_fields.cat_order){ filters[category.type][category.name]={ 'id': category.id, 'order': category.extension_fields.cat_order, 'name': category.name };}else{ filters[category.type][category.name]={ 'id': category.id, 'order': 0, 'name': category.name };}} }); }); var content='', by='name', type='', inorder='asc'; if(map_obj.map_data.listing){ if(map_obj.map_data.listing.default_sorting){ if(map_obj.map_data.listing.default_sorting.orderby=='listorder'){ by='order'; type='num'; inorder=map_obj.map_data.listing.default_sorting.inorder; } inorder=map_obj.map_data.listing.default_sorting.inorder; }} $.each(filters, function(index, options){ if(wpgmp_listing_filter.display_category_filter===true&&index=="category"){ content +=''; }}); return content; }, update_filters: function(){ var map_obj=this; var filters={}; var all_dropdowns=$(map_obj.container).find('[data-filter="dropdown"]'); var all_checkboxes=$(map_obj.container).find('[data-filter="checklist"]:checked'); var all_list=$(map_obj.container).find('[data-filter="list"].fc_selected'); $.each(all_dropdowns, function(index, element){ if($(this).val()!=''){ if(typeof filters[$(this).data('name')]=='undefined'){ filters[$(this).data('name')]=[]; } filters[$(this).data('name')].push($(this).val()); }}); $.each(all_checkboxes, function(index, element){ if(typeof filters[$(this).data('name')]=='undefined'){ filters[$(this).data('name')]=[]; } filters[$(this).data('name')].push($(this).val()); }); $.each(all_list, function(index, element){ if(typeof filters[$(this).data('name')]=='undefined'){ filters[$(this).data('name')]=[]; } filters[$(this).data('name')].push($(this).data('value').toString()); }); this.apply_filters(filters); }, apply_filters: function(filters){ var map_obj=this; var showAll=true; var show=true; map_obj.show_places=[]; var enable_search_term=false; if($(map_obj.container).find('[data-input="wpgmp-search-text"]').length > 0){ var search_term=$(map_obj.container).find('[data-input="wpgmp-search-text"]').val(); search_term=search_term.toLowerCase(); if(search_term.length > 0){ enable_search_term=true; }} if(((map_obj.map_data.map_tabs&&map_obj.map_data.map_tabs.category_tab&&map_obj.map_data.map_tabs.category_tab.cat_tab===true)||$(map_obj.container).find('input[data-marker-category]').length > 0)){ var all_selected_category_sel=$(map_obj.container).find('input[data-marker-category]:checked'); var all_selected_category=[]; var all_not_selected_location=[]; if(all_selected_category_sel.length > 0){ $.each(all_selected_category_sel, function(index, selected_category){ all_selected_category.push($(selected_category).data("marker-category")); var all_not_selected_location_sel=$(selected_category).closest('[data-container="wpgmp-category-tab-item"]').find('input[data-marker-location]:not(:checked)'); if(all_not_selected_location_sel.length > 0){ $.each(all_not_selected_location_sel, function(index, not_selected_location){ all_not_selected_location.push($(not_selected_location).data("marker-location")); }); }}); } var all_selected_location_sel=$(map_obj.container).find('[data-container="wpgmp-category-tab-item"]').find('input[data-marker-location]:checked'); var all_selected_location=[]; if(all_selected_location_sel.length > 0){ $.each(all_selected_location_sel, function(index, selected_location){ all_selected_location.push($(selected_location).data("marker-location")); }); }} if(typeof map_obj.map_data.places!='undefined'){ $.each(map_obj.map_data.places, function(place_key, place){ show=true; if(typeof filters!='undefined'){ $.each(filters, function(filter_key, filter_values){ var in_fields=false; if($.isArray(filter_values)){ if(typeof place.categories!='undefined'&&filter_key=="category"){ $.each(place.categories, function(cat_index, category){ if($.inArray(category.id, filter_values) > -1){ in_fields=true; }}); } if(typeof place[filter_key]!='undefined'){ if($.inArray(place[filter_key], filter_values) > -1){ in_fields=true; }}else if(typeof place.location[filter_key]!='undefined'){ if($.inArray(place.location[filter_key], filter_values) > -1){ in_fields=true; }}else if(place.location.extra_fields&&typeof place.location.extra_fields[filter_key]!='undefined'){ var dropdown_value=filter_values[0]; if(place.location.extra_fields[filter_key]&&place.location.extra_fields[filter_key].indexOf(dropdown_value) > -1){ in_fields=true; }else if($.inArray(place.location.extra_fields[filter_key], filter_values) > -1){ in_fields=true; }} if(in_fields==false) show=false; }else{ filter_values.val=""; }}); } if(enable_search_term===true&&show===true){ if(place.title!=undefined&&place.title.toLowerCase().indexOf(search_term) >=0){ show=true; }else if(place.content!=undefined&&place.content.toLowerCase().indexOf(search_term) >=0){ show=true; }else if(place.location.lat.toLowerCase().indexOf(search_term) >=0){ show=true; }else if(place.location.lng.toLowerCase().indexOf(search_term) >=0){ show=true; }else if(place.address&&place.address.toLowerCase().indexOf(search_term) >=0){ show=true; }else if(place.location.state&&place.location.state.toLowerCase().indexOf(search_term) >=0){ show=true; }else if(place.location.country&&place.location.country.toLowerCase().indexOf(search_term) >=0){ show=true; }else if(place.location.postal_code&&place.location.postal_code.toLowerCase().indexOf(search_term) >=0){ show=true; }else if(place.location.city&&place.location.city.toLowerCase().indexOf(search_term) >=0){ show=true; }else if(typeof map_obj.search_area!='undefined'&&map_obj.search_area!=''&&map_obj.wpgmp_within_radius(place, map_obj.search_area)===true){ show=true; }else{ show=false; } if(typeof place.location.extra_fields!='undefined'){ $.each(place.location.extra_fields, function(field, value){ if(value){ value=value.toString(); if(value&&value.toLowerCase().indexOf(search_term) >=0) show=true; }}); }} if((place.categories.length==undefined||place.categories.length=='undefined')&&all_selected_category&&(all_selected_category.length > 0)&&($(map_obj.container).find('input[name="wpgmp_select_all"]').is(":checked")==false)&&show){ show=false; } if(all_selected_category&&show!=false&&place.categories.length!=undefined){ var in_checked_category=false; if(all_selected_category.length===0){ if(typeof place.categories!='undefined'){ $.each(place.categories, function(cat_index, category){ if(category.id==='') in_checked_category=true; }); }}else{ if(typeof place.categories!='undefined'){ $.each(place.categories, function(cat_index, category){ if(category.id==='') in_checked_category=true; else if($.inArray(parseInt(category.id), all_selected_category) > -1){ in_checked_category=true; place.marker.setIcon(category.icon); }}); }} if(all_not_selected_location.length!==0){ if($.inArray(parseInt(place.id), all_not_selected_location) > -1){ in_checked_category=false; }} if(in_checked_category===false) show=false; else show=true; if(all_selected_location.length!==0){ if($.inArray(parseInt(place.id), all_selected_location) > -1){ show=true; }} } place.marker.visible=show; place.marker.setVisible(show); if(show==false){ place.infowindow.close(); } place.marker.setAnimation(null); if(show===true) map_obj.show_places.push(place); }); } if(typeof map_obj.map_data.map_options.bound_map_after_filter!==typeof undefined && map_obj.map_data.map_options.bound_map_after_filter===true){ var after_filter_bounds=new google.maps.LatLngBounds(); for (var j=0; j < map_obj.show_places.length; j++){ var markerInResult=new google.maps.LatLng(map_obj.show_places[j]['location']['lat'], map_obj.show_places[j]['location']['lng']); after_filter_bounds.extend(markerInResult); } map_obj.map.fitBounds(after_filter_bounds); } if(map_obj.map_data.listing){ if($(map_obj.container).find('[data-filter="map-sorting"]').val()){ var order_data=$(map_obj.container).find('[data-filter="map-sorting"]').val().split("__"); var data_type=''; if(order_data[0]!==''&&order_data[1]!==''){ if(typeof order_data[2]!='undefined'){ data_type=order_data[2]; } map_obj.sorting(order_data[0], order_data[1], data_type); }}else{ if(map_obj.map_data.listing.default_sorting){ var data_type=''; if(map_obj.map_data.listing.default_sorting.orderby=='listorder'){ data_type='num'; } map_obj.sorting(map_obj.map_data.listing.default_sorting.orderby, map_obj.map_data.listing.default_sorting.inorder, data_type); }} } if(map_obj.map_data.marker_cluster){ map_obj.set_marker_cluster(); }}, display_filters_listing: function(){ if(this.map_data.listing){ var filter_content='
' + this.display_filters() + '
'; $(this.container).find(".wpgmp_map_parent").after(filter_content); }}, display_filters: function(){ var hide_locations=this.map_data.listing.hide_locations; var content=''; content +='
' + this.map_data.listing.listing_header + '
'; content +='
' + this.create_filters() + '
'; content +='
'; return content; }, map_loaded: function(){ var map_obj=this; var gmap=map_obj.map; google.maps.event.addListenerOnce(gmap, 'idle', function(){ var center=gmap.getCenter(); google.maps.event.trigger(gmap, 'resize'); gmap.setCenter(center); }); if(map_obj.settings.center_by_nearest===true){ map_obj.center_by_nearest(); } if(map_obj.settings.close_infowindow_on_map_click===true){ google.maps.event.addListener(gmap, "click", function(event){ $.each(map_obj.places, function(key, place){ place.infowindow.close(); place.marker.setAnimation(null); }); }); } if(map_obj.settings.map_infowindow_customisations===true){ google.maps.event.addListener(map_obj.infowindow_marker, 'domready', function(){ var wpgmp_iwOuter=$(map_obj.container).find('.gm-style-iw'); wpgmp_iwOuter.parent().css({ 'width': '0px', 'height': '0px' }); var wpgmp_iwCloseBtn=wpgmp_iwOuter.next(); wpgmp_iwCloseBtn.css('display', 'none'); var wpgmp_iwBackground=wpgmp_iwOuter.prev(); wpgmp_iwBackground.children(':nth-child(2)').css({ 'display': 'none' }); wpgmp_iwBackground.children(':nth-child(3)').css({ 'background-color': '#000;', }); wpgmp_iwBackground.children(':nth-child(4)').css({ 'display': 'none' }); var height=wpgmp_iwOuter.outerHeight() ; wpgmp_iwBackground.children(':nth-child(3)').css({ 'top':(height+18)+'px' }); wpgmp_iwBackground.children(':nth-child(1)').css({ 'top':(height+10)+'px' }); wpgmp_iwBackground.children(':nth-child(3)').find('div').children().css({ 'box-shadow': map_obj.settings.infowindow_border_color + ' 0px 1px 6px', 'border': '1px solid ' + map_obj.settings.infowindow_border_color, 'border-top': '', 'z-index': '1', 'background-color': map_obj.settings.infowindow_bg_color }); wpgmp_iwOuter.find('.wpgmp_infowindow').prepend('
'); wpgmp_iwOuter.on('click', '.infowindow-close', function(event){ $.each(map_obj.places, function(key, place){ place.infowindow.close(); place.marker.setAnimation(null); }); }); }); }}, resize_map: function(){ var map_obj=this; var gmap=map_obj.map; var zoom=gmap.getZoom(); var center=gmap.getCenter(); google.maps.event.trigger(this.map, 'resize'); gmap.setZoom(zoom); gmap.setCenter(center); }, responsive_map: function(){ var map_obj=this; var gmap=map_obj.map; google.maps.event.addDomListener(window, "resize", function(){ var zoom=gmap.getZoom(); var center=gmap.getCenter(); google.maps.event.trigger(gmap, "resize"); gmap.setZoom(zoom); gmap.setCenter(center); gmap.getBounds(); }); }, show_search_control: function(){ var map_obj=this; var input=$(map_obj.container).find('[data-input="map-search-control"]')[0]; if(input!==undefined){ var searchBox=new google.maps.places.Autocomplete(input); if(wpgmp_local.wpgmp_country_specific&&wpgmp_local.wpgmp_country_specific==true){ searchBox.setComponentRestrictions({ 'country': wpgmp_local.wpgmp_countries }); } map_obj.map.controls[eval("google.maps.ControlPosition." + map_obj.settings.search_control_position)].push(input); searchBox.bindTo('bounds', map_obj.map); google.maps.event.addListener(searchBox, 'place_changed', function(){ var place=searchBox.getPlace(); map_obj.map.setCenter(place.geometry.location); map_obj.map.setZoom(parseInt(map_obj.map_data.map_options.map_zoom_after_search)); }); }}, fit_bounds: function(){ var map_obj=this; var places=map_obj.map_data.places; var bounds=new google.maps.LatLngBounds(); if(places!==undefined){ places.forEach(function(place){ if(place.location.lat&&place.location.lng){ bounds.extend(new google.maps.LatLng(parseFloat(place.location.lat), parseFloat(place.location.lng) )); }}); } map_obj.map.fitBounds(bounds); }, create_markers: function(){ var map_obj=this; var places=map_obj.map_data.places; var temp_listing_placeholder; var replaceData; var remove_keys=[]; $.each(places, function(key, place){ if(place.location.lat&&place.location.lng){ if(typeof place.categories=='undefined'){ place.categories={};} place.marker=new google.maps.Marker({ position: new google.maps.LatLng(parseFloat(place.location.lat), parseFloat(place.location.lng) ), icon: place.location.icon, url: place.url, draggable: place.location.draggable, map: map_obj.map, clickable: place.location.infowindow_disable, }); if(map_obj.settings.infowindow_drop_animation===true){ place.marker.setAnimation(google.maps.Animation.DROP); } if(map_obj.settings.infowindow_filter_only===true){ place.marker.visible=false; place.marker.setVisible(false); } if(map_obj.map_data.page=='edit_location') map_obj.marker_bind(place.marker); var location_categories=[]; if(typeof place.categories!='undefined'){ for (var cat in place.categories){ location_categories.push(place.categories[cat].name); }} var content=''; var marker_image=''; if(place.source=='post'){ marker_image=place.location.extra_fields.post_featured_image; }else{ marker_image=place.location.marker_image; } var temp_listing_placeholder=''; if(place.source=='post'){ temp_listing_placeholder=map_obj.settings.infowindow_geotags_setting; }else{ temp_listing_placeholder=map_obj.settings.infowindow_setting; } if(typeof temp_listing_placeholder=='undefined'){ temp_listing_placeholder=place.content; } replaceData={ "{marker_id}": place.id, "{marker_title}": place.title, "{marker_address}": place.address, "{marker_latitude}": place.location.lat, "{marker_longitude}": place.location.lng, "{marker_city}": place.location.city, "{marker_state}": place.location.state, "{marker_country}": place.location.country, "{marker_postal_code}": place.location.postal_code, "{marker_zoom}": place.location.zoom, "{marker_icon}": place.location.icon, "{marker_category}": location_categories.join(','), "{marker_message}": place.content, "{marker_image}": marker_image }; if(typeof place.location.extra_fields!='undefined'){ for (var extra in place.location.extra_fields){ if(!place.location.extra_fields[extra]){ replaceData['{' + extra + '}']=''; }else{ replaceData['{' + extra + '}']=place.location.extra_fields[extra]; }} } temp_listing_placeholder=temp_listing_placeholder.replace(/{[^{}]+}/g, function(match){ if(match in replaceData){ return (replaceData[match]); }else{ return (""); }}); content=temp_listing_placeholder; if(content===""){ if(map_obj.settings.map_infowindow_customisations===true&&map_obj.settings.show_infowindow_header===true) content='
' + place.title + '
' + place.content + '
'; else content='
' + place.content + '
'; }else{ if(map_obj.settings.map_infowindow_customisations===true&&map_obj.settings.show_infowindow_header===true) content='
' + place.title + '
' + content + '
'; else content='
' + content + '
'; } place.infowindow_data=content; place.infowindow=map_obj.infowindow_marker; if(place.location.infowindow_default_open===true){ map_obj.openInfoWindow(place); }else if(map_obj.settings.default_infowindow_open===true){ map_obj.openInfoWindow(place); } var on_event=map_obj.settings.infowindow_open_event; var bounce_on_event=map_obj.settings.infowindow_bounce_animation; map_obj.event_listener(place.marker, on_event, function(){ $.each(map_obj.places, function(key, prev_place){ prev_place.infowindow.close(); prev_place.marker.setAnimation(null); }); map_obj.openInfoWindow(place); if(bounce_on_event=='click'){ map_obj.toggle_bounce(place.marker); }}); if(bounce_on_event=='mouseover'&&on_event!='mouseover'){ map_obj.event_listener(place.marker, 'mouseover', function(){ place.marker.setAnimation(google.maps.Animation.BOUNCE); }); map_obj.event_listener(place.marker, 'mouseout', function(){ place.marker.setAnimation(null); }); } if(bounce_on_event!=''){ google.maps.event.addListener(place.infowindow, 'closeclick', function(){ place.marker.setAnimation(null); }); } map_obj.places.push(place); }else{ remove_keys.push(key); }}); $.each(remove_keys, function(index, value){ places.splice(value, 1); }); }, toggle_bounce: function(marker){ if(marker.getAnimation()!==null){ marker.setAnimation(null); }else{ marker.setAnimation(google.maps.Animation.BOUNCE); }}, display_markers: function(){ var map_obj=this; map_obj.show_places=[]; map_obj.categories=[]; var categories={}; for (var i=0; i < map_obj.places.length; i++){ map_obj.places[i].marker.setMap(map_obj.map); if(map_obj.places[i].marker.visible===true){ map_obj.show_places.push(this.places[i]); } if(typeof map_obj.places[i].categories!='undefined'){ $.each(map_obj.places[i].categories, function(index, category){ if(typeof categories[category.name]=='undefined'){ categories[category.name]=category; }}); }} this.categories=categories; }, get_current_location: function(success_func, error_func){ var map=this; if(typeof map.user_location=='undefined'){ navigator.geolocation.getCurrentPosition(function(position){ map.user_location=new google.maps.LatLng(position.coords.latitude, position.coords.longitude); if(success_func) success_func(map.user_location); }, function(ErrorPosition){ if(error_func) error_func(ErrorPosition); }, { enableHighAccuracy: true, timeout: 5000, maximumAge: 0 }); }else{ if(success_func) success_func(map.user_location); }}, openInfoWindow: function(place){ var map_obj=this; place.infowindow=map_obj.infowindow_marker; place.infowindow.setContent(place.infowindow_data); if(place.location.onclick_action=="custom_link"){ if(place.location.open_new_tab=='yes') window.open(place.location.redirect_custom_link, '_blank'); else window.open(place.location.redirect_custom_link, '_self'); }else{ place.infowindow.open(this.map, place.marker); if(typeof map_obj.settings.infowindow_click_change_center!='undefined'&&map_obj.settings.infowindow_click_change_center==true){ map_obj.map.setCenter(place.marker.getPosition()); } if(typeof map_obj.settings.infowindow_click_change_zoom!='undefined'&&map_obj.settings.infowindow_click_change_zoom > 0){ map_obj.map.setZoom(map_obj.settings.infowindow_click_change_zoom); } if(this.map_data.map_tabs&&this.map_data.map_tabs.direction_tab&&this.map_data.map_tabs.direction_tab.dir_tab===true){ $(this.container).find('.start_point').val(place.address); }} }, }; $.fn.maps=function(options, places){ this.each(function(){ if(!$.data(this, "wpgmp_maps")){ $.data(this, "wpgmp_maps", new GoogleMaps(this, options, places)); }}); return this; };}(jQuery, window, document)); !function(t){"function"==typeof define&&define.amd?define(["jquery"],t):t(jQuery)}(function(s){var u,l,f,d,t,p,h,g,i,e,b,a,o,c,m,y,n,r,v,x,C="ui-effects-",w=s;function _(t,e,n){var r=g[e.type]||{};return null==t?n||!e.def?null:e.def:(t=r.floor?~~t:parseFloat(t),isNaN(t)?e.def:r.mod?(t+r.mod)%r.mod:t<0?0:r.max")[0],b=u.each,e.style.cssText="background-color:rgba(1,1,1,.5)",i.rgba=-1a.mod/2?r+=a.mod:r-o>a.mod/2&&(r-=a.mod)),f[n]=_((o-r)*i+r,e)))}),this[e](f)},blend:function(t){if(1===this._rgba[3])return this;var e=this._rgba.slice(),n=e.pop(),r=p(t)._rgba;return p(u.map(e,function(t,e){return(1-n)*r[e]+n*t}))},toRgbaString:function(){var t="rgba(",e=u.map(this._rgba,function(t,e){return null==t?2").addClass("ui-effects-wrapper").css({fontSize:"100%",background:"transparent",border:"none",margin:0,padding:0}),e={width:n.width(),height:n.height()},o=document.activeElement;try{o.id}catch(t){o=document.body}return n.wrap(t),n[0]!==o&&!s.contains(n[0],o)||s(o).focus(),t=n.parent(),"static"===n.css("position")?(t.css({position:"relative"}),n.css({position:"relative"})):(s.extend(r,{position:n.css("position"),zIndex:n.css("z-index")}),s.each(["top","left","bottom","right"],function(t,e){r[e]=n.css(e),isNaN(parseInt(r[e],10))&&(r[e]="auto")}),n.css({position:"relative",top:0,left:0,right:"auto",bottom:"auto"})),n.css(e),t.css(r).show()},removeWrapper:function(t){var e=document.activeElement;return t.parent().is(".ui-effects-wrapper")&&(t.parent().replaceWith(t),t[0]!==e&&!s.contains(t[0],e)||s(e).focus()),t},setTransition:function(r,t,o,a){return a=a||{},s.each(t,function(t,e){var n=r.cssUnit(e);0n;n++)t[e[n]]=t.mm(e[n])}}),i.mm=function(e){return"mm-"+e},i.add("wrapper menu panels panel nopanel current highest opened subopened navbar hasnavbar title btn prev next listview nolistview inset vertical selected divider spacer hidden fullsubopen"),i.umm=function(e){return"mm-"==e.slice(0,3)&&(e=e.slice(3)),e},a.mm=function(e){return"mm-"+e},a.add("parent sub"),o.mm=function(e){return e+".mm"},o.add("transitionend webkitTransitionEnd click scroll keydown mousedown mouseup touchstart touchmove touchend orientationchange"),e[n]._c=i,e[n]._d=a,e[n]._e=o,e[n].glbl=r)}var n="mmenu",s="5.6.1";if(!(e[n]&&e[n].version>s)){e[n]=function(e,t,n){this.$menu=e,this._api=["bind","init","update","setSelected","getInstance","openPanel","closePanel","closeAllPanels"],this.opts=t,this.conf=n,this.vars={},this.cbck={},"function"==typeof this.___deprecated&&this.___deprecated(),this._initMenu(),this._initAnchors();var s=this.$pnls.children();return this._initAddons(),this.init(s),"function"==typeof this.___debug&&this.___debug(),this},e[n].version=s,e[n].addons={},e[n].uniqueId=0,e[n].defaults={extensions:[],navbar:{add:!0,title:"Menu",titleLink:"panel"},onClick:{setSelected:!0},slidingSubmenus:!0},e[n].configuration={classNames:{divider:"Divider",inset:"Inset",panel:"Panel",selected:"Selected",spacer:"Spacer",vertical:"Vertical"},clone:!1,openingInterval:25,panelNodetype:"ul, ol, div",transitionDuration:400},e[n].prototype={init:function(e){e=e.not("."+i.nopanel),e=this._initPanels(e),this.trigger("init",e),this.trigger("update")},update:function(){this.trigger("update")},setSelected:function(e){this.$menu.find("."+i.listview).children().removeClass(i.selected),e.addClass(i.selected),this.trigger("setSelected",e)},openPanel:function(t){var s=t.parent(),a=this;if(s.hasClass(i.vertical)){var o=s.parents("."+i.subopened);if(o.length)return void this.openPanel(o.first());s.addClass(i.opened),this.trigger("openPanel",t),this.trigger("openingPanel",t),this.trigger("openedPanel",t)}else{if(t.hasClass(i.current))return;var r=this.$pnls.children("."+i.panel),l=r.filter("."+i.current);r.removeClass(i.highest).removeClass(i.current).not(t).not(l).not("."+i.vertical).addClass(i.hidden),e[n].support.csstransitions||l.addClass(i.hidden),t.hasClass(i.opened)?t.nextAll("."+i.opened).addClass(i.highest).removeClass(i.opened).removeClass(i.subopened):(t.addClass(i.highest),l.addClass(i.subopened)),t.removeClass(i.hidden).addClass(i.current),a.trigger("openPanel",t),setTimeout(function(){t.removeClass(i.subopened).addClass(i.opened),a.trigger("openingPanel",t),a.__transitionend(t,function(){a.trigger("openedPanel",t)},a.conf.transitionDuration)},this.conf.openingInterval)}},closePanel:function(e){var t=e.parent();t.hasClass(i.vertical)&&(t.removeClass(i.opened),this.trigger("closePanel",e),this.trigger("closingPanel",e),this.trigger("closedPanel",e))},closeAllPanels:function(){this.$menu.find("."+i.listview).children().removeClass(i.selected).filter("."+i.vertical).removeClass(i.opened);var e=this.$pnls.children("."+i.panel),t=e.first();this.$pnls.children("."+i.panel).not(t).removeClass(i.subopened).removeClass(i.opened).removeClass(i.current).removeClass(i.highest).addClass(i.hidden),this.openPanel(t)},togglePanel:function(e){var t=e.parent();t.hasClass(i.vertical)&&this[t.hasClass(i.opened)?"closePanel":"openPanel"](e)},getInstance:function(){return this},bind:function(e,t){this.cbck[e]=this.cbck[e]||[],this.cbck[e].push(t)},trigger:function(){var e=this,t=Array.prototype.slice.call(arguments),n=t.shift();if(this.cbck[n])for(var s=0,i=this.cbck[n].length;i>s;s++)this.cbck[n][s].apply(e,t)},_initMenu:function(){this.$menu.attr("id",this.$menu.attr("id")||this.__getUniqueId()),this.conf.clone&&(this.$menu=this.$menu.clone(!0),this.$menu.add(this.$menu.find("[id]")).filter("[id]").each(function(){e(this).attr("id",i.mm(e(this).attr("id")))})),this.$menu.contents().each(function(){3==e(this)[0].nodeType&&e(this).remove()}),this.$pnls=e('
').append(this.$menu.children(this.conf.panelNodetype)).prependTo(this.$menu),this.$menu.parent().addClass(i.wrapper);var t=[i.menu];this.opts.slidingSubmenus||t.push(i.vertical),this.opts.extensions=this.opts.extensions.length?"mm-"+this.opts.extensions.join(" mm-"):"",this.opts.extensions&&t.push(this.opts.extensions),this.$menu.addClass(t.join(" "))},_initPanels:function(t){var n=this,s=this.__findAddBack(t,"ul, ol");this.__refactorClass(s,this.conf.classNames.inset,"inset").addClass(i.nolistview+" "+i.nopanel),s.not("."+i.nolistview).addClass(i.listview);var o=this.__findAddBack(t,"."+i.listview).children();this.__refactorClass(o,this.conf.classNames.selected,"selected"),this.__refactorClass(o,this.conf.classNames.divider,"divider"),this.__refactorClass(o,this.conf.classNames.spacer,"spacer"),this.__refactorClass(this.__findAddBack(t,"."+this.conf.classNames.panel),this.conf.classNames.panel,"panel");var r=e(),l=t.add(t.find("."+i.panel)).add(this.__findAddBack(t,"."+i.listview).children().children(this.conf.panelNodetype)).not("."+i.nopanel);this.__refactorClass(l,this.conf.classNames.vertical,"vertical"),this.opts.slidingSubmenus||l.addClass(i.vertical),l.each(function(){var t=e(this),s=t;t.is("ul, ol")?(t.wrap('
'),s=t.parent()):s.addClass(i.panel);var a=t.attr("id");t.removeAttr("id"),s.attr("id",a||n.__getUniqueId()),t.hasClass(i.vertical)&&(t.removeClass(n.conf.classNames.vertical),s.add(s.parent()).addClass(i.vertical)),r=r.add(s)});var d=e("."+i.panel,this.$menu);r.each(function(t){var s,o,r=e(this),l=r.parent(),d=l.children("a, span").first();if(l.is("."+i.panels)||(l.data(a.sub,r),r.data(a.parent,l)),l.children("."+i.next).length||l.parent().is("."+i.listview)&&(s=r.attr("id"),o=e('').insertBefore(d),d.is("span")&&o.addClass(i.fullsubopen)),!r.children("."+i.navbar).length&&!l.hasClass(i.vertical)){l.parent().is("."+i.listview)?l=l.closest("."+i.panel):(d=l.closest("."+i.panel).find('a[href="#'+r.attr("id")+'"]').first(),l=d.closest("."+i.panel));var c=e('
');if(l.length){switch(s=l.attr("id"),n.opts.navbar.titleLink){case"anchor":_url=d.attr("href");break;case"panel":case"parent":_url="#"+s;break;default:_url=!1}c.append('').append(e('").text(d.text())).prependTo(r),n.opts.navbar.add&&r.addClass(i.hasnavbar)}else n.opts.navbar.title&&(c.append(''+n.opts.navbar.title+"").prependTo(r),n.opts.navbar.add&&r.addClass(i.hasnavbar))}});var c=this.__findAddBack(t,"."+i.listview).children("."+i.selected).removeClass(i.selected).last().addClass(i.selected);c.add(c.parentsUntil("."+i.menu,"li")).filter("."+i.vertical).addClass(i.opened).end().each(function(){e(this).parentsUntil("."+i.menu,"."+i.panel).not("."+i.vertical).first().addClass(i.opened).parentsUntil("."+i.menu,"."+i.panel).not("."+i.vertical).first().addClass(i.opened).addClass(i.subopened)}),c.children("."+i.panel).not("."+i.vertical).addClass(i.opened).parentsUntil("."+i.menu,"."+i.panel).not("."+i.vertical).first().addClass(i.opened).addClass(i.subopened);var p=d.filter("."+i.opened);return p.length||(p=r.first()),p.addClass(i.opened).last().addClass(i.current),r.not("."+i.vertical).not(p.last()).addClass(i.hidden).end().filter(function(){return!e(this).parent().hasClass(i.panels)}).appendTo(this.$pnls),r},_initAnchors:function(){var t=this;r.$body.on(o.click+"-oncanvas","a[href]",function(s){var a=e(this),o=!1,r=t.$menu.find(a).length;for(var l in e[n].addons)if(e[n].addons[l].clickAnchor.call(t,a,r)){o=!0;break}var d=a.attr("href");if(!o&&r&&d.length>1&&"#"==d.slice(0,1))try{var c=e(d,t.$menu);c.is("."+i.panel)&&(o=!0,t[a.parent().hasClass(i.vertical)?"togglePanel":"openPanel"](c))}catch(p){}if(o&&s.preventDefault(),!o&&r&&a.is("."+i.listview+" > li > a")&&!a.is('[rel="external"]')&&!a.is('[target="_blank"]')){t.__valueOrFn(t.opts.onClick.setSelected,a)&&t.setSelected(e(s.target).parent());var h=t.__valueOrFn(t.opts.onClick.preventDefault,a,"#"==d.slice(0,1));h&&s.preventDefault(),t.__valueOrFn(t.opts.onClick.close,a,h)&&t.close()}})},_initAddons:function(){var t;for(t in e[n].addons)e[n].addons[t].add.call(this),e[n].addons[t].add=function(){};for(t in e[n].addons)e[n].addons[t].setup.call(this)},_getOriginalMenuId:function(){var e=this.$menu.attr("id");return e&&e.length&&this.conf.clone&&(e=i.umm(e)),e},__api:function(){var t=this,n={};return e.each(this._api,function(e){var s=this;n[s]=function(){var e=t[s].apply(t,arguments);return"undefined"==typeof e?n:e}}),n},__valueOrFn:function(e,t,n){return"function"==typeof e?e.call(t[0]):"undefined"==typeof e&&"undefined"!=typeof n?n:e},__refactorClass:function(e,t,n){return e.filter("."+t).removeClass(t).addClass(i[n])},__findAddBack:function(e,t){return e.find(t).add(e.filter(t))},__filterListItems:function(e){return e.not("."+i.divider).not("."+i.hidden)},__transitionend:function(e,t,n){var s=!1,i=function(){s||t.call(e[0]),s=!0};e.one(o.transitionend,i),e.one(o.webkitTransitionEnd,i),setTimeout(i,1.1*n)},__getUniqueId:function(){return i.mm(e[n].uniqueId++)}},e.fn[n]=function(s,i){return t(),s=e.extend(!0,{},e[n].defaults,s),i=e.extend(!0,{},e[n].configuration,i),this.each(function(){var t=e(this);if(!t.data(n)){var a=new e[n](t,s,i);a.$menu.data(n,a.__api())}})},e[n].support={touch:"ontouchstart"in window||navigator.msMaxTouchPoints||!1,csstransitions:function(){if("undefined"!=typeof Modernizr&&"undefined"!=typeof Modernizr.csstransitions)return Modernizr.csstransitions;var e=document.body||document.documentElement,t=e.style,n="transition";if("string"==typeof t[n])return!0;var s=["Moz","webkit","Webkit","Khtml","O","ms"];n=n.charAt(0).toUpperCase()+n.substr(1);for(var i=0;i1&&a.wrapPageIfNeeded&&(t=t.wrapAll("<"+this.conf[n].pageNodetype+" />").parent())),t.each(function(){e(this).attr("id",e(this).attr("id")||i.__getUniqueId())}),t.addClass(s.page+" "+s.slideout),o.$page=t,this.trigger("setPage",t)},e[t].prototype["_initWindow_"+n]=function(){o.$wndw.off(a.keydown+"-"+n).on(a.keydown+"-"+n,function(e){return o.$html.hasClass(s.opened)&&9==e.keyCode?(e.preventDefault(),!1):void 0});var e=0;o.$wndw.off(a.resize+"-"+n).on(a.resize+"-"+n,function(t,n){if(1==o.$page.length&&(n||o.$html.hasClass(s.opened))){var i=o.$wndw.height();(n||i!=e)&&(e=i,o.$page.css("minHeight",i))}})},e[t].prototype._initBlocker=function(){var t=this;this.opts[n].blockUI&&(o.$blck||(o.$blck=e('
')),o.$blck.appendTo(o.$body).off(a.touchstart+"-"+n+" "+a.touchmove+"-"+n).on(a.touchstart+"-"+n+" "+a.touchmove+"-"+n,function(e){e.preventDefault(),e.stopPropagation(),o.$blck.trigger(a.mousedown+"-"+n)}).off(a.mousedown+"-"+n).on(a.mousedown+"-"+n,function(e){e.preventDefault(),o.$html.hasClass(s.modal)||(t.closeAllOthers(),t.close())}))};var s,i,a,o}(jQuery), function(e){var t="mmenu",n="scrollBugFix";e[t].addons[n]={setup:function(){var i=this,r=this.opts[n];this.conf[n];if(o=e[t].glbl,e[t].support.touch&&this.opts.offCanvas&&this.opts.offCanvas.modal&&("boolean"==typeof r&&(r={fix:r}),"object"!=typeof r&&(r={}),r=this.opts[n]=e.extend(!0,{},e[t].defaults[n],r),r.fix)){var l=this.$menu.attr("id"),d=!1;this.bind("opening",function(){this.$pnls.children("."+s.current).scrollTop(0)}),o.$docu.on(a.touchmove,function(e){i.vars.opened&&e.preventDefault()}),o.$body.on(a.touchstart,"#"+l+"> ."+s.panels+"> ."+s.current,function(e){i.vars.opened&&(d||(d=!0,0===e.currentTarget.scrollTop?e.currentTarget.scrollTop=1:e.currentTarget.scrollHeight===e.currentTarget.scrollTop+e.currentTarget.offsetHeight&&(e.currentTarget.scrollTop-=1),d=!1))}).on(a.touchmove,"#"+l+"> ."+s.panels+"> ."+s.current,function(t){i.vars.opened&&e(this)[0].scrollHeight>e(this).innerHeight()&&t.stopPropagation()}),o.$wndw.on(a.orientationchange,function(){i.$pnls.children("."+s.current).scrollTop(0).css({"-webkit-overflow-scrolling":"auto"}).css({"-webkit-overflow-scrolling":"touch"})})}},add:function(){s=e[t]._c,i=e[t]._d,a=e[t]._e},clickAnchor:function(e,t){}},e[t].defaults[n]={fix:!0};var s,i,a,o}(jQuery); !function(e,s){"use strict";var o=function(){var o={bcClass:"sf-breadcrumb",menuClass:"sf-js-enabled",anchorClass:"sf-with-ul",menuArrowClass:"sf-arrows"},t=function(){var s=/^(?![\w\W]*Windows Phone)[\w\W]*(iPhone|iPad|iPod)/i.test(navigator.userAgent);return s&&e("html").css("cursor","pointer").on("click",e.noop),s}(),n=function(){var e=document.documentElement.style;return"behavior"in e&&"fill"in e&&/iemobile/i.test(navigator.userAgent)}(),i=function(){return!!s.PointerEvent}(),r=function(e,s){var t=o.menuClass;s.cssArrows&&(t+=" "+o.menuArrowClass),e.toggleClass(t)},a=function(s,t){return s.find("li."+t.pathClass).slice(0,t.pathLevels).addClass(t.hoverClass+" "+o.bcClass).filter(function(){return e(this).children(t.popUpSelector).hide().show().length}).removeClass(t.pathClass)},l=function(e){e.children("a").toggleClass(o.anchorClass)},h=function(e){var s=e.css("ms-touch-action"),o=e.css("touch-action");o=o||s,o="pan-y"===o?"auto":"pan-y",e.css({"ms-touch-action":o,"touch-action":o})},u=function(s,o){var r="li:has("+o.popUpSelector+")";e.fn.hoverIntent&&!o.disableHI?s.hoverIntent(c,f,r):s.on("mouseenter.superfish",r,c).on("mouseleave.superfish",r,f);var a="MSPointerDown.superfish";i&&(a="pointerdown.superfish"),t||(a+=" touchend.superfish"),n&&(a+=" mousedown.superfish"),s.on("focusin.superfish","li",c).on("focusout.superfish","li",f).on(a,"a",o,p)},p=function(s){var o=e(this),t=m(o),n=o.siblings(s.data.popUpSelector);return t.onHandleTouch.call(n)===!1?this:void(n.length>0&&n.is(":hidden")&&(o.one("click.superfish",!1),"MSPointerDown"===s.type||"pointerdown"===s.type?o.trigger("focus"):e.proxy(c,o.parent("li"))()))},c=function(){var s=e(this),o=m(s);clearTimeout(o.sfTimer),s.siblings().superfish("hide").end().superfish("show")},f=function(){var s=e(this),o=m(s);t?e.proxy(d,s,o)():(clearTimeout(o.sfTimer),o.sfTimer=setTimeout(e.proxy(d,s,o),o.delay))},d=function(s){s.retainPath=e.inArray(this[0],s.$path)>-1,this.superfish("hide"),this.parents("."+s.hoverClass).length||(s.onIdle.call(v(this)),s.$path.length&&e.proxy(c,s.$path)())},v=function(e){return e.closest("."+o.menuClass)},m=function(e){return v(e).data("sf-options")};return{hide:function(s){if(this.length){var o=this,t=m(o);if(!t)return this;var n=t.retainPath===!0?t.$path:"",i=o.find("li."+t.hoverClass).add(this).not(n).removeClass(t.hoverClass).children(t.popUpSelector),r=t.speedOut;if(s&&(i.show(),r=0),t.retainPath=!1,t.onBeforeHide.call(i)===!1)return this;i.stop(!0,!0).animate(t.animationOut,r,"easeOutQuad",function(){var s=e(this);t.onHide.call(s)})}return this},show:function(){var e=m(this);if(!e)return this;var s=this.addClass(e.hoverClass),o=s.children(e.popUpSelector);return e.onBeforeShow.call(o)===!1?this:(o.stop(!0,!0).animate(e.animation,e.speed,"easeOutQuad",function(){e.onShow.call(o)}),this)},destroy:function(){return this.each(function(){var s,t=e(this),n=t.data("sf-options");return n?(s=t.find(n.popUpSelector).parent("li"),clearTimeout(n.sfTimer),r(t,n),l(s),h(t),t.off(".superfish").off(".hoverIntent"),s.children(n.popUpSelector).attr("style",function(e,s){return s.replace(/display[^;]+;?/g,"")}),n.$path.removeClass(n.hoverClass+" "+o.bcClass).addClass(n.pathClass),t.find("."+n.hoverClass).removeClass(n.hoverClass),n.onDestroy.call(t),void t.removeData("sf-options")):!1})},init:function(s){return this.each(function(){var t=e(this);if(t.data("sf-options"))return!1;var n=e.extend({},e.fn.superfish.defaults,s),i=t.find(n.popUpSelector).parent("li");n.$path=a(t,n),t.data("sf-options",n),r(t,n),l(i),h(t),u(t,n),i.not("."+o.bcClass).superfish("hide",!0),n.onInit.call(this)})}}}();e.fn.superfish=function(s,t){return o[s]?o[s].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof s&&s?e.error("Method "+s+" does not exist on jQuery.fn.superfish"):o.init.apply(this,arguments)},e.fn.superfish.defaults={popUpSelector:"ul,.sf-mega",hoverClass:"sfHover",pathClass:"overrideThisToUse",pathLevels:1,delay:800,animation:{opacity:"show"},animationOut:{opacity:"hide"},speed:"normal",speedOut:"fast",cssArrows:!0,disableHI:!1,onInit:e.noop,onBeforeShow:e.noop,onShow:e.noop,onBeforeHide:e.noop,onHide:e.noop,onIdle:e.noop,onDestroy:e.noop,onHandleTouch:e.noop}}(jQuery,window); (function($){ "use strict"; var infinite_display='desktop'; if(typeof(window.matchMedia)=='function'){ $(window).on('resize infinite-set-display', function(){ if(window.matchMedia('(max-width: 419px)').matches){ infinite_display='mobile-portrait'; }else if(window.matchMedia('(max-width: 767px)').matches){ infinite_display='mobile-landscape' }else if(window.matchMedia('(max-width: 959px)').matches){ infinite_display='tablet' }else{ infinite_display='desktop'; }}); $(window).trigger('infinite-set-display'); }else{ $(window).on('resize infinite-set-display', function(){ if($(window).innerWidth() <=419){ infinite_display='mobile-portrait'; }else if($(window).innerWidth() <=767){ infinite_display='mobile-landscape' }else if($(window).innerWidth() <=959){ infinite_display='tablet' }else{ infinite_display='desktop'; }}); $(window).trigger('infinite-set-display'); } var infinite_debounce=function(func, threshold, execAsap){ var timeout; return function debounced(){ var obj=this, args=arguments; function delayed(){ if(!execAsap){ func.apply(obj, args); } timeout=null; }; if(timeout){ clearTimeout(timeout); }else if(execAsap){ func.apply(obj, args); } timeout=setTimeout(delayed, threshold); };} var infinite_throttling=function(func, threshold){ var timeout; return function throttled(){ var obj=this, args=arguments; function delayed(){ func.apply(obj, args); timeout=null; }; if(!timeout){ timeout=setTimeout(delayed, threshold); }};} var infinite_sf_menu=function(menu){ if(menu.length==0) return; this.main_menu=menu; this.slide_bar=this.main_menu.children('.infinite-navigation-slide-bar'); this.slide_bar_val={ width: 0, left: 0 }; this.slide_bar_offset='15'; if(this.slide_bar.attr('data-size-offset')){ this.slide_bar_offset=parseInt(this.slide_bar.attr('data-size-offset')); } this.slide_bar_width=0; if(this.slide_bar.attr('data-width')){ this.slide_bar_width=parseInt(this.slide_bar.attr('data-width')); } this.current_menu=this.main_menu.children('.sf-menu').children('.current-menu-item, .current-menu-ancestor').children('a'); this.init(); } infinite_sf_menu.prototype={ init: function(){ var t=this; t.sf_menu_mod(); if(typeof($.fn.superfish)=='function'){ t.main_menu.superfish({ delay: 400, speed: 'fast' }); t.sf_menu_position(); $(window).resize(infinite_debounce(function(){ t.sf_menu_position(); }, 300)); } if(t.slide_bar.length > 0){ t.init_slidebar(); }}, sf_menu_mod: function(){ this.main_menu.find('.sf-mega > ul').each(function(){ var mega_content=$('
'); var mega_row=$('
'); var mega_column_size=0; $(this).children('li').each(function(){ var column_size=parseInt($(this).attr('data-size')); if(mega_column_size + column_size <=60){ mega_column_size +=column_size; }else{ mega_column_size=column_size; mega_content.append(mega_row); mega_row=$('
'); } mega_row.append($('
') .addClass('infinite-column-' + column_size) .html($('
') .addClass($(this).attr('class')) .attr('id', $(this).attr('id')) .html($(this).html()) ) ); }); mega_content.append(mega_row); $(this).replaceWith(mega_content.html()); }); }, sf_menu_position: function(){ if(infinite_display=='mobile-landscape'||infinite_display=='mobile-portrait'||infinite_display=='tablet') return; var body_wrapper=$('.infinite-body-wrapper'); var sub_normal_menu=this.main_menu.find('.sf-menu > li.infinite-normal-menu .sub-menu'); sub_normal_menu.css({display: 'block'}).removeClass('sub-menu-right'); sub_normal_menu.each(function(){ if($(this).offset().left + $(this).width() > body_wrapper.outerWidth()){ $(this).addClass('sub-menu-right'); }}); sub_normal_menu.css({display: 'none'}); this.main_menu.find('.sf-menu > li.infinite-mega-menu .sf-mega').each(function(){ if(!$(this).hasClass('sf-mega-full')){ $(this).css({ display: 'block' }); $(this).css({ right: '', 'margin-left': -(($(this).width() - $(this).parent().outerWidth()) / 2) }); if($(this).offset().left + $(this).width() > $(window).width()){ $(this).css({ right: 0, 'margin-left': '' }); } $(this).css({ display: 'none' }); }}); }, init_slidebar: function(){ var t=this; t.init_slidebar_pos(); $(window).load(function(){ t.init_slidebar_pos(); }); t.main_menu.children('.sf-menu').children('li').on({ mouseenter: function(){ var nav_element=$(this).children('a'); if(nav_element.length > 0){ if(t.slide_bar_width > 0){ var sbw=t.slide_bar_width; var sbl=nav_element.position().left + ((nav_element.outerWidth() - sbw)/2) - t.slide_bar_offset ; }else{ var sbw=nav_element.outerWidth() + (2 * t.slide_bar_offset); var sbl=nav_element.position().left - t.slide_bar_offset; } t.slide_bar.animate({ width: sbw, left: sbl }, { queue: false, duration: 250 }); }}, mouseleave: function(){ t.slide_bar.animate({ width: t.slide_bar_val.width, left: t.slide_bar_val.left }, { queue: false, duration: 250 }); }}); $(window).on('resize', function(){ t.init_slidebar_pos(); }); $(window).on('infinite-navigation-slider-bar-init', function(){ t.current_menu=t.main_menu.children('.sf-menu').children('.current-menu-item, .current-menu-ancestor').children('a'); t.animate_slidebar_pos(); }); $(window).on('infinite-navigation-slider-bar-animate', function(){ t.animate_slidebar_pos(); }); }, init_slidebar_pos: function(){ if(infinite_display=='mobile-landscape'||infinite_display=='mobile-portrait'||infinite_display=='tablet') return; var t=this; if(t.current_menu.length > 0){ if(t.slide_bar_width > 0){ var sbw=t.slide_bar_width; var sbl=t.current_menu.position().left + ((t.current_menu.outerWidth() - sbw)/2) - t.slide_bar_offset ; }else{ var sbw=t.current_menu.outerWidth() + (2 * t.slide_bar_offset); var sbl=t.current_menu.position().left - t.slide_bar_offset; } t.slide_bar_val={ width: sbw, left: sbl };}else{ t.slide_bar_val={ width: 0 } var first_child=t.main_menu.children('ul').children('li:first-child'); if(typeof(first_child.position())!='undefined'){ t.slide_bar_val.left=first_child.position().left; }else{ t.slide_bar_val.left=0; }} t.slide_bar.css({ width: t.slide_bar_val.width, left: t.slide_bar_val.left, display: 'block' }); }, animate_slidebar_pos: function(){ if(infinite_display=='mobile-landscape'||infinite_display=='mobile-portrait'||infinite_display=='tablet') return; var t=this; if(t.current_menu.length > 0){ if(t.slide_bar_width > 0){ var sbw=t.slide_bar_width; var sbl=t.current_menu.position().left + ((t.current_menu.outerWidth() - sbw)/2) - t.slide_bar_offset ; }else{ var sbw=t.current_menu.outerWidth() + (2 * t.slide_bar_offset); var sbl=t.current_menu.position().left - t.slide_bar_offset; } t.slide_bar_val={ width: sbw, left: sbl };}else{ t.slide_bar_val={ width: 0 } var first_child=t.main_menu.children('ul').children('li:first-child'); if(typeof(first_child.position())!='undefined'){ t.slide_bar_val.left=first_child.position().left; }else{ t.slide_bar_val.left=0; }} t.slide_bar.animate({ width: t.slide_bar_val.width, left: t.slide_bar_val.left }, { queue: false, duration: 250 }); }}; $.fn.infinite_mobile_menu=function(args){ var menu_button=$(this).siblings('.infinite-mm-menu-button'); var options={ navbar: { title: '' }, extensions: [ 'pagedim-black' ], }; var extensions={ offCanvas: { pageNodetype: '.infinite-body-outer-wrapper' }}; $(this).find('a[href="#"]').each(function(){ var content=$(this).html(); $('').html(content).insertBefore($(this)); $(this).remove(); }); if($(this).attr('data-slide')){ var html_class='infinite-mmenu-' + $(this).attr('data-slide'); $('html').addClass(html_class); options.offCanvas={ position:$(this).attr('data-slide') };} $(this).mmenu(options, extensions); var menu_api=$(this).data('mmenu'); $(this).find('a').not('.mm-next, .mm-prev').on('click', function(){ menu_api.close(); }); $(this).find('.mmenu-custom-close').on('click', function(){ menu_api.close(); }); $(window).resize(function(){ menu_api.close(); }); menu_api.bind('open', function($panel){ menu_button.addClass('infinite-active'); }); menu_api.bind('close', function($panel){ menu_button.removeClass('infinite-active'); }); } var infinite_overlay_menu=function(menu){ this.menu=menu; this.menu_button=menu.children('.infinite-overlay-menu-icon'); this.menu_content=menu.children('.infinite-overlay-menu-content'); this.menu_close=this.menu_content.children('.infinite-overlay-menu-close'); this.init(); } infinite_overlay_menu.prototype={ init: function(){ var t=this; var delay_count=0; t.menu_content.appendTo('body'); t.menu_content.find('ul.menu > li').each(function(){ $(this).css('transition-delay', (delay_count * 150) + 'ms'); delay_count++; }); t.menu_button.on('click', function(){ $(this).addClass('infinite-active'); t.menu_content.fadeIn(200, function(){ $(this).addClass('infinite-active'); }); return false; }); t.menu_close.on('click', function(){ t.menu_button.removeClass('infinite-active'); t.menu_content.fadeOut(400, function(){ $(this).removeClass('infinite-active'); }); t.menu_content.find('.sub-menu').slideUp(200).removeClass('infinite-active'); return false; }); t.menu_content.find('a').on('click', function(e){ var sub_menu=$(this).siblings('.sub-menu'); if(sub_menu.length > 0){ if(!sub_menu.hasClass('infinite-active')){ var prev_active=sub_menu.closest('li').siblings().find('.sub-menu.infinite-active'); if(prev_active.length > 0){ prev_active.removeClass('infinite-active').slideUp(150); sub_menu.delay(150).slideDown(400, 'easeOutQuart').addClass('infinite-active'); }else{ sub_menu.slideDown(400, 'easeOutQuart').addClass('infinite-active'); } $(this).addClass('infinite-no-preload'); return false; }else{ $(this).removeClass('infinite-no-preload'); }}else{ t.menu_close.trigger('click'); }}); }}; var infinite_header_side_nav=function(side_nav){ if(side_nav.length==0) return; this.prev_scroll=0; this.side_nav=side_nav; this.side_nav_content=side_nav.children(); this.init(); } infinite_header_side_nav.prototype={ init: function(){ var t=this; t.init_nav_bar_element(); $(window).resize(function(){ t.init_nav_bar_element(); }); $(window).scroll(function(){ if(infinite_display=='mobile-landscape'||infinite_display=='mobile-portrait'||infinite_display=='tablet') return; if(t.side_nav.hasClass('infinite-allow-slide')){ var admin_bar_height=parseInt($('html').css('margin-top')); var scroll_down=($(window).scrollTop() > t.prev_scroll); t.prev_scroll=$(window).scrollTop(); if(scroll_down){ if(!t.side_nav.hasClass('infinite-fix-bottom')){ if(t.side_nav.hasClass('infinite-fix-top')){ t.side_nav.css('top', t.side_nav.offset().top); t.side_nav.removeClass('infinite-fix-top'); }else if($(window).height() + $(window).scrollTop() > t.side_nav_content.offset().top + t.side_nav_content.outerHeight()){ if(!t.side_nav.hasClass('infinite-fix-bottom')){ t.side_nav.addClass('infinite-fix-bottom'); t.side_nav.css('top', ''); }} }}else{ if(!t.side_nav.hasClass('infinite-fix-top')){ if(t.side_nav.hasClass('infinite-fix-bottom')){ var top_pos=$(window).scrollTop() + ($(window).height() - admin_bar_height) - t.side_nav_content.outerHeight(); t.side_nav.css('top', top_pos); t.side_nav.removeClass('infinite-fix-bottom'); }else if($(window).scrollTop() + admin_bar_height < t.side_nav_content.offset().top){ if(!t.side_nav.hasClass('infinite-fix-top')){ t.side_nav.addClass('infinite-fix-top'); t.side_nav.css('top', ''); }} }} }}); }, init_nav_bar_element: function(){ if(infinite_display=='mobile-landscape'||infinite_display=='mobile-portrait'||infinite_display=='tablet') return; var t=this; var middle_pos=t.side_nav_content.children('.infinite-pos-middle').addClass('infinite-active'); var bottom_pos=t.side_nav_content.children('.infinite-pos-bottom').addClass('infinite-active'); t.side_nav_content.children('.infinite-pre-spaces').remove(); if($(window).height() < t.side_nav_content.height()){ t.side_nav.addClass('infinite-allow-slide'); }else{ t.side_nav.removeClass('infinite-allow-slide infinite-fix-top infinite-fix-bottom').css('top', ''); if(t.side_nav.hasClass('infinite-style-middle')){ middle_pos.each(function(){ var top_padding=parseInt($(this).css('padding-top')); var prespace=((t.side_nav.height() - (t.side_nav_content.height() - top_padding)) / 2) - top_padding; if(prespace > 0){ $('
').css('height', prespace).insertBefore($(this)); }}); } bottom_pos.each(function(){ var prespace=t.side_nav.height() - t.side_nav_content.height(); if(prespace > 0){ $('
').css('height', prespace).insertBefore($(this)); }}); }} }; var infinite_anchor=function(){ this.anchor_link=$('a[href*="#"]').not('[href="#"]').filter(function(){ if($(this).is('.infinite-mm-menu-button, .mm-next, .mm-prev, .mm-title, .gdlr-core-ilightbox')){ return false; } if($(this).is('.fbx-btn-transition')){ return false; } if($(this).parent('.description_tab, .reviews_tab').length||$(this).not('[class^="infinite"]').closest('.woocommerce').length){ if(!$(this).closest('.menu-item').length){ return false; }} return true; }); if(this.anchor_link.length){ this.menu_anchor=$('#infinite-main-menu, #infinite-bullet-anchor'); this.home_anchor=this.menu_anchor.find('ul.sf-menu > li.current-menu-item > a, ul.sf-menu > li.current-menu-ancestor > a, .infinite-bullet-anchor-link.current-menu-item'); this.init(); }} infinite_anchor.prototype={ init: function(){ var t=this; t.animate_anchor(); t.scroll_section(); t.menu_anchor.filter('#infinite-bullet-anchor').each(function(){ $(this).css('margin-top', - t.menu_anchor.height() / 2).addClass('infinite-init'); }); var url_hash=window.location.hash; if(url_hash){ setTimeout(function(){ var current_menu=t.menu_anchor.find('a[href*="' + url_hash + '"]'); if(!current_menu.is('.current-menu-item, .current-menu-ancestor')){ current_menu.addClass('current-menu-item').siblings().removeClass('current-menu-item current-menu-ancestor'); $(window).trigger('infinite-navigation-slider-bar-init'); } t.scroll_to(url_hash, false, 300); }, 500); }}, animate_anchor: function(){ var t=this; t.home_anchor.on('click', function(){ if(window.location.href==this.href){ $('html, body').animate({ scrollTop: 0 }, { duration: 1500, easing: 'easeOutQuart' }); return false; }}); t.anchor_link.on('click', function(){ if(location.hostname==this.hostname&&location.pathname.replace(/^\//,'')==this.pathname.replace(/^\//,'')){ if(!jQuery(this).hasClass('noscroll')){ return t.scroll_to(this.hash, true); }} }); }, scroll_to: function(hash, redirect, duration){ if(hash=='#infinite-top-anchor'){ var scroll_position=0; }else{ var target=$(hash); if(target.length){ var scroll_position=target.offset().top; }} if(typeof(scroll_position)!='undefined'){ scroll_position=scroll_position - parseInt($('html').css('margin-top')); if(infinite_display=='mobile-portrait'||infinite_display=='mobile-landscape'){ scroll_position=scroll_position - 75; }else if(typeof(window.infinite_anchor_offset)!='undefined'&&!isNaN(window.infinite_anchor_offset)){ scroll_position=scroll_position - parseInt(window.infinite_anchor_offset); } if(scroll_position < 0) scroll_position=0; $('html, body').animate({ scrollTop: scroll_position }, { duration: 1500, easing: 'easeOutQuart', queue: false }); return false; }else if(redirect){ window.location.href=$('body').attr('data-home-url') + hash; return false; }}, scroll_section: function(){ var t=this; var menu_link_anchor=this.menu_anchor.find('a[href*="#"]').not('[href="#"]'); if(!menu_link_anchor.length){ return; } var home_anchor_section=$('#infinite-page-wrapper'); var anchor_section=home_anchor_section.find('div[id], section[id]'); if(!anchor_section.length){ return; } menu_link_anchor.each(function(){ if($(this).closest('.sub-menu').length==0&&$(this.hash).length){ $(this).attr('data-anchor', this.hash); }}); $(window).scroll(function(){ if(infinite_display=='mobile-landscape'||infinite_display=='mobile-portrait'||infinite_display=='tablet') return; if(t.home_anchor.length&&$(window).scrollTop() <=home_anchor_section.offset().top){ t.home_anchor.each(function(){ if($(this).hasClass('infinite-bullet-anchor-link')){ $(this).addClass('current-menu-item').siblings().removeClass('current-menu-item'); $(this).parent('.infinite-bullet-anchor').attr('data-anchor-section', 'infinite-home'); }else if(!$(this).parent('.current-menu-item, .current-menu-ancestor').length){ $(this).parent().addClass('current-menu-item').siblings().removeClass('current-menu-item current-menu-ancestor'); $(window).trigger('infinite-navigation-slider-bar-init'); }}); }else{ var section_position=$(window).scrollTop() + ($(window).height() / 2); anchor_section.each(function(){ if($(this).css('display')=='none') return; var top_offset_pos=$(this).offset().top; if((section_position > top_offset_pos)&&(section_position < top_offset_pos + $(this).outerHeight())){ var section_id=$(this).attr('id'); menu_link_anchor.filter('[data-anchor="#' + section_id + '"]').each(function(){ if($(this).hasClass('infinite-bullet-anchor-link')){ $(this).addClass('current-menu-item').siblings().removeClass('current-menu-item'); $(this).parent('.infinite-bullet-anchor').attr('data-anchor-section', section_id); }else if($(this).parent('li.menu-item').length&&!$(this).parent('li.menu-item').is('.current-menu-item, .current-menu-ancestor')){ $(this).parent('li.menu-item').addClass('current-menu-item').siblings().removeClass('current-menu-item current-menu-ancestor'); $(window).trigger('infinite-navigation-slider-bar-init'); }}); return false; }}); }}); }}; var infinite_sticky_navigation=function(){ var t=this; t.sticky_nav=$('.infinite-with-sticky-navigation .infinite-sticky-navigation'); t.mobile_menu=$('#infinite-mobile-header'); if(t.sticky_nav.hasClass('infinite-sticky-navigation-height')){ window.infinite_anchor_offset=t.sticky_nav.outerHeight(); $(window).resize(function(){ window.infinite_anchor_offset=t.sticky_nav.outerHeight(); }); }else if(t.sticky_nav.attr('data-navigation-offset')){ window.infinite_anchor_offset=parseInt(t.sticky_nav.attr('data-navigation-offset')); }else if(t.sticky_nav.length){ window.infinite_anchor_offset=75; } if(t.sticky_nav.length){ t.init(); } if(t.mobile_menu.hasClass('infinite-sticky-mobile-navigation')){ t.style_mobile_slide(); $(window).trigger('infinite-set-sticky-mobile-navigation'); }} infinite_sticky_navigation.prototype={ init: function(){ var t=this; if(t.sticky_nav.hasClass('infinite-style-fixed')){ t.style_fixed(); }else if(t.sticky_nav.hasClass('infinite-style-slide')){ t.style_slide(); } $(window).trigger('infinite-set-sticky-navigation'); }, style_fixed: function(){ var t=this; var placeholder=$('
'); $(window).on('scroll infinite-set-sticky-navigation', function(){ if(infinite_display=='mobile-landscape'||infinite_display=='mobile-portrait'||infinite_display=='tablet') return; var page_offset=parseInt($('html').css('margin-top')); if(!t.sticky_nav.hasClass('infinite-fixed-navigation')){ if($(window).scrollTop() + page_offset > t.sticky_nav.offset().top){ if(!t.sticky_nav.hasClass('infinite-without-placeholder')){ placeholder.height(t.sticky_nav.outerHeight()); } placeholder.insertAfter(t.sticky_nav); $('body').append(t.sticky_nav); t.sticky_nav.addClass('infinite-fixed-navigation'); setTimeout(function(){ t.sticky_nav.addClass('infinite-animate-fixed-navigation'); }, 10); setTimeout(function(){ t.sticky_nav.css('height', ''); $(window).trigger('infinite-navigation-slider-bar-animate'); }, 200); }}else{ if($(window).scrollTop() + page_offset <=placeholder.offset().top){ if(!t.sticky_nav.hasClass('infinite-without-placeholder')){ t.sticky_nav.height(placeholder.height()); } t.sticky_nav.insertBefore(placeholder); t.sticky_nav.removeClass('infinite-fixed-navigation'); placeholder.remove(); setTimeout(function(){ t.sticky_nav.removeClass('infinite-animate-fixed-navigation'); }, 10); setTimeout(function(){ t.sticky_nav.css('height', ''); $(window).trigger('infinite-navigation-slider-bar-animate'); }, 200); }} }); }, style_slide: function(){ var t=this; var placeholder=$('
'); $(window).on('scroll infinite-set-sticky-navigation', function(){ if(infinite_display=='mobile-landscape'||infinite_display=='mobile-portrait'||infinite_display=='tablet'){ return; } var page_offset=parseInt($('html').css('margin-top')); if(!t.sticky_nav.hasClass('infinite-fixed-navigation')){ if($(window).scrollTop() + page_offset > t.sticky_nav.offset().top + t.sticky_nav.outerHeight() + 200){ if(!t.sticky_nav.hasClass('infinite-without-placeholder')){ placeholder.height(t.sticky_nav.outerHeight()); } placeholder.insertAfter(t.sticky_nav); t.sticky_nav.css('display', 'none'); $('body').append(t.sticky_nav); t.sticky_nav.addClass('infinite-fixed-navigation infinite-animate-fixed-navigation'); t.sticky_nav.slideDown(200); $(window).trigger('infinite-navigation-slider-bar-animate'); }}else{ if($(window).scrollTop() + page_offset <=placeholder.offset().top + placeholder.height() + 200){ var clone=t.sticky_nav.clone(); clone.insertAfter(t.sticky_nav); clone.slideUp(200, function(){ $(this).remove(); }); t.sticky_nav.insertBefore(placeholder); placeholder.remove(); t.sticky_nav.removeClass('infinite-fixed-navigation infinite-animate-fixed-navigation'); t.sticky_nav.css('display', 'block'); $(window).trigger('infinite-navigation-slider-bar-animate'); }} }); }, style_mobile_slide: function(){ var t=this; var placeholder=$('
'); $(window).on('scroll infinite-set-sticky-mobile-navigation', function(){ if(infinite_display=='mobile-landscape'||infinite_display=='mobile-portrait'||infinite_display=='tablet'){ var page_offset=parseInt($('html').css('margin-top')); if(!t.mobile_menu.hasClass('infinite-fixed-navigation')){ if($(window).scrollTop() + page_offset > t.mobile_menu.offset().top + t.mobile_menu.outerHeight() + 200){ placeholder.height(t.mobile_menu.outerHeight()).insertAfter(t.mobile_menu); $('body').append(t.mobile_menu); t.mobile_menu.addClass('infinite-fixed-navigation'); t.mobile_menu.css('display', 'none').slideDown(200); }}else{ if($(window).scrollTop() + page_offset <=placeholder.offset().top + placeholder.height() + 200){ var clone=t.mobile_menu.clone(); clone.insertAfter(t.mobile_menu); clone.slideUp(200, function(){ $(this).remove(); }); t.mobile_menu.insertBefore(placeholder); placeholder.remove(); t.mobile_menu.removeClass('infinite-fixed-navigation'); t.mobile_menu.css('display', 'block'); }} }}); }, }; var infinite_font_resize=function(){ this.heading_font=$('h1, h2, h3, h4, h5, h6'); this.init(); } infinite_font_resize.prototype={ init: function(){ var t=this; t.resize(); $(window).on('resize', infinite_throttling(function(){ t.resize(); }, 100)); }, resize: function(){ var t=this; if(infinite_display=='mobile-landscape'||infinite_display=='mobile-portrait'){ t.heading_font.each(function(){ if(parseInt($(this).css('font-size')) > 40){ if(!$(this).attr('data-orig-font')){ $(this).attr('data-orig-font', $(this).css('font-size')); } $(this).css('font-size', '40px'); }}); }else{ t.heading_font.filter('[data-orig-font]').each(function(){ $(this).css('font-size', $(this).attr('data-orig-font')); }); }} }; function infinite_lightbox(content){ var lightbox_wrap=$('
').hide(); var lightbox_content_wrap=$('
'); lightbox_wrap.append(lightbox_content_wrap); lightbox_content_wrap.wrap($('
')); lightbox_content_wrap.append(content); var scrollPos=$(window).scrollTop(); $('html').addClass('infinite-lightbox-on'); $('body').append(lightbox_wrap); lightbox_wrap.fadeIn(300); lightbox_wrap.on('click', '.infinite-lightbox-close', function(){ $('html').removeClass('infinite-lightbox-on'); $(window).scrollTop(scrollPos); lightbox_wrap.fadeOut(300, function(){ $(this).remove(); }); }); } $(document).ready(function(){ new infinite_font_resize(); $('#infinite-main-menu, #infinite-right-menu, #infinite-mobile-menu, #infinite-top-bar-menu').each(function(){ if($(this).hasClass('infinite-overlay-menu')){ new infinite_overlay_menu($(this)); }else if($(this).hasClass('infinite-mm-menu-wrap')){ $(this).infinite_mobile_menu(); }else{ new infinite_sf_menu($(this)); }}); $('#infinite-top-search, #infinite-mobile-top-search').each(function(){ var search_wrap=$(this).siblings('.infinite-top-search-wrap'); search_wrap.appendTo('body'); $(this).on('click', function(){ search_wrap.fadeIn(200, function(){ $(this).addClass('infinite-active'); }); }); search_wrap.find('.infinite-top-search-close').on('click', function(){ search_wrap.fadeOut(200, function(){ $(this).addClass('infinite-active'); }); }); search_wrap.find('.search-submit').on('click', function(){ if(search_wrap.find('.search-field').val().length==0){ return false; }}); }); $('#infinite-main-menu-cart, #infinite-mobile-menu-cart').each(function(){ $(this).on({ mouseenter: function(){ $(this).addClass('infinite-active infinite-animating'); }, mouseleave: function(){ var menu_cart=$(this); menu_cart.removeClass('infinite-active'); setTimeout(function(){ menu_cart.removeClass('infinite-animating'); }, 400) }}); }); $('body').on('added_to_cart', function(){ $.ajax({ type: 'POST', url: wc_add_to_cart_params.ajax_url, data: { 'action': 'top_bar_woocommerce_cart' }, dataType: 'json', error: function(jqXHR, textStatus, errorThrown){ console.log(jqXHR, textStatus, errorThrown); }, success: function(data){ if(typeof(data['title'])!='undefined'){ $('.infinite-top-cart-title').replaceWith(data['title']); } if(typeof(data['cart-items'])!='undefined'){ $('.infinite-top-cart-item-wrap').replaceWith(data['cart-items']); }} }); }); $('#infinite-dropdown-infinite-flag').hover(function(){ $(this).children('.infinite-dropdown-infinite-list').fadeIn(200); }, function(){ $(this).children('.infinite-dropdown-infinite-list').fadeOut(200); }); $('.infinite-header-boxed-wrap, .infinite-header-background-transparent, .infinite-navigation-bar-wrap.infinite-style-transparent').each(function(){ var header_transparent=$(this); var header_transparent_sub=$('.infinite-header-transparent-substitute'); header_transparent_sub.height(header_transparent.outerHeight()); $(window).on('load resize', function(){ header_transparent_sub.height(header_transparent.outerHeight()); }); }); $('body.error404, body.search-no-results').each(function(){ var wrap=$(this).find('#infinite-full-no-header-wrap'); var body_wrap_offset=parseInt($(this).children('.infinite-body-outer-wrapper').children('.infinite-body-wrapper').css('margin-bottom')); var padding=($(window).height() - wrap.offset().top - wrap.outerHeight() - body_wrap_offset) / 2; if(padding > 0){ wrap.css({ 'padding-top': padding, 'padding-bottom': padding }); } $(window).on('load resize', function(){ wrap.css({ 'padding-top': 0, 'padding-bottom': 0 }); padding=($(window).height() - wrap.offset().top - wrap.outerHeight() - body_wrap_offset) / 2; if(padding > 0){ wrap.css({ 'padding-top': padding, 'padding-bottom': padding }); }}); }); var back_to_top=$('#infinite-footer-back-to-top-button'); if(back_to_top.length){ $(window).on('scroll', function(){ if($(window).scrollTop() > 300){ back_to_top.addClass('infinite-scrolled'); }else{ back_to_top.removeClass('infinite-scrolled'); }}); } $('body').children('#infinite-page-preload').each(function(){ var page_preload=$(this); var animation_time=parseInt(page_preload.attr('data-animation-time')); $('a[href]').not('[href^="#"], [target="_blank"], .gdlr-core-js, .strip, .sf-with-ul, .remove, .ajax_add_to_cart').on('click', function(e){ if(e.which!=1||$(this).hasClass('infinite-no-preload')||e.ctrlKey) return; if(window.location.href!=this.href){ page_preload.addClass('infinite-out').fadeIn(animation_time); }}); $(window).load(function(){ page_preload.fadeOut(animation_time); }); }); $('body.infinite-blog-style-2 .infinite-single-nav-area').each(function(){ var max_height; var single_nav_2=$(this).children(); max_height=0; single_nav_2.css('min-height', '0px'); single_nav_2.each(function(){ if(max_height < $(this).outerHeight()){ max_height=$(this).outerHeight(); }}); single_nav_2.css('min-height', max_height); $(window).resize(function(){ max_height=0; single_nav_2.css('min-height', '0px'); single_nav_2.each(function(){ if(max_height < $(this).outerHeight()){ max_height=$(this).outerHeight(); }}); single_nav_2.css('min-height', max_height); }); }); $('[data-infinite-lb]').click(function(){ var lb_content=$(this).siblings('[data-infinite-lb-id="' + $(this).attr('data-infinite-lb') + '"]'); infinite_lightbox(lb_content.clone()); }); }); $(window).on('pageshow', function(event){ if(event.originalEvent.persisted){ $('body').children('#infinite-page-preload').each(function(){ $(this).fadeOut(400); }); }}); $(window).load(function(){ $('#infinite-fixed-footer').each(function(){ var fixed_footer=$(this); var placeholder=$(''); placeholder.insertBefore(fixed_footer); placeholder.height(fixed_footer.outerHeight()); $('body').css('min-height', $(window).height() - parseInt($('html').css('margin-top'))); $(window).resize(function(){ placeholder.height(fixed_footer.outerHeight()); $('body').css('min-height', $(window).height() - parseInt($('html').css('margin-top'))); }); }); new infinite_header_side_nav($('#infinite-header-side-nav')); new infinite_sticky_navigation(); new infinite_anchor(); }); })(jQuery); !function(c,d){"use strict";var e=!1,n=!1;if(d.querySelector)if(c.addEventListener)e=!0;if(c.wp=c.wp||{},!c.wp.receiveEmbedMessage)if(c.wp.receiveEmbedMessage=function(e){var t=e.data;if(t)if(t.secret||t.message||t.value)if(!/[^a-zA-Z0-9]/.test(t.secret)){for(var r,a,i,s=d.querySelectorAll('iframe[data-secret="'+t.secret+'"]'),n=d.querySelectorAll('blockquote[data-secret="'+t.secret+'"]'),o=0;o