Attach videos
Listing locations
' +
'' +
'';
return video_attachment_tpl;
};
window.w2dc_check_videos_attachments_number = function() {
if (videos_number > $("#w2dc-attached-videos-wrapper .w2dc-attached-item").length) {
$("#w2dc-attach-videos-functions").show();
} else {
$("#w2dc-attach-videos-functions").hide();
}
}
$(function() {
w2dc_check_videos_attachments_number();
$("#w2dc-attached-videos-wrapper").on("click", ".w2dc-attached-item-delete", function() {
$(this).parents(".w2dc-attached-item").remove();
w2dc_check_videos_attachments_number();
});
});
})(jQuery);
Attach videos
Listing locations
').dialog({
dialogClass: 'w2dc-content',
width: ($(window).width()*0.5),
height: ($(window).height()*0.8),
modal: true,
resizable: false,
draggable: false,
title: 'Select map marker icon (icon and color may depend on selected categories)',
open: function() {
w2dc_ajax_loader_show();
$.ajax({
type: "POST",
url: w2dc_js_objects.ajaxurl,
data: {'action': 'w2dc_select_field_icon'},
dataType: 'html',
success: function(response_from_the_action_function){
if (response_from_the_action_function != 0) {
$('#select_marker_icon_dialog').html(response_from_the_action_function);
if (map_icon_file_input.val())
$("#"+map_icon_file_input.val()).addClass("w2dc-selected-icon");
}
},
complete: function() {
w2dc_ajax_loader_hide();
}
});
$(document).on("click", ".ui-widget-overlay", function() { $('#select_marker_icon_dialog').remove(); });
},
close: function() {
$('#select_marker_icon_dialog').remove();
}
});
});
$(document).on("click", ".w2dc-fa-icon", function() {
$(".w2dc-selected-icon").removeClass("w2dc-selected-icon");
if (map_icon_file_input) {
map_icon_file_input.val($(this).attr('id'));
map_icon_file_input = false;
$(this).addClass("w2dc-selected-icon");
$('#select_marker_icon_dialog').remove();
w2dc_generateMap_backend();
}
});
$(document).on("click", "#reset_fa_icon", function() {
if (map_icon_file_input) {
$(".w2dc-selected-icon").removeClass("w2dc-selected-icon");
map_icon_file_input.val('');
map_icon_file_input = false;
$('#select_marker_icon_dialog').remove();
w2dc_generateMap_backend();
}
});
$(".add_address").click(function() {
w2dc_ajax_loader_show();
$.ajax({
type: "POST",
url: w2dc_js_objects.ajaxurl,
data: {'action': 'w2dc_add_location_in_metabox', 'post_id': 12216},
success: function(response_from_the_action_function){
if (response_from_the_action_function != 0) {
$("#w2dc-locations-wrapper").append(response_from_the_action_function);
$(".w2dc-delete-address").show();
if (locations_number == $(".w2dc-location-in-metabox").length) {
$(".add_address").hide();
}
if (w2dc_maps_objects.address_autocomplete && w2dc_js_objects.is_maps_used) {
w2dc_setupAutocomplete();
}
}
},
complete: function() {
w2dc_ajax_loader_hide();
}
});
});
$(document).on("click", ".w2dc-delete-address", function() {
$(this).parents(".w2dc-location-in-metabox").remove();
if ($(".w2dc-location-in-metabox").length == 1)
$(".w2dc-delete-address").hide();
w2dc_generateMap_backend();
if (locations_number > $(".w2dc-location-in-metabox").length)
$(".add_address").show();
});
$(document).on("click", ".w2dc-manual-coords", function() {
if ($(this).is(":checked"))
$(this).parents(".w2dc-manual-coords-wrapper").find(".w2dc-manual-coords-block").slideDown(200);
else
$(this).parents(".w2dc-manual-coords-wrapper").find(".w2dc-manual-coords-block").slideUp(200);
});
if (locations_number > $(".w2dc-location-in-metabox").length)
$(".add_address").show();
});
})(jQuery);