/* * SiteSEO * https://siteseo.io/ * (c) SiteSEO Team <support@siteseo.io> */ /* Copyright 2016 - 2024 - Benjamin Denis (email : contact@seopress.org) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2, as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ jQuery(document).ready((function($){function siteseo_call_media_uploader(){var mediaUploader,thumb;$(".siteseo_video_thumbnail_upload").click((function(e){e.preventDefault(),$btn=$(this),mediaUploader?mediaUploader.open():(thumb=$(this).prev(),(mediaUploader=wp.media.frames.file_frame=wp.media({multiple:!1})).on("select",(function(){var attachment=mediaUploader.state().get("selection").first().toJSON();$btn.prev().val(attachment.url)})),mediaUploader.open())}))}siteseo_call_media_uploader();var template=$("#wrap-videos .video:last").clone(),stop=!1;function siteseo_call_video_accordion(){$("#wrap-videos .video").accordion({animate:!1,collapsible:!0,active:!1,heightStyle:"panel"})}$("#wrap-videos .video h3").click((function(event){stop&&(event.stopImmediatePropagation(),event.preventDefault(),stop=!1)})),siteseo_call_video_accordion();var sectionsCount=$("#wrap-videos").attr("data-count");$("#add-video").click((function(){sectionsCount++;var section=template.clone().find(":input").each((function(){var input_id=this.id,input_name=this.name,newId=this.id.replace(/^(\w+)\[.*?\]/,"$1["+sectionsCount+"]");$(this).attr("name",input_name.replace(/^(\w+)\[.*?\]/,"$1["+sectionsCount+"]")),$(this).hasClass("siteseo_video_thumbnail_upload")||$(this).attr("value",""),$(this).is(":checkbox")?($(this).parent().attr("for",input_id.replace(/^(\w+)\[.*?\]/,"$1["+sectionsCount+"]")),$(this).parent().attr("id",input_name.replace(/^(\w+)\[.*?\]/,"$1["+sectionsCount+"]"))):$(this).hasClass("siteseo_video_thumbnail_upload")||($(this).prev().attr("for",input_id.replace(/^(\w+)\[.*?\]/,"$1["+sectionsCount+"]")),$(this).prev().attr("id",input_name.replace(/^(\w+)\[.*?\]/,"$1["+sectionsCount+"]"))),this.id=newId})).end().appendTo("#wrap-videos");return siteseo_call_video_accordion(),$("#wrap-videos .video").accordion("destroy"),siteseo_call_video_accordion(),$("[id^=__wp-uploader-id-]").each((function(){$(this).remove()})),siteseo_call_media_uploader(),!1})),$("#wrap-videos").on("click",".remove-video",(function(){return $(this).fadeOut(300,(function(){return $(this).parent().parent().parent().remove(),!1})),!1}))}));