!function(e,o,d){e.openModal=function(){var e={action:"featured_video_modal",url:jQuery("#wfp_featured_video_url").val(),nonce:Featured_Video_Nonce.nonce};jQuery.post(ajaxurl,e,(function(e){jQuery("#wfp-featured-video-modal-container").html(e),jQuery("#wfp_featured_video_modal").show()}))},e.closeModal=function(){jQuery("#wfp_featured_video_modal").hide(),jQuery("#wfp-featured-video-modal-container").html("")},e.setVideo=function(o){var d=o.data("video"),a=o.data("thumb");jQuery("#wfp_featured_video_url").val(d),jQuery("#featured_video").html('<span class="dashicons dashicons-video-alt3"></span><img src="'+a+'">'),jQuery("#thumbnail-change-toggle").html('<p class="hide-if-no-js"><a href="#" id="wfp-remove-featured-video">'+e.RemoveVideo+"</a></p>"),e.closeModal()},e.removeVideo=function(o){jQuery("#wfp_featured_video_modal").find(".video-data").html(""),jQuery("#wfp_featured_video_url").val(""),jQuery("#featured_video").html(""),jQuery("#thumbnail-change-toggle").html('<p class="hide-if-no-js"><a href="#" id="wfp-set-featured-video">'+e.SetVideo+"</a></p>")},e.getVideoData=function(){var e=jQuery("#_featured_video").val(),o=jQuery("#wfp_featured_video_modal").find(".video-data"),d={action:"featured_video_get_data",url:e,nonce:Featured_Video_Nonce.nonce};o.html('<span class="spinner"></span>'),jQuery.post(ajaxurl,d,(function(e){o.html(e)}))},e.bindButtons=function(){jQuery(".featured-video-metabox-container").on("click","#wfp-set-featured-video",(function(o){o.preventDefault(),e.openModal()})),jQuery(".featured-video-metabox-container #featured_video").on("click","img",(function(o){o.preventDefault(),e.openModal()})),jQuery(".featured-video-metabox-container").on("click","#wfp-remove-featured-video",(function(o){o.preventDefault(),e.removeVideo()}))},e.bindModal=function(){jQuery("#wfp-featured-video-modal-container").on("click",".featured-video-modal #wfp_get_video_data",(function(o){o.preventDefault(),e.getVideoData()})),jQuery("#wfp-featured-video-modal-container").on("click","#wfp_featured_video_modal .video-data .video-data-item #insert-video",(function(){e.setVideo(jQuery(this).parent().parent())})),jQuery("#wfp-featured-video-modal-container").on("click","#wfp_featured_video_modal \t.media-modal-close",(function(o){o.preventDefault(),e.closeModal()}))},jQuery((function(){e.bindButtons(),e.bindModal()}))}(window.Featured_Video=window.Featured_Video||{},jQuery);