/**
* @namespace WPGMZA
* @module MapsEngineDialog
* @requires WPGMZA
*/
(function($) {
WPGMZA.MapsEngineDialog = function(element)
{
var self = this;
this.element = element;
$(element).show();
$(element).remodal().open();
$("[data-maps-engine]").on("click", function(event) {
self.onButtonClicked(event);
});
}
WPGMZA.MapsEngineDialog.prototype.onButtonClicked = function(event)
{
$(event.target).prop("disabled", true);
$.ajax(WPGMZA.ajaxurl, {
method: "POST",
data: {
action: "wpgmza_maps_engine_dialog_set_engine",
engine: $(event.target).attr("data-maps-engine")
},
success: function(response, status, xhr) {
window.location.reload();
}
});
}
$(window).on("load", function(event) {
var element = $("#wpgmza-maps-engine-dialog");
if(!element.length)
return;
if(WPGMZA.settings.wpgmza_maps_engine_dialog_done)
return;
WPGMZA.mapsEngineDialog = new WPGMZA.MapsEngineDialog(element);
});
})(jQuery);