Created
August 29, 2012 14:10
-
-
Save DemitryT/3513136 to your computer and use it in GitHub Desktop.
admin.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function updateMapMarkerOnShowAddressChange() { | |
// added the if statement below | |
if($("setting_rentals_details_map_marker_box")) { | |
var boxRadioButton = $("setting_rentals_details_map_marker_box"); | |
var initialMapMarkerBox = boxRadioButton.checked; | |
} | |
var rentAddressCheckbox = $('setting_show_rental_address'); | |
var pinRadioButton = $("setting_rentals_details_map_marker_pin"); | |
// added the if statement below | |
if(typeof rentAddressCheckbox !== "undefined" && typeof pinRadioButton !== "undefined" && typeof boxRadioButton !== "undefined") { | |
if(rentAddressCheckbox.checked && !boxRadioButton.disabled){ | |
boxRadioButton.disabled = true; | |
boxRadioButton.checked = false; | |
pinRadioButton.checked = true; | |
} | |
rentAddressCheckbox.observe('click', function() { | |
if(rentAddressCheckbox.checked) { | |
boxRadioButton.disabled = true; | |
boxRadioButton.checked = false; | |
pinRadioButton.checked = true; | |
} | |
else if(!rentAddressCheckbox.checked) { | |
boxRadioButton.disabled = false; | |
if(initialMapMarkerBox) { | |
boxRadioButton.checked = true; | |
pinRadioButton.checked = false; | |
} | |
} | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment