Skip to content

Instantly share code, notes, and snippets.

form_submit.click( function( e ) {
let $inputs = $(document).find('#inspiry-additional-details-container input'),
$titleInputs = $(document).find('.inspiry-detail-title input'),
$valueInputs = $(document).find('.inspiry-detail-value input'),
$emptyTitleInputs = $titleInputs.filter(function(){ return !$(this).val(); }).length,
$emptyValueInputs = $valueInputs.filter(function(){ return !$(this).val(); }).length;
if ( $emptyTitleInputs !== $emptyValueInputs) {
e.preventDefault();
$(window).on('load', function () {
let agentSelect = $("#agent-selectbox");
if (agentSelect.find("option").length > 3) {
for (let i = 0; i < 3; i++) {
agentSelect.find("option:first-child").remove();
}
agentSelect.select2("destroy");
agentSelect.select2();
}
});
function remove_agents_from_dropdown( $hook ) {
if ( 'property' !== get_current_screen()->post_type ) {
return;
}
?>
<script>
window.addEventListener('load', function () {
let agentSelect = $("#REAL_HOMES_agents");
if (agentSelect.find("option").length > 3) {
@sungraiz
sungraiz / submit-google-map.js
Created October 14, 2019 13:54
Fix for coordinates search
/**
* Javascript to handle google map for property submit page
*/
jQuery( function( $ ) {
'use strict';
var mapField = {};
(function(){
@sungraiz
sungraiz / submit-google-map.js
Last active October 16, 2019 14:47
Now user can search by both coordinates and address.
if((/[a-z]/i.test(address))){
this.geocoder.geocode({'address': address}, function (results, status)
{
if ( status == window.google.maps.GeocoderStatus.OK )
{
that.updatePositionInput(results[0].geometry.location);
that.marker.setPosition(results[0].geometry.location);
that.map.setCenter(that.marker.position);
that.map.setZoom(15);
/*
Leaflet.markercluster, Provides Beautiful Animated Marker Clustering functionality for Leaflet, a JS library for interactive maps.
https://github.com/Leaflet/Leaflet.markercluster
(c) 2012-2013, Dave Leaver, smartrak
*/
(function (window, document, undefined) {/*
* L.MarkerClusterGroup extends L.FeatureGroup by clustering the markers contained within
*/
L.MarkerClusterGroup = L.FeatureGroup.extend({
.leaflet-cluster-anim .leaflet-marker-icon, .leaflet-cluster-anim .leaflet-marker-shadow {
-webkit-transition: -webkit-transform 0.3s ease-out, opacity 0.3s ease-in;
-moz-transition: -moz-transform 0.3s ease-out, opacity 0.3s ease-in;
-o-transition: -o-transform 0.3s ease-out, opacity 0.3s ease-in;
transition: transform 0.3s ease-out, opacity 0.3s ease-in;
}
.leaflet-cluster-spider-leg {
/* stroke-dashoffset (duration and function) should match with leaflet-marker-icon transform in order to track it exactly */
-webkit-transition: -webkit-stroke-dashoffset 0.3s ease-out, -webkit-stroke-opacity 0.3s ease-in;
/**
* Javascript to handle open street map for multiple properties
*/
jQuery( function( $ ) {
'use strict';
if ( typeof propertiesMapData !== "undefined" ) {
if ( 0 < propertiesMapData.length ) {
<style>
.rh_form__item #attachment-thumbs-container {
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-flex-wrap: wrap;
-ms-flex-wrap: wrap;
flex-wrap: wrap;
}
// Create the autocomplete object, restricting the search predictions to
// geographical location types.
var autocomplete = new google.maps.places.Autocomplete(
document.getElementById(addressField), {types: ['geocode']});
// Avoid paying for data that you don't need by restricting the set of
// place fields that are returned to just the address components.
autocomplete.setFields(['geometry']);
// When the user selects an address from the drop-down, populate the