/** Wonderplugin Carousel Plugin Free Version
 * Copyright 2015 Magic Hills Pty Ltd All Rights Reserved
 * Website: http://www.wonderplugin.com
 * Version 11.0 
 */
(function($){$(document).ready(function(){$(".wonderplugin-engine").css({display:"none"});$(".wonderplugin-tab-buttons-horizontal").each(function(){$(this).find("li").each(function(index){$(this).click(function(){if($(this).hasClass("wonderplugin-tab-button-horizontal-selected"))return;$(this).parent().find("li").removeClass("wonderplugin-tab-button-horizontal-selected");$(this).addClass("wonderplugin-tab-button-horizontal-selected");var panelsID=$(this).parent().data("panelsid");$("#"+panelsID).children("li").removeClass("wonderplugin-tab-horizontal-selected");
$("#"+panelsID).children("li").eq(index).addClass("wonderplugin-tab-horizontal-selected")})})});$("#wonderplugin-carousel-fixaspectratio").click(function(){if($(this).is(":checked")){$("#wonderplugin-carousel-sameheight").prop("checked",false);$("#wonderplugin-carousel-fitimage").prop("checked",false)}});$("#wonderplugin-carousel-sameheight").click(function(){if($(this).is(":checked")){$("#wonderplugin-carousel-fixaspectratio").prop("checked",false);$("#wonderplugin-carousel-fitimage").prop("checked",
false)}});$("#wonderplugin-carousel-fitimage").click(function(){if($(this).is(":checked")){$("#wonderplugin-carousel-fixaspectratio").prop("checked",false);$("#wonderplugin-carousel-sameheight").prop("checked",false)}});$("#wonderplugin-carousel-toolbar").find("li").each(function(index){$(this).click(function(){if($(this).hasClass("wonderplugin-tab-buttons-selected"))return;$(this).parent().find("li").removeClass("wonderplugin-tab-buttons-selected");if(!$(this).hasClass("laststep"))$(this).addClass("wonderplugin-tab-buttons-selected");
$("#wonderplugin-carousel-tabs").children("li").removeClass("wonderplugin-tab-selected");$("#wonderplugin-carousel-tabs").children("li").eq(index).addClass("wonderplugin-tab-selected");$("#wonderplugin-carousel-tabs").removeClass("wonderplugin-tabs-grey");if(index==3){previewCarousel();$("#wonderplugin-carousel-tabs").addClass("wonderplugin-tabs-grey")}else if(index==4)publishCarousel()})});var getURLParams=function(href){var result={};if(href.indexOf("?")<0)return result;var params=href.substring(href.indexOf("?")+
1).split("&");for(var i=0;i<params.length;i++){var value=params[i].split("=");if(value&&value.length==2&&value[0].toLowerCase()!="v")result[value[0].toLowerCase()]=value[1]}return result};var addMediaToList=function(data){if($("#wonderplugin-newestfirst").is(":checked"))wonderplugin_carousel_config.slides.unshift(data);else wonderplugin_carousel_config.slides.push(data)};var slideDialog=function(dialogType,onSuccess,data,dataIndex){var dialogTitle=["image","video","Youtube Video","Vimeo Video"];var dialogCode=
"<div class='wonderplugin-dialog-container'>"+"<div class='wonderplugin-dialog-bg'></div>"+"<div class='wonderplugin-dialog'>"+"<h3 id='wonderplugin-dialog-title'></h3>"+"<div class='error' id='wonderplugin-dialog-error' style='display:none;'></div>"+"<table id='wonderplugin-dialog-form'>";if(dialogType==2||dialogType==3)dialogCode+="<tr>"+"<th>Enter video URL</th>"+"<td><input name='wonderplugin-dialog-video' type='text' id='wonderplugin-dialog-video' value='' class='regular-text' /> <input type='button' class='button' id='wonderplugin-dialog-select-video' value='Enter' /></td>"+
"</tr>"+"<tr>";dialogCode+="<tr>"+"<th>Enter"+(dialogType>0?" poster":"")+" image URL</th>"+"<td><input name='wonderplugin-dialog-image' type='text' id='wonderplugin-dialog-image' value='' class='regular-text' /> or <input type='button' class='button' data-textid='wonderplugin-dialog-image' id='wonderplugin-dialog-select-image' value='Upload' /></td>"+"</tr>"+"<tr id='wonderplugin-dialog-image-display-tr' style='display:none;'>"+"<th></th>"+"<td><img id='wonderplugin-dialog-image-display' style='width:80px;height:80px;' /></td>"+
"</tr>"+"<tr>"+"<th>Thumbnail URL</th>"+"<td>"+"<input name='wonderplugin-dialog-thumbnail' type='text' id='wonderplugin-dialog-thumbnail' value='' class='regular-text' /> or <input type='button' class='button' data-textid='wonderplugin-dialog-thumbnail' id='wonderplugin-dialog-select-thumbnail' value='Upload' /> <br/>"+"<label><input name='wonderplugin-dialog-displaythumbnail' type='checkbox' id='wonderplugin-dialog-displaythumbnail' value='' />Use thumbnail in carousel</label>"+"</td>"+"</tr>";
if(dialogType==1)dialogCode+="<tr>"+"<th>MP4 video URL</th>"+"<td><input name='wonderplugin-dialog-mp4' type='text' id='wonderplugin-dialog-mp4' value='' class='regular-text' /> or <input type='button' class='button' data-textid='wonderplugin-dialog-mp4' id='wonderplugin-dialog-select-mp4' value='Upload' /></td>"+"</tr>"+"<tr>"+"<tr>"+"<th>WebM video URL (Optional)</th>"+"<td><input name='wonderplugin-dialog-webm' type='text' id='wonderplugin-dialog-webm' value='' class='regular-text' /> or <input type='button' class='button' data-textid='wonderplugin-dialog-webm' id='wonderplugin-dialog-select-webm' value='Upload' /></td>"+
"</tr>"+"<tr>";dialogCode+="<tr>"+"<th>Title</th>"+"<td><input name='wonderplugin-dialog-image-title' type='text' id='wonderplugin-dialog-image-title' value='' class='large-text' /></td>"+"</tr>"+"<tr>"+"<th>Description</th>"+"<td><textarea name='wonderplugin-dialog-image-description' type='' id='wonderplugin-dialog-image-description' value='' class='large-text' /></td>"+"</tr>"+"<tr>"+"<th>Img alt text</th>"+"<td><label><input name='wonderplugin-dialog-image-altusetitle' type='checkbox' id='wonderplugin-dialog-image-altusetitle' checked /> Use Title as img alt text. To use a different text, uncheck the option and enter it below:  </label><br><input name='wonderplugin-dialog-image-alt' type='text' id='wonderplugin-dialog-image-alt' value='' class='large-text' disabled /></td>"+
"</tr>";dialogCode+="<tr>"+"<th>Click to open Lightbox popup</th>"+"<td><label><input name='wonderplugin-dialog-lightbox' type='checkbox' id='wonderplugin-dialog-lightbox' value='' checked /> Open current "+dialogTitle[dialogType]+" in Lightbox</label>"+"</tr>"+"<tr><th>Lightbox size</th>"+"<td><label><input name='wonderplugin-dialog-lightbox-size' type='checkbox' id='wonderplugin-dialog-lightbox-size' value='' /> Set Lightbox size (px) </label>"+" <input name='wonderplugin-dialog-lightbox-width' type='text' id='wonderplugin-dialog-lightbox-width' value='640' class='small-text' /> / <input name='wonderplugin-dialog-lightbox-height' type='text' id='wonderplugin-dialog-lightbox-height' value='480' class='small-text' />"+
"</td>"+"</tr>";if(dialogType==0)dialogCode+="<tr><th>Or click to open web link</th>"+"<td>"+"<input name='wonderplugin-dialog-weblink' type='text' id='wonderplugin-dialog-weblink' value='' class='large-text' disabled /><br />Uncheck the option \"Open current image in Lightbox\" to enable weblink"+"</td>"+"</tr>"+"<tr><th>Set web link onclick code</th>"+"<td>"+"<input name='wonderplugin-dialog-clickhandler' type='text' id='wonderplugin-dialog-clickhandler' value='' class='large-text' disabled />"+
"</td>"+"</tr>"+"<tr><th>Set web link target</th>"+"<td>"+"<div class='select-editable'><select onchange='this.nextElementSibling.value=this.value' id='wonderplugin-dialog-linktarget-select' disabled>"+"<option value=''></option>"+"<option value='_blank'>_blank</option>"+"<option value='_self'>_self</option>"+"<option value='_parent'>_parent</option>"+"<option value='_top'>_top</option>"+"</select>"+"<input name='wonderplugin-dialog-linktarget' type='text' id='wonderplugin-dialog-linktarget' value='' class='regular-text' disabled /></div>"+
"</td>"+"</tr>"+"<tr><th></th>"+"<td>"+"<label><input name='wonderplugin-dialog-weblinklightbox' type='checkbox' id='wonderplugin-dialog-weblinklightbox' value='' /> Open web link in Lightbox</label>"+"</td>"+"</tr>";dialogCode+="</table>"+"<br /><br />"+"<div class='wonderplugin-dialog-buttons'>"+"<input type='button' class='button button-primary' id='wonderplugin-dialog-ok' value='OK' />"+"<input type='button' class='button' id='wonderplugin-dialog-cancel' value='Cancel' />"+"</div>"+"</div>"+"</div>";
var $slideDialog=$(dialogCode);$("body").append($slideDialog);$(".wonderplugin-dialog").css({"margin-top":String($(document).scrollTop()+60)+"px"});$(".wonderplugin-dialog-bg").css({height:$(document).height()+"px"});$("#wonderplugin-dialog-lightbox").click(function(){var is_checked=$(this).is(":checked");if($("#wonderplugin-dialog-weblink").length)$("#wonderplugin-dialog-weblink").attr("disabled",is_checked);if($("#wonderplugin-dialog-clickhandler").length)$("#wonderplugin-dialog-clickhandler").attr("disabled",
is_checked);if($("#wonderplugin-dialog-linktarget").length)$("#wonderplugin-dialog-linktarget").attr("disabled",is_checked);if($("#wonderplugin-dialog-linktarget-select").length)$("#wonderplugin-dialog-linktarget-select").attr("disabled",is_checked);if($("#wonderplugin-dialog-weblinklightbox").length)$("#wonderplugin-dialog-weblinklightbox").attr("disabled",is_checked)});$(".wonderplugin-dialog").css({"margin-top":String($(document).scrollTop()+60)+"px"});$(".wonderplugin-dialog-bg").css({height:$(document).height()+
"px"});$("#wonderplugin-dialog-title").html("Add "+dialogTitle[dialogType]);$("#wonderplugin-dialog-image-altusetitle").click(function(){$("#wonderplugin-dialog-image-alt").attr("disabled",$(this).is(":checked"))});if(data){if(dialogType==2||dialogType==3)$("#wonderplugin-dialog-video").val(data.video);$("#wonderplugin-dialog-image").val(data.image);if(data.image){$("#wonderplugin-dialog-image-display-tr").css({display:"table-row"});$("#wonderplugin-dialog-image-display").attr("src",data.image)}$("#wonderplugin-dialog-thumbnail").val(data.thumbnail);
if(data.displaythumbnail)$("#wonderplugin-dialog-displaythumbnail").attr("checked",true);else $("#wonderplugin-dialog-displaythumbnail").attr("checked",false);$("#wonderplugin-dialog-image-title").val(data.title);$("#wonderplugin-dialog-image-description").val(data.description);$("#wonderplugin-dialog-image-altusetitle").attr("checked",data.altusetitle);$("#wonderplugin-dialog-image-alt").val(data.alt);$("#wonderplugin-dialog-image-alt").attr("disabled",data.altusetitle);if(dialogType==1){$("#wonderplugin-dialog-mp4").val(data.mp4);
$("#wonderplugin-dialog-webm").val(data.webm)}if(dialogType==0){$("#wonderplugin-dialog-weblink").val(data.weblink);$("#wonderplugin-dialog-clickhandler").val(data.clickhandler);$("#wonderplugin-dialog-linktarget").val(data.linktarget);$("#wonderplugin-dialog-weblink").attr("disabled",data.lightbox);$("#wonderplugin-dialog-clickhandler").attr("disabled",data.lightbox);$("#wonderplugin-dialog-linktarget").attr("disabled",data.lightbox);$("#wonderplugin-dialog-linktarget-select").attr("disabled",data.lightbox);
if(data.weblinklightbox)$("#wonderplugin-dialog-weblinklightbox").attr("checked",true);else $("#wonderplugin-dialog-weblinklightbox").attr("checked",false);$("#wonderplugin-dialog-weblinklightbox").attr("disabled",data.lightbox)}if("lightbox"in data)$("#wonderplugin-dialog-lightbox").attr("checked",data.lightbox);if("lightboxsize"in data)$("#wonderplugin-dialog-lightbox-size").attr("checked",data.lightboxsize);if(data.lightboxwidth)$("#wonderplugin-dialog-lightbox-width").val(data.lightboxwidth);
if(data.lightboxheight)$("#wonderplugin-dialog-lightbox-height").val(data.lightboxheight)}if(dialogType==2||dialogType==3)$("#wonderplugin-dialog-select-video").click(function(){var videoData={type:dialogType,video:$.trim($("#wonderplugin-dialog-video").val()),image:$.trim($("#wonderplugin-dialog-image").val()),thumbnail:$.trim($("#wonderplugin-dialog-thumbnail").val()),title:$.trim($("#wonderplugin-dialog-image-title").val()),description:$.trim($("#wonderplugin-dialog-image-description").val()),
altusetitle:$("#wonderplugin-dialog-image-altusetitle").is(":checked"),alt:$.trim($("#wonderplugin-dialog-image-alt").val())};$slideDialog.remove();onlineVideoDialog(dialogType,function(items){items.map(function(data){addMediaToList({type:dialogType,image:data.image,thumbnail:data.thumbnail?data.thumbnail:data.image,displaythumbnail:data.displaythumbnail,video:data.video,mp4:data.mp4,webm:data.webm,title:data.title,description:data.description,altusetitle:data.altusetitle,alt:data.alt,weblink:data.weblink,
clickhandler:data.clickhandler,linktarget:data.linktarget,weblinklightbox:data.weblinklightbox,lightbox:data.lightbox,lightboxsize:data.lightboxsize,lightboxwidth:data.lightboxwidth,lightboxheight:data.lightboxheight})});updateMediaTable()},videoData,true,dataIndex)});var media_upload_onclick=function(event){event.preventDefault();var buttonId=$(this).attr("id");var textId=$(this).data("textid");var library_title=buttonId=="wonderplugin-dialog-select-image"||buttonId=="wonderplugin-dialog-select-thumbnail"?
"Add Image":"Add Video";var library_type=buttonId=="wonderplugin-dialog-select-image"||buttonId=="wonderplugin-dialog-select-thumbnail"?"image":"video";var media_uploader=wp.media.frames.file_frame=wp.media({title:library_title,library:{type:library_type},button:{text:library_title},multiple:dialogType==0&&buttonId=="wonderplugin-dialog-select-image"});media_uploader.on("select",function(event){var selection=media_uploader.state().get("selection");if(dialogType==0&&buttonId=="wonderplugin-dialog-select-image"&&
selection.length>1){var items=[];selection.map(function(attachment){attachment=attachment.toJSON();if(attachment.type!="image")return;var thumbnail;var thumbnailsize=$("#wonderplugin-carousel-thumbnailsize").text();if(thumbnailsize&&thumbnailsize.length>0&&attachment.sizes&&attachment.sizes[thumbnailsize]&&attachment.sizes[thumbnailsize].url)thumbnail=attachment.sizes[thumbnailsize].url;else if(attachment.sizes&&attachment.sizes.medium&&attachment.sizes.medium.url)thumbnail=attachment.sizes.medium.url;
else if(attachment.sizes&&attachment.sizes.thumbnail&&attachment.sizes.thumbnail.url)thumbnail=attachment.sizes.thumbnail.url;else thumbnail=attachment.url;items.push({image:attachment.url,thumbnail:thumbnail,displaythumbnail:$("#wonderplugin-dialog-displaythumbnail").is(":checked"),title:attachment.title,description:attachment.description,altusetitle:true,alt:"",weblink:"",clickhandler:"",weblinklightbox:false,linktarget:"",lightbox:$("#wonderplugin-dialog-lightbox").is(":checked"),lightboxsize:$("#wonderplugin-dialog-lightbox-size").is(":checked"),
lightboxwidth:parseInt($.trim($("#wonderplugin-dialog-lightbox-width").val())),lightboxheight:parseInt($.trim($("#wonderplugin-dialog-lightbox-height").val()))})});$slideDialog.remove();onSuccess(items)}else{attachment=selection.first().toJSON();if(buttonId=="wonderplugin-dialog-select-image"){if(attachment.type!="image"){$("#wonderplugin-dialog-error").css({display:"block"}).html("<p>Please select an image file</p>");return}var thumbnail;var thumbnailsize=$("#wonderplugin-carousel-thumbnailsize").text();
if(thumbnailsize&&thumbnailsize.length>0&&attachment.sizes&&attachment.sizes[thumbnailsize]&&attachment.sizes[thumbnailsize].url)thumbnail=attachment.sizes[thumbnailsize].url;else if(attachment.sizes&&attachment.sizes.medium&&attachment.sizes.medium.url)thumbnail=attachment.sizes.medium.url;else if(attachment.sizes&&attachment.sizes.thumbnail&&attachment.sizes.thumbnail.url)thumbnail=attachment.sizes.thumbnail.url;else thumbnail=attachment.url;$("#wonderplugin-dialog-image-display-tr").css({display:"table-row"});
$("#wonderplugin-dialog-image-display").attr("src",attachment.url);$("#wonderplugin-dialog-image").val(attachment.url);$("#wonderplugin-dialog-thumbnail").val(thumbnail);if($.trim($("#wonderplugin-dialog-image-title").val()).length<=0)$("#wonderplugin-dialog-image-title").val(attachment.title);if($.trim($("#wonderplugin-dialog-image-description").val()).length<=0)$("#wonderplugin-dialog-image-description").val(attachment.description)}else if(buttonId=="wonderplugin-dialog-select-thumbnail"){if(attachment.type!=
"image"){$("#wonderplugin-dialog-error").css({display:"block"}).html("<p>Please select an image file</p>");return}$("#wonderplugin-dialog-thumbnail").val(attachment.url)}else{if(attachment.type!="video"){$("#wonderplugin-dialog-error").css({display:"block"}).html("<p>Please select a video file</p>");return}$("#"+textId).val(attachment.url)}}$("#wonderplugin-dialog-error").css({display:"none"}).empty()});media_uploader.open()};if(parseInt($("#wonderplugin-carousel-wp-history-media-uploader").text())==
1){var buttonId="";var textId="";var history_media_upload_onclick=function(event){buttonId=$(this).attr("id");textId=$(this).data("textid");var mediaType=buttonId=="wonderplugin-dialog-select-image"||buttonId=="wonderplugin-dialog-select-thumbnail"?"image":"video";tb_show("Upload "+mediaType,"media-upload.php?referer=wonderplugin-carousel&type="+mediaType+"&TB_iframe=true",false);return false};window.send_to_editor=function(html){tb_remove();if(buttonId=="wonderplugin-dialog-select-image"){var $img=
$("img",html);if(!$img.length){$("#wonderplugin-dialog-error").css({display:"block"}).html("<p>Please select an image file</p>");return}var thumbnail=$img.attr("src");var src=$(html).is("a")?$(html).attr("href"):thumbnail;$("#wonderplugin-dialog-image-display-tr").css({display:"table-row"});$("#wonderplugin-dialog-image-display").attr("src",thumbnail);$("#wonderplugin-dialog-image").val(src);$("#wonderplugin-dialog-thumbnail").val(thumbnail);if($.trim($("#wonderplugin-dialog-image-title").val()).length<=
0)$("#wonderplugin-dialog-image-title").val($("img",html).attr("title"))}else if(buttonId=="wonderplugin-dialog-select-thumbnail"){var $img=$("img",html);if(!$img.length){$("#wonderplugin-dialog-error").css({display:"block"}).html("<p>Please select an image file</p>");return}var src=$(html).is("a")?$(html).attr("href"):$img.attr("src");$("#wonderplugin-dialog-thumbnail").val(src)}else{if($("img",html).length){$("#wonderplugin-dialog-error").css({display:"block"}).html("<p>Please select a video file</p>");
return}$("#"+textId).val($(html).attr("href"))}$("#wonderplugin-dialog-error").css({display:"none"}).empty()};$("#wonderplugin-dialog-select-image").click(history_media_upload_onclick);$("#wonderplugin-dialog-select-thumbnail").click(history_media_upload_onclick);if(dialogType==1){$("#wonderplugin-dialog-select-mp4").click(history_media_upload_onclick);$("#wonderplugin-dialog-select-webm").click(history_media_upload_onclick)}}else{$("#wonderplugin-dialog-select-image").click(media_upload_onclick);
$("#wonderplugin-dialog-select-thumbnail").click(media_upload_onclick);if(dialogType==1){$("#wonderplugin-dialog-select-mp4").click(media_upload_onclick);$("#wonderplugin-dialog-select-webm").click(media_upload_onclick)}}$("#wonderplugin-dialog-ok").click(function(){if($.trim($("#wonderplugin-dialog-image").val()).length<=0){$("#wonderplugin-dialog-error").css({display:"block"}).html("<p>Please select an image file</p>");return}if(dialogType==1&&$.trim($("#wonderplugin-dialog-mp4").val()).length<=
0){$("#wonderplugin-dialog-error").css({display:"block"}).html("<p>Please select a video file</p>");return}var item={image:$.trim($("#wonderplugin-dialog-image").val()),thumbnail:$.trim($("#wonderplugin-dialog-thumbnail").val()),displaythumbnail:$("#wonderplugin-dialog-displaythumbnail").is(":checked"),video:$.trim($("#wonderplugin-dialog-video").val()),mp4:$.trim($("#wonderplugin-dialog-mp4").val()),webm:$.trim($("#wonderplugin-dialog-webm").val()),title:$.trim($("#wonderplugin-dialog-image-title").val()),
description:$.trim($("#wonderplugin-dialog-image-description").val()),altusetitle:$("#wonderplugin-dialog-image-altusetitle").is(":checked"),alt:$.trim($("#wonderplugin-dialog-image-alt").val()),weblink:$.trim($("#wonderplugin-dialog-weblink").val()),clickhandler:$.trim($("#wonderplugin-dialog-clickhandler").val()),linktarget:$.trim($("#wonderplugin-dialog-linktarget").val()),weblinklightbox:$("#wonderplugin-dialog-weblinklightbox").is(":checked"),lightbox:$("#wonderplugin-dialog-lightbox").is(":checked"),
lightboxsize:$("#wonderplugin-dialog-lightbox-size").is(":checked"),lightboxwidth:parseInt($.trim($("#wonderplugin-dialog-lightbox-width").val())),lightboxheight:parseInt($.trim($("#wonderplugin-dialog-lightbox-height").val()))};$slideDialog.remove();onSuccess([item])});$("#wonderplugin-dialog-cancel").click(function(){$slideDialog.remove()})};var youtubePlaylistDialog=function(onSuccess,data,dataIndex){var dialogCode="<div class='wonderplugin-dialog-container'>"+"<div class='wonderplugin-dialog-bg'></div>"+
"<div class='wonderplugin-dialog'>"+"<h3 id='wonderplugin-dialog-title'>Add YouTube Playlist</h3>"+"<div class='error' id='wonderplugin-dialog-error' style='display:none;'></div>"+"<table id='wonderplugin-dialog-form'>"+"<tr>"+"<th>YouTube API key</th>"+"<td><input name='wonderplugin-dialog-youtubeapikey' type='text' id='wonderplugin-dialog-youtubeapikey' value='' class='regular-text' /></td>"+"</tr>"+"<tr>"+"<th>YouTube playlist ID</th>"+"<td><input name='wonderplugin-dialog-youtubeplaylistid' type='text' id='wonderplugin-dialog-youtubeplaylistid' value='' class='regular-text' /></td>"+
"</tr>"+"<tr>"+"<th>Maximum results</th>"+"<td><input name='wonderplugin-dialog-youtubeplaylistmaxresults' type='number' id='wonderplugin-dialog-youtubeplaylistmaxresults' value='50' class='small-text' /></td>"+"</tr>"+"<tr>"+"<th>Click to open Lightbox popup</th>"+"<td><label><input name='wonderplugin-dialog-lightbox' type='checkbox' id='wonderplugin-dialog-lightbox' value='' checked /> Open YouTube video in Lightbox</label>"+"</tr>"+"<tr><th>Lightbox size</th>"+"<td><label><input name='wonderplugin-dialog-lightbox-size' type='checkbox' id='wonderplugin-dialog-lightbox-size' value='' /> Set Lightbox size (px) </label>"+
" <input name='wonderplugin-dialog-lightbox-width' type='text' id='wonderplugin-dialog-lightbox-width' value='960' class='small-text' /> / <input name='wonderplugin-dialog-lightbox-height' type='text' id='wonderplugin-dialog-lightbox-height' value='540' class='small-text' />"+"</td>"+"</tr>"+"</table>"+"<p style='margin-left:12px;text-align:left;'><a href='https://www.wonderplugin.com/youtube-api-key-and-playlist-id/' target='_blank'>Tutorial: How to apply for a YouTube API key and how to find your YouTube playlist ID</a></p>"+
"<div class='wonderplugin-dialog-buttons'>"+"<input type='button' class='button button-primary' id='wonderplugin-dialog-ok' value='OK' />"+"<input type='button' class='button' id='wonderplugin-dialog-cancel' value='Cancel' />"+"</div>"+"</div>"+"</div>";var $playlistDialog=$(dialogCode);$("body").append($playlistDialog);$(".wonderplugin-dialog").css({"margin-top":String($(document).scrollTop()+60)+"px"});$(".wonderplugin-dialog-bg").css({height:$(document).height()+"px"});if(data){$("#wonderplugin-dialog-youtubeapikey").val(data.youtubeapikey);
$("#wonderplugin-dialog-youtubeplaylistid").val(data.youtubeplaylistid);$("#wonderplugin-dialog-youtubeplaylistmaxresults").val(data.youtubeplaylistmaxresults);if("lightbox"in data)$("#wonderplugin-dialog-lightbox").attr("checked",data.lightbox);if("lightboxsize"in data)$("#wonderplugin-dialog-lightbox-size").attr("checked",data.lightboxsize);if(data.lightboxwidth)$("#wonderplugin-dialog-lightbox-width").val(data.lightboxwidth);if(data.lightboxheight)$("#wonderplugin-dialog-lightbox-height").val(data.lightboxheight)}$("#wonderplugin-dialog-ok").click(function(){if($.trim($("#wonderplugin-dialog-youtubeapikey").val()).length<=
0){$("#wonderplugin-dialog-error").css({display:"block"}).html("<p>Please enter your YouTube API key</p>");$("#wonderplugin-dialog-youtubeapikey").focus();return}if($.trim($("#wonderplugin-dialog-youtubeplaylistid").val()).length<=0){$("#wonderplugin-dialog-error").css({display:"block"}).html("<p>Please enter your YouTube playlist ID</p>");$("#wonderplugin-dialog-youtubeplaylistid").focus();return}var item={youtubeapikey:$.trim($("#wonderplugin-dialog-youtubeapikey").val()),youtubeplaylistid:$.trim($("#wonderplugin-dialog-youtubeplaylistid").val()),
youtubeplaylistmaxresults:$.trim($("#wonderplugin-dialog-youtubeplaylistmaxresults").val()),lightbox:$("#wonderplugin-dialog-lightbox").is(":checked"),lightboxsize:$("#wonderplugin-dialog-lightbox-size").is(":checked"),lightboxwidth:parseInt($.trim($("#wonderplugin-dialog-lightbox-width").val())),lightboxheight:parseInt($.trim($("#wonderplugin-dialog-lightbox-height").val())),displaythumbnail:false,mp4:"",webm:"",weblink:"",clickhandler:"",linktarget:"",weblinklightbox:false};$playlistDialog.remove();
onSuccess([item])});$("#wonderplugin-dialog-cancel").click(function(){$playlistDialog.remove()})};var onlineVideoDialog=function(dialogType,onSuccess,videoData,invokeFromSlideDialog,dataIndex){var dialogTitle=["Image","Video","Youtube Video","Vimeo Video"];var dialogExample=["","","https://www.youtube.com/watch?v=wswxQ3mhwqQ","https://vimeo.com/1084537"];var dialogCode="<div class='wonderplugin-dialog-container'>"+"<div class='wonderplugin-dialog-bg'></div>"+"<div class='wonderplugin-dialog'>"+"<h3 id='wonderplugin-dialog-title'></h3>"+
"<div class='error' id='wonderplugin-dialog-error' style='display:none;'></div>"+"<table id='wonderplugin-dialog-form'>"+"<tr>"+"<th>Enter "+dialogTitle[dialogType]+" URL</th>"+"<td><input name='wonderplugin-dialog-video' type='text' id='wonderplugin-dialog-video' value='' class='regular-text' />"+"<p>URL Example: "+dialogExample[dialogType]+"<p>"+"</td>"+"</tr>";dialogCode+="</table>"+"<div id='wonderplugin-carousel-video-dialog-loading'></div>"+"<div class='wonderplugin-dialog-buttons'>"+"<input type='button' class='button button-primary' id='wonderplugin-dialog-ok' value='OK' />"+
"<input type='button' class='button' id='wonderplugin-dialog-cancel' value='Cancel' />"+"</div>"+"</div>"+"</div>";var $videoDialog=$(dialogCode);$("body").append($videoDialog);$(".wonderplugin-dialog").css({"margin-top":String($(document).scrollTop()+60)+"px"});$(".wonderplugin-dialog-bg").css({height:$(document).height()+"px"});if(!videoData)videoData={type:dialogType};$("#wonderplugin-dialog-title").html("Add "+dialogTitle[dialogType]);var videoDataReturn=function(){$videoDialog.remove();slideDialog(dialogType,
function(items){if(items&&items.length>0){if(typeof dataIndex!=="undefined"&&dataIndex>=0)wonderplugin_carousel_config.slides.splice(dataIndex,1);items.map(function(data){var result={type:dialogType,image:data.image,thumbnail:data.thumbnail?data.thumbnail:data.image,displaythumbnail:data.displaythumbnail,video:data.video,mp4:data.mp4,webm:data.webm,title:data.title,description:data.description,altusetitle:data.altusetitle,alt:data.alt,weblink:data.weblink,clickhandler:data.clickhandler,linktarget:data.linktarget,
weblinklightbox:data.weblinklightbox,lightbox:data.lightbox,lightboxsize:data.lightboxsize,lightboxwidth:data.lightboxwidth,lightboxheight:data.lightboxheight};if(typeof dataIndex!=="undefined"&&dataIndex>=0)wonderplugin_carousel_config.slides.splice(dataIndex,0,result);else addMediaToList(result)});updateMediaTable()}},videoData,dataIndex)};$("#wonderplugin-dialog-ok").click(function(){var href=$.trim($("#wonderplugin-dialog-video").val());if(href.length<=0){$("#wonderplugin-dialog-error").css({display:"block"}).html("<p>Please enter a "+
dialogTitle[dialogType]+" URL</p>");return}var protocol="https:";if(dialogType==2){var youtubeId="";var regExp=/^.*((youtu.be\/)|(v\/)|(\/u\/\w\/)|(embed\/)|(watch\?))\??v?=?([^#\&\?]*).*/;var match=href.match(regExp);if(match&&match[7]&&match[7].length==11)youtubeId=match[7];else{$("#wonderplugin-dialog-error").css({display:"block"}).html("<p>Please enter a valid Youtube URL</p>");return}var result=protocol+"//www.youtube.com/embed/"+youtubeId;var params=getURLParams(href);var first=true;for(var key in params){if(first){result+=
"?";first=false}else result+="&";result+=key+"="+params[key]}videoData.video=result;videoData.image=protocol+"//img.youtube.com/vi/"+youtubeId+"/0.jpg";videoData.thumbnail=protocol+"//img.youtube.com/vi/"+youtubeId+"/1.jpg";videoDataReturn()}else if(dialogType==3){var vimeoId="";var regExp=/^.*(vimeo\.com\/)((video\/)|(channels\/[A-z]+\/)|(groups\/[A-z]+\/videos\/))?([0-9]+)/;var match=href.match(regExp);if(match&&match[6])vimeoId=match[6];else{$("#wonderplugin-dialog-error").css({display:"block"}).html("<p>Please enter a valid Vimeo URL</p>");
return}var result=protocol+"//player.vimeo.com/video/"+vimeoId;var params=getURLParams(href);var first=true;for(var key in params){if(first){result+="?";first=false}else result+="&";result+=key+"="+params[key]}videoData.video=result;$("#wonderplugin-carousel-video-dialog-loading").css({display:"block"});$.ajax({url:protocol+"//www.vimeo.com/api/v2/video/"+vimeoId+".json?callback=?",dataType:"json",timeout:3E3,data:{format:"json"},success:function(data){videoData.image=data[0].thumbnail_large;videoData.thumbnail=
data[0].thumbnail_medium;videoDataReturn()},error:function(){videoDataReturn()}})}});$("#wonderplugin-dialog-cancel").click(function(){$videoDialog.remove();if(invokeFromSlideDialog)videoDataReturn()})};var updateMediaTable=function(){var mediaType=["Image","Video","YouTube","Vimeo","","","WordPress Posts","WooCommerce / Custom Posts","","","YouTube Playlist"];$("#wonderplugin-carousel-media-table").empty();for(var i=0;i<wonderplugin_carousel_config.slides.length;i++){var thumbnail="";if(wonderplugin_carousel_config.slides[i].type==
6)thumbnail=$("#wonderplugin-carousel-pluginfolder").text()+"images/wordpressposts.png";else if(wonderplugin_carousel_config.slides[i].type==7)thumbnail=$("#wonderplugin-carousel-pluginfolder").text()+"images/wordpresscustompost.png";else if(wonderplugin_carousel_config.slides[i].type==10)thumbnail=$("#wonderplugin-carousel-pluginfolder").text()+"images/youtubeplaylist.png";else thumbnail=wonderplugin_carousel_config.slides[i].thumbnail;$("#wonderplugin-carousel-media-table").append("<li>"+"<div class='wonderplugin-carousel-media-table-id'>"+
(i+1)+"</div>"+"<div class='wonderplugin-carousel-media-table-img'>"+"<img class='wonderplugin-carousel-media-table-image' data-order='"+i+"' src='"+thumbnail+"' />"+"</div>"+"<div class='wonderplugin-carousel-media-table-type'>"+mediaType[wonderplugin_carousel_config.slides[i].type]+"</div>"+"<div class='wonderplugin-carousel-media-table-buttons-edit'>"+"<a class='wonderplugin-carousel-media-table-button wonderplugin-carousel-media-table-edit'>Edit</a>&nbsp;|&nbsp;"+"<a class='wonderplugin-carousel-media-table-button wonderplugin-carousel-media-table-delete'>Delete</a>"+
"</div>"+"<div class='wonderplugin-carousel-media-table-buttons-move'>"+"<a class='wonderplugin-carousel-media-table-button wonderplugin-carousel-media-table-moveup'>Move Up</a>&nbsp;|&nbsp;"+"<a class='wonderplugin-carousel-media-table-button wonderplugin-carousel-media-table-movedown'>Move Down</a>"+"</div>"+"<div style='clear:both;'></div>"+"</li>")}$(".wonderplugin-carousel-media-table-image").wpdraggable(wonderPluginMediaTableMove)};$("#wonderplugin-add-image").click(function(){slideDialog(0,
function(items){items.map(function(data){addMediaToList({type:0,image:data.image,thumbnail:data.thumbnail?data.thumbnail:data.image,displaythumbnail:data.displaythumbnail,video:data.video,mp4:data.mp4,webm:data.webm,title:data.title,description:data.description,altusetitle:data.altusetitle,alt:data.alt,weblink:data.weblink,clickhandler:data.clickhandler,linktarget:data.linktarget,weblinklightbox:data.weblinklightbox,lightbox:data.lightbox,lightboxsize:data.lightboxsize,lightboxwidth:data.lightboxwidth,
lightboxheight:data.lightboxheight})});updateMediaTable()})});$("#wonderplugin-add-video").click(function(){slideDialog(1,function(items){items.map(function(data){addMediaToList({type:1,image:data.image,thumbnail:data.thumbnail?data.thumbnail:data.image,displaythumbnail:data.displaythumbnail,video:data.video,mp4:data.mp4,webm:data.webm,title:data.title,description:data.description,altusetitle:data.altusetitle,alt:data.alt,weblink:data.weblink,clickhandler:data.clickhandler,linktarget:data.linktarget,
weblinklightbox:data.weblinklightbox,lightbox:data.lightbox,lightboxsize:data.lightboxsize,lightboxwidth:data.lightboxwidth,lightboxheight:data.lightboxheight})});updateMediaTable()})});$("#wonderplugin-add-youtube").click(function(){onlineVideoDialog(2,function(items){items.map(function(data){addMediaToList({type:2,image:data.image,thumbnail:data.thumbnail?data.thumbnail:data.image,displaythumbnail:data.displaythumbnail,video:data.video,mp4:data.mp4,webm:data.webm,title:data.title,description:data.description,
altusetitle:data.altusetitle,alt:data.alt,weblink:data.weblink,clickhandler:data.clickhandler,linktarget:data.linktarget,weblinklightbox:data.weblinklightbox,lightbox:data.lightbox,lightboxsize:data.lightboxsize,lightboxwidth:data.lightboxwidth,lightboxheight:data.lightboxheight})});updateMediaTable()})});$("#wonderplugin-add-vimeo").click(function(){onlineVideoDialog(3,function(items){items.map(function(data){addMediaToList({type:3,image:data.image,thumbnail:data.thumbnail?data.thumbnail:data.image,
displaythumbnail:data.displaythumbnail,video:data.video,mp4:data.mp4,webm:data.webm,title:data.title,description:data.description,altusetitle:data.altusetitle,alt:data.alt,weblink:data.weblink,clickhandler:data.clickhandler,linktarget:data.linktarget,weblinklightbox:data.weblinklightbox,lightbox:data.lightbox,lightboxsize:data.lightboxsize,lightboxwidth:data.lightboxwidth,lightboxheight:data.lightboxheight})});updateMediaTable()})});$("#wonderplugin-add-youtube-playlist").click(function(){youtubePlaylistDialog(function(items){items.map(function(data){addMediaToList({type:10,
youtubeapikey:data.youtubeapikey,youtubeplaylistid:data.youtubeplaylistid,youtubeplaylistmaxresults:data.youtubeplaylistmaxresults,lightbox:data.lightbox,lightboxsize:data.lightboxsize,lightboxwidth:data.lightboxwidth,lightboxheight:data.lightboxheight,displaythumbnail:false,mp4:"",webm:"",weblink:"",clickhandler:"",linktarget:"",weblinklightbox:false})});updateMediaTable()})});var addPostsDialog=function(dialogType,onSuccess,data,dataIndex){var dialogCode="<div class='wonderplugin-dialog-container'>"+
"<div class='wonderplugin-dialog-bg'></div>"+"<div class='wonderplugin-dialog'>"+"<h3 id='wonderplugin-dialog-title'>Add Posts</h3>"+"<div class='error' id='wonderplugin-dialog-error' style='display:none;'></div>"+"<table id='wonderplugin-dialog-form'>"+"<tr>"+"<th>Select Posts</th><td><select name='wonderplugin-dialog-postcategory' id='wonderplugin-dialog-postcategory'>";var catlist=$.parseJSON($("#wonderplugin-carousel-catlist").text());dialogCode+="<option value='-1'>Recent Posts</option>";for(var key in catlist)dialogCode+=
"<option value='"+catlist[key].ID+"'>Category: "+catlist[key].cat_name+"</option>";dialogCode+="</select></td></tr>";dialogCode+="<tr><th>Maximum Posts</th><td><input style='vertical-align:middle;' name='wonderplugin-dialog-postnumber' id='wonderplugin-dialog-postnumber' type='number' value='10' class='small-text' /><select name='wonderplugin-dialog-postorder' id='wonderplugin-dialog-postorder'><option value='DESC'>Descending</option><option value='ASC'>Ascending</option></select></td></tr>";dialogCode+=
"<tr><th>Date Range</th><td><label><input name='wonderplugin-dialog-postdaterange' type='checkbox' id='wonderplugin-dialog-postdaterange' /> Only get posts from the past <input name='wonderplugin-dialog-postdaterangeafter' id='wonderplugin-dialog-postdaterangeafter' type='number' value='30' class='small-text' /> days</label></td></tr>";dialogCode+="<tr><th>Featured Image Size</th><td><select name='wonderplugin-dialog-featuredimagesize' id='wonderplugin-dialog-featuredimagesize'><option value='thumbnail'>Thumbnail</option><option value='medium'>Medium</option><option value='large'>Large</option><option value='full'>Full</option></select></td>";
dialogCode+="<tr><th>Maximum Excerpt Word Length</th><td><input name='wonderplugin-dialog-excerptlength' id='wonderplugin-dialog-excerptlength' type='number' value='55' class='small-text' /></td></tr>";dialogCode+="<tr><th>When clicking on the image</th><td><label><input type='radio' name='wonderplugin-dialog-postlightbox' value='1' >Open the featured image in lightbox</label><label style='margin-left:24px;'><input name='wonderplugin-dialog-postlightbox-size' type='checkbox' id='wonderplugin-dialog-postlightbox-size' value='' /> Set Lightbox size </label><input name='wonderplugin-dialog-postlightbox-width' type='number' id='wonderplugin-dialog-postlightbox-width' value='960' class='small-text' /> / <input name='wonderplugin-dialog-postlightbox-height' type='number' id='wonderplugin-dialog-postlightbox-height' value='540' class='small-text' /><br>";
dialogCode+="<label><input type='radio' name='wonderplugin-dialog-postlightbox' value='0' checked>Open the post page</label></td>";dialogCode+="<tr><th>Link Target</th><td><div class='select-editable'><select onchange='this.nextElementSibling.value=this.value'><option value=''></option><option value='_blank'>_blank</option><option value='_self'>_self</option><option value='_parent'>_parent</option><option value='_top'>_top</option></select><input type='text' name='wonderplugin-dialog-postlinktarget' id='wonderplugin-dialog-postlinktarget' value='' /></div></td></tr>";
dialogCode+="<tr><th>Title</th><td><label><input name='wonderplugin-dialog-titlelink' type='checkbox' id='wonderplugin-dialog-titlelink' value='' /> Link title to the post page</label></td></tr>";dialogCode+="</table>"+"<ul style='margin-left:24px;list-style-position:outside;list-style-type:square;text-align:left;'><li>The featured image of a post will be used as the image of the carousel item. For how to define featured images for posts, please view <a href='https://codex.wordpress.org/Post_Thumbnails' target='_blank'>WordPress Featured Images</a>.</li>"+
"<li>The title of a post will be used as the title property of the carousel item.</li>"+"<li>The excerpt of a post will be used as the description property of the carousel item. For how to add excerpts for posts, please view <a href='https://codex.wordpress.org/Excerpt' target='_blank'>WordPress Excerpts</a>.</li></ul>"+"<div class='wonderplugin-dialog-buttons'>"+"<input type='button' class='button button-primary' id='wonderplugin-dialog-ok' value='OK' />"+"<input type='button' class='button' id='wonderplugin-dialog-cancel' value='Cancel' />"+
"</div>"+"</div>"+"</div>";var $postsDialog=$(dialogCode);$("body").append($postsDialog);$(".wonderplugin-dialog").css({"margin-top":String($(document).scrollTop()+60)+"px"});$(".wonderplugin-dialog-bg").css({height:$(document).height()+"px"});if(data){$("#wonderplugin-dialog-postcategory").val(data.postcategory);$("#wonderplugin-dialog-postorder").val(data.postorder);$("#wonderplugin-dialog-postdaterange").attr("checked",data.postdaterange);$("#wonderplugin-dialog-postdaterangeafter").val(data.postdaterangeafter);
$("#wonderplugin-dialog-postnumber").val(data.postnumber);$("#wonderplugin-dialog-featuredimagesize").val(data.featuredimagesize);$("#wonderplugin-dialog-excerptlength").val(data.excerptlength);$("#wonderplugin-dialog-postlinktarget").val(data.postlinktarget);if("postlightbox"in data){$("input[name=wonderplugin-dialog-postlightbox][value="+(data.postlightbox?1:0)+"]").attr("checked",true);$("#wonderplugin-dialog-postlightbox-size").attr("checked",data.postlightboxsize);$("#wonderplugin-dialog-postlightbox-width").val(data.postlightboxwidth);
$("#wonderplugin-dialog-postlightbox-height").val(data.postlightboxheight);$("#wonderplugin-dialog-titlelink").attr("checked",data.posttitlelink)}}$("#wonderplugin-dialog-ok").click(function(){var item={type:dialogType,postcategory:$("#wonderplugin-dialog-postcategory").val(),postorder:$("#wonderplugin-dialog-postorder").val(),postdaterange:$("#wonderplugin-dialog-postdaterange").is(":checked"),postdaterangeafter:$("#wonderplugin-dialog-postdaterangeafter").val(),postnumber:$("#wonderplugin-dialog-postnumber").val(),
featuredimagesize:$("#wonderplugin-dialog-featuredimagesize").val(),excerptlength:$("#wonderplugin-dialog-excerptlength").val(),postlinktarget:$("#wonderplugin-dialog-postlinktarget").val(),postlightbox:$("input[name=wonderplugin-dialog-postlightbox]:checked").val()==1?true:false,postlightboxsize:$("#wonderplugin-dialog-postlightbox-size").is(":checked"),postlightboxwidth:parseInt($.trim($("#wonderplugin-dialog-postlightbox-width").val())),postlightboxheight:parseInt($.trim($("#wonderplugin-dialog-postlightbox-height").val())),
posttitlelink:$("#wonderplugin-dialog-titlelink").is(":checked")};$postsDialog.remove();onSuccess(item)});$("#wonderplugin-dialog-cancel").click(function(){$postsDialog.remove()})};$("#wonderplugin-add-posts").click(function(){addPostsDialog(6,function(data){addMediaToList(data);updateMediaTable()})});var addCustomPostDialog=function(dialogType,onSuccess,data,dataIndex){var custompostlist=$.parseJSON($("#wonderplugin-carousel-custompostlist").text());var dialogCode="<div class='wonderplugin-dialog-container'>"+
"<div class='wonderplugin-dialog-bg'></div>"+"<div class='wonderplugin-dialog wonderplugin-dialog-large'>"+"<h3 id='wonderplugin-dialog-title'>Add WooCommerce / Custom Posts</h3>"+"<div class='error' id='wonderplugin-dialog-error' style='display:none;'></div>"+"<table id='wonderplugin-dialog-form' class='longhead'>";dialogCode+="<tr><th>Select Custom Post Type</th><td><select name='wonderplugin-dialog-customposttype' id='wonderplugin-dialog-customposttype'>";dialogCode+="<option value='-1'>Select A Custom Post Type</option>";
for(var i=0;i<custompostlist.length;i++)dialogCode+="<option value='"+custompostlist[i].name+"'>Custom Post Type: "+custompostlist[i].name+"</option>";dialogCode+="</select></td></tr>";dialogCode+="<tr><th>Query by Taxonomy and Terms</th><td><div id='wonderplugin-dialog-taxonomy-container' data-taxonomytotal=1><div class='wonderplugin-dialog-taxonomy-row wonderplugin-dialog-taxonomy-row-first' ><select class='wonderplugin-dialog-taxonomy'>";dialogCode+="<option value='-1'>Select A Taxonomy</option>";
dialogCode+="</select>";dialogCode+="<select class='wonderplugin-dialog-term'>";dialogCode+="<option value='-1'>Select A Term</option>";dialogCode+="</select><span class='dashicons dashicons-plus-alt wonderplugin-dialog-addtaxonomy'></span></div></div></td></tr>";dialogCode+="<tr class='wonderplugin-dialog-taxonomyrelation-container' style='display:none;'><th>Multiple taxonomy logical relationship</th><td><select name='wonderplugin-dialog-taxonomyrelation' id='wonderplugin-dialog-taxonomyrelation'><option value='OR'>OR</option><option value='AND'>AND</option></select></td></tr>";
dialogCode+="<tr><th></th><td><a href='https://www.wonderplugin.com/wordpress-carousel-plugin/how-to-create-a-woocommerce-product-carousel/' target='_blank'>Tutorial: How to create a WooCommerce product carousel</a></td>";dialogCode+="<tr><th>Query by WooCommerce Meta</th><td>";dialogCode+="<p><label><input name='wonderplugin-dialog-metatotalsales' type='checkbox' id='wonderplugin-dialog-metatotalsales' /> WooCommerce best selling products</label>";dialogCode+="<label style='margin-left:24px;'><input name='wonderplugin-dialog-metafeatured' type='checkbox' id='wonderplugin-dialog-metafeatured' /> WooCommerce featured products</label></p>";
dialogCode+="</td></tr>";dialogCode+="<tr class='wonderplugin-dialog-metarelation-container' style='display:none;'><th>Meta Keys Logical Relationship</th><td><select name='wonderplugin-dialog-metarelation' id='wonderplugin-dialog-metarelation'><option value='OR'>OR</option><option value='AND'>AND</option></select></td></tr>";dialogCode+="<tr><th>Maximum Posts</th><td><input style='vertical-align:middle;' name='wonderplugin-dialog-postnumber' id='wonderplugin-dialog-postnumber' type='number' value='10' class='small-text' /><select name='wonderplugin-dialog-postorder' id='wonderplugin-dialog-postorder'><option value='DESC'>Descending</option><option value='ASC'>Ascending</option></select></td></tr>";
dialogCode+="<tr><th>Date Range</th><td><label><input name='wonderplugin-dialog-postdaterange' type='checkbox' id='wonderplugin-dialog-postdaterange' /> Only get posts from the past <input name='wonderplugin-dialog-postdaterangeafter' id='wonderplugin-dialog-postdaterangeafter' type='number' value='30' class='small-text' /> days</label></td></tr>";dialogCode+="<tr><th>Field for Title</th><td><input style='vertical-align:middle;' name='wonderplugin-dialog-titlefield' id='wonderplugin-dialog-titlefield' type='text' class='large-text' value='%post_title%' /></td></tr>";
dialogCode+="<tr><th>Field for Description</th><td><textarea name='wonderplugin-dialog-descriptionfield' id='wonderplugin-dialog-descriptionfield' type='text' class='large-text'>%post_content%</textarea></td></tr>";dialogCode+="<tr><th>Maximum Post Content/Excerpt Word Length</th><td><input name='wonderplugin-dialog-textlength' id='wonderplugin-dialog-textlength' type='number' value='55' class='small-text' />";dialogCode+="<label style='margin-left:24px;'><input name='wonderplugin-dialog-titlelink' type='checkbox' id='wonderplugin-dialog-titlelink' value='' /> Link title to the post page</label></td></tr>";
dialogCode+="<tr><th>Field for Image</th><td><input style='vertical-align:middle;' name='wonderplugin-dialog-imagefield' id='wonderplugin-dialog-imagefield' type='text' class='large-text' value='%featured_image%' />";dialogCode+="<tr><th>Image options</th><td><label><input name='wonderplugin-dialog-imageaction' type='checkbox' id='wonderplugin-dialog-imageaction' checked /> Open the post page or image lightbox on clicking the image</label>";dialogCode+="<div style='margin-left:20px;margin-top:8px;'><label><input type='radio' name='wonderplugin-dialog-imageactionlightbox' value='1' >Open the image in lightbox</label><br>";
dialogCode+="<label><input type='radio' name='wonderplugin-dialog-imageactionlightbox' value='0' checked>Click to open the post page</label><label style='margin-left:24px;'><input name='wonderplugin-dialog-openpostinlightbox' type='checkbox' id='wonderplugin-dialog-openpostinlightbox' value='' /> Open in lightbox</label></div></td>";dialogCode+="<tr><th></th><td><label><input name='wonderplugin-dialog-postlightboxsize' type='checkbox' id='wonderplugin-dialog-postlightboxsize' value='' /> Set Lightbox size </label><input name='wonderplugin-dialog-postlightboxwidth' type='number' id='wonderplugin-dialog-postlightboxwidth' value='960' class='small-text' /> / <input name='wonderplugin-dialog-postlightboxheight' type='number' id='wonderplugin-dialog-postlightboxheight' value='540' class='small-text' /></td></tr>";
dialogCode+="<tr><th>Link Target</th><td><div class='select-editable'><select onchange='this.nextElementSibling.value=this.value'><option value=''></option><option value='_blank'>_blank</option><option value='_self'>_self</option><option value='_parent'>_parent</option><option value='_top'>_top</option></select><input type='text' name='wonderplugin-dialog-postlinktarget' id='wonderplugin-dialog-postlinktarget' value='' /></div></td></tr>";dialogCode+="</table>"+"<div class='wonderplugin-dialog-buttons'>"+
"<input type='button' class='button button-primary' id='wonderplugin-dialog-ok' value='OK' />"+"<input type='button' class='button' id='wonderplugin-dialog-cancel' value='Cancel' />"+"</div>"+"</div>"+"</div>";var $postsDialog=$(dialogCode);$("body").append($postsDialog);$(".wonderplugin-dialog").css({"margin-top":String($(document).scrollTop()+60)+"px"});$(".wonderplugin-dialog-bg").css({height:$(document).height()+"px"});var onCustomPostTypeChange=function(customposttype){$(".wonderplugin-dialog-taxonomy").empty().append('<option value="-1">Select A Taxonomy</option>').val("-1");
$(".wonderplugin-dialog-term").empty().append('<option value="-1">Select A Term</option>').val("-1");if(customposttype!="-1")for(var i=0;i<custompostlist.length;i++)if(customposttype==custompostlist[i].name){if(custompostlist[i].taxonomies)for(var j=0;j<custompostlist[i].taxonomies.length;j++)$(".wonderplugin-dialog-taxonomy").append('<option value="'+custompostlist[i].taxonomies[j].name+'">Taxonomy: '+custompostlist[i].taxonomies[j].name+"</option>");break}};var onTaxonomyChange=function(taxonomyid,
customposttype,taxonomy){var termElem=$(".wonderplugin-dialog-taxonomy-row").eq(taxonomyid).find(".wonderplugin-dialog-term");if(!termElem)return;termElem.empty().append('<option value="-1">Select A Term</option>').val("-1");if(customposttype!="-1"&&taxonomy!="-1")for(var i=0;i<custompostlist.length;i++)if(customposttype==custompostlist[i].name){if(custompostlist[i].taxonomies)for(var j=0;j<custompostlist[i].taxonomies.length;j++)if(taxonomy==custompostlist[i].taxonomies[j].name){if(custompostlist[i].taxonomies[j].terms)for(var k=
0;k<custompostlist[i].taxonomies[j].terms.length;k++)termElem.append('<option value="'+custompostlist[i].taxonomies[j].terms[k].slug+'">Term: '+custompostlist[i].taxonomies[j].terms[k].slug+"</option>");break}break}};$("#wonderplugin-dialog-taxonomy-container").on("click",".wonderplugin-dialog-addtaxonomy",function(){var total=$("#wonderplugin-dialog-taxonomy-container").data("taxonomytotal");var taxonomyCode=$("<div class='wonderplugin-dialog-taxonomy-row' ></div>");var taxonomySelect=$(".wonderplugin-dialog-taxonomy-row-first .wonderplugin-dialog-taxonomy").clone().val("-1");
var termSelect=$(".wonderplugin-dialog-taxonomy-row-first .wonderplugin-dialog-term").clone().val("-1");var removeTaxonomy="<span class='dashicons dashicons-dismiss wonderplugin-dialog-removetaxonomy'></span>";taxonomyCode.append(taxonomySelect).append(termSelect).append(removeTaxonomy);$("#wonderplugin-dialog-taxonomy-container").append(taxonomyCode);$("#wonderplugin-dialog-taxonomy-container").data("taxonomytotal",total+1);$(".wonderplugin-dialog-taxonomyrelation-container").css({"display":total>
0?"table-row":"none"})});$("#wonderplugin-dialog-taxonomy-container").on("click",".wonderplugin-dialog-removetaxonomy",function(){$(this).closest(".wonderplugin-dialog-taxonomy-row").remove();var total=$("#wonderplugin-dialog-taxonomy-container").data("taxonomytotal");$("#wonderplugin-dialog-taxonomy-container").data("taxonomytotal",total-1);$(".wonderplugin-dialog-taxonomyrelation-container").css({"display":total>2?"table-row":"none"})});$("#wonderplugin-dialog-customposttype").on("change",function(){onCustomPostTypeChange($(this).val())});
$("#wonderplugin-dialog-taxonomy-container").on("change",".wonderplugin-dialog-taxonomy",function(){var taxonomyid=$(this).closest(".wonderplugin-dialog-taxonomy-row").index();onTaxonomyChange(taxonomyid,$("#wonderplugin-dialog-customposttype").val(),$(this).val())});$("#wonderplugin-dialog-metatotalsales,#wonderplugin-dialog-metafeatured").on("click",function(){if($("#wonderplugin-dialog-metatotalsales").is(":checked")&&$("#wonderplugin-dialog-metafeatured").is(":checked"))$(".wonderplugin-dialog-metarelation-container").css({display:"table-row"});
else $(".wonderplugin-dialog-metarelation-container").css({display:"none"})});if(data){$("#wonderplugin-dialog-customposttype").val(data.customposttype);var total=1;for(total=1;;total++)if("taxonomy"+total in data&&"term"+total in data){$("#wonderplugin-dialog-taxonomy-container").data("taxonomytotal",total+1);var taxonomyCode=$("<div class='wonderplugin-dialog-taxonomy-row' ></div>");var taxonomySelect=$(".wonderplugin-dialog-taxonomy-row-first .wonderplugin-dialog-taxonomy").clone().val("-1");var termSelect=
$(".wonderplugin-dialog-taxonomy-row-first .wonderplugin-dialog-term").clone().val("-1");var removeTaxonomy="<span class='dashicons dashicons-dismiss wonderplugin-dialog-removetaxonomy'></span>";taxonomyCode.append(taxonomySelect).append(termSelect).append(removeTaxonomy);$("#wonderplugin-dialog-taxonomy-container").append(taxonomyCode)}else break;$(".wonderplugin-dialog-taxonomyrelation-container").css({"display":total>1?"table-row":"none"});if(data.customposttype!="-1"){onCustomPostTypeChange(data.customposttype);
for(var i=0;i<total;i++){$(".wonderplugin-dialog-taxonomy-row").eq(i).find(".wonderplugin-dialog-taxonomy").val(data["taxonomy"+i]);onTaxonomyChange(i,data.customposttype,data["taxonomy"+i]);if(data["taxonomy"+i]!="-1")$(".wonderplugin-dialog-taxonomy-row").eq(i).find(".wonderplugin-dialog-term").val(data["term"+i])}}$("#wonderplugin-dialog-taxonomyrelation").val(data.taxonomyrelation);$("#wonderplugin-dialog-metatotalsales").attr("checked",data.metatotalsales);$("#wonderplugin-dialog-metafeatured").attr("checked",
data.metafeatured);$("#wonderplugin-dialog-metarelation").val(data.metarelation);if(data.metatotalsales&&data.metafeatured)$(".wonderplugin-dialog-metarelation-container").css({display:"table-row"});else $(".wonderplugin-dialog-metarelation-container").css({display:"none"});$("#wonderplugin-dialog-postnumber").val(data.postnumber);$("#wonderplugin-dialog-postorder").val(data.postorder);$("#wonderplugin-dialog-postdaterange").attr("checked",data.postdaterange);$("#wonderplugin-dialog-postdaterangeafter").val(data.postdaterangeafter);
$("#wonderplugin-dialog-titlefield").val(data.titlefield);$("#wonderplugin-dialog-descriptionfield").val(data.descriptionfield);$("#wonderplugin-dialog-textlength").val(data.textlength);$("#wonderplugin-dialog-titlelink").attr("checked",data.titlelink);$("#wonderplugin-dialog-imagefield").val(data.imagefield);$("#wonderplugin-dialog-imageaction").attr("checked",data.imageaction);$("input[name=wonderplugin-dialog-imageactionlightbox][value="+(data.imageactionlightbox?1:0)+"]").attr("checked",true);
$("#wonderplugin-dialog-openpostinlightbox").attr("checked",data.openpostinlightbox);$("#wonderplugin-dialog-postlightboxsize").attr("checked",data.postlightboxsize);$("#wonderplugin-dialog-postlightboxwidth").val(data.postlightboxwidth);$("#wonderplugin-dialog-postlightboxheight").val(data.postlightboxheight);$("#wonderplugin-dialog-postlinktarget").val(data.postlinktarget)}$("#wonderplugin-dialog-ok").click(function(){if($("#wonderplugin-dialog-customposttype").val()=="-1"){$("#wonderplugin-dialog-error").css({display:"block"}).html("<p>Please select a custom post type</p>");
return}var item={type:dialogType,customposttype:$("#wonderplugin-dialog-customposttype").val(),taxonomyrelation:$("#wonderplugin-dialog-taxonomyrelation").val(),metatotalsales:$("#wonderplugin-dialog-metatotalsales").is(":checked"),metafeatured:$("#wonderplugin-dialog-metafeatured").is(":checked"),metarelation:$("#wonderplugin-dialog-metarelation").val(),postnumber:$("#wonderplugin-dialog-postnumber").val(),postorder:$("#wonderplugin-dialog-postorder").val(),postdaterange:$("#wonderplugin-dialog-postdaterange").is(":checked"),
postdaterangeafter:$("#wonderplugin-dialog-postdaterangeafter").val(),titlefield:$("#wonderplugin-dialog-titlefield").val(),descriptionfield:$("#wonderplugin-dialog-descriptionfield").val(),textlength:parseInt($.trim($("#wonderplugin-dialog-textlength").val())),titlelink:$("#wonderplugin-dialog-titlelink").is(":checked"),imagefield:$("#wonderplugin-dialog-imagefield").val(),imageaction:$("#wonderplugin-dialog-imageaction").is(":checked"),imageactionlightbox:$("input[name=wonderplugin-dialog-imageactionlightbox]:checked").val()==
1?true:false,openpostinlightbox:$("#wonderplugin-dialog-openpostinlightbox").is(":checked"),postlightboxsize:$("#wonderplugin-dialog-postlightboxsize").is(":checked"),postlightboxwidth:parseInt($.trim($("#wonderplugin-dialog-postlightboxwidth").val())),postlightboxheight:parseInt($.trim($("#wonderplugin-dialog-postlightboxheight").val())),postlinktarget:$.trim($("#wonderplugin-dialog-postlinktarget").val())};for(var i=0;i<$(".wonderplugin-dialog-taxonomy-row").length;i++){item["taxonomy"+i]=$(".wonderplugin-dialog-taxonomy-row").eq(i).find(".wonderplugin-dialog-taxonomy").val();
item["term"+i]=$(".wonderplugin-dialog-taxonomy-row").eq(i).find(".wonderplugin-dialog-term").val()}$postsDialog.remove();onSuccess(item)});$("#wonderplugin-dialog-cancel").click(function(){$postsDialog.remove()})};$("#wonderplugin-add-custompost").click(function(){addCustomPostDialog(7,function(data){addMediaToList(data);updateMediaTable()})});$("#wonderplugin-reverselist").click(function(){wonderplugin_carousel_config.slides.reverse();updateMediaTable()});$("#wonderplugin-deleteall").click(function(){$("<div></div>").html("Are you sure to remove all items?").dialog({title:"WonderPlugin Carousel",
resizable:false,modal:true,buttons:{"Yes":function(){$(this).dialog("close");wonderplugin_carousel_config.slides.length=0;updateMediaTable()},"No":function(){$(this).dialog("close")},"Cancel":function(){$(this).dialog("close")}}})});$(document).on("click",".wonderplugin-carousel-media-table-edit",function(){var index=$(this).parent().parent().index();var mediaType=wonderplugin_carousel_config.slides[index].type;if(mediaType==10)youtubePlaylistDialog(function(items){if(items&&items.length>0){wonderplugin_carousel_config.slides.splice(index,
1);items.map(function(data){wonderplugin_carousel_config.slides.splice(index,0,{type:10,youtubeapikey:data.youtubeapikey,youtubeplaylistid:data.youtubeplaylistid,youtubeplaylistmaxresults:data.youtubeplaylistmaxresults,lightbox:data.lightbox,lightboxsize:data.lightboxsize,lightboxwidth:data.lightboxwidth,lightboxheight:data.lightboxheight,displaythumbnail:false,mp4:"",webm:"",weblink:"",clickhandler:"",linktarget:"",weblinklightbox:false})});updateMediaTable()}},wonderplugin_carousel_config.slides[index],
index);else if(mediaType==6)addPostsDialog(6,function(data){wonderplugin_carousel_config.slides.splice(index,1);wonderplugin_carousel_config.slides.splice(index,0,data);updateMediaTable()},wonderplugin_carousel_config.slides[index],index);else if(mediaType==7)addCustomPostDialog(7,function(data){wonderplugin_carousel_config.slides.splice(index,1);wonderplugin_carousel_config.slides.splice(index,0,data);updateMediaTable()},wonderplugin_carousel_config.slides[index],index);else slideDialog(mediaType,
function(items){if(items&&items.length>0){wonderplugin_carousel_config.slides.splice(index,1);items.map(function(data){wonderplugin_carousel_config.slides.splice(index,0,{type:mediaType,image:data.image,thumbnail:data.thumbnail?data.thumbnail:data.image,displaythumbnail:data.displaythumbnail,video:data.video,mp4:data.mp4,webm:data.webm,title:data.title,description:data.description,altusetitle:data.altusetitle,alt:data.alt,weblink:data.weblink,clickhandler:data.clickhandler,linktarget:data.linktarget,
weblinklightbox:data.weblinklightbox,lightbox:data.lightbox,lightboxsize:data.lightboxsize,lightboxwidth:data.lightboxwidth,lightboxheight:data.lightboxheight})});updateMediaTable()}},wonderplugin_carousel_config.slides[index],index)});$(document).on("click",".wonderplugin-carousel-media-table-delete",function(){var $tr=$(this).parent().parent();var index=$tr.index();wonderplugin_carousel_config.slides.splice(index,1);$tr.remove();$("#wonderplugin-carousel-media-table").find("li").each(function(index){$(this).find(".wonderplugin-carousel-media-table-id").text(index+
1);$(this).find("img").data("order",index);$(this).find("img").css({top:0,left:0})})});var wonderPluginMediaTableMove=function(i,j){var len=wonderplugin_carousel_config.slides.length;if(j<0)j=0;if(j>len-1)j=len-1;if(i==j){$("#wonderplugin-carousel-media-table").find("li").eq(i).find("img").css({top:0,left:0});return}var $tr=$("#wonderplugin-carousel-media-table").find("li").eq(i);var data=wonderplugin_carousel_config.slides[i];wonderplugin_carousel_config.slides.splice(i,1);wonderplugin_carousel_config.slides.splice(j,
0,data);var $trj=$("#wonderplugin-carousel-media-table").find("li").eq(j);$tr.remove();if(j>i)$trj.after($tr);else $trj.before($tr);$("#wonderplugin-carousel-media-table").find("li").each(function(index){$(this).find(".wonderplugin-carousel-media-table-id").text(index+1);$(this).find("img").data("order",index);$(this).find("img").css({top:0,left:0})});$tr.find("img").wpdraggable(wonderPluginMediaTableMove)};$(document).on("click",".wonderplugin-carousel-media-table-moveup",function(){var $tr=$(this).parent().parent();
var index=$tr.index();var data=wonderplugin_carousel_config.slides[index];wonderplugin_carousel_config.slides.splice(index,1);if(index==0){wonderplugin_carousel_config.slides.push(data);var $last=$tr.parent().find("li:last");$tr.remove();$last.after($tr)}else{wonderplugin_carousel_config.slides.splice(index-1,0,data);var $prev=$tr.prev();$tr.remove();$prev.before($tr)}$("#wonderplugin-carousel-media-table").find("li").each(function(index){$(this).find(".wonderplugin-carousel-media-table-id").text(index+
1);$(this).find("img").data("order",index);$(this).find("img").css({top:0,left:0})});$tr.find("img").wpdraggable(wonderPluginMediaTableMove)});$(document).on("click",".wonderplugin-carousel-media-table-movedown",function(){var $tr=$(this).parent().parent();var index=$tr.index();var len=wonderplugin_carousel_config.slides.length;var data=wonderplugin_carousel_config.slides[index];wonderplugin_carousel_config.slides.splice(index,1);if(index==len-1){wonderplugin_carousel_config.slides.unshift(data);
var $first=$tr.parent().find("li:first");$tr.remove();$first.before($tr)}else{wonderplugin_carousel_config.slides.splice(index+1,0,data);var $next=$tr.next();$tr.remove();$next.after($tr)}$("#wonderplugin-carousel-media-table").find("li").each(function(index){$(this).find(".wonderplugin-carousel-media-table-id").text(index+1);$(this).find("img").data("order",index);$(this).find("img").css({top:0,left:0})});$tr.find("img").wpdraggable(wonderPluginMediaTableMove)});var default_options={id:-1,newestfirst:false,
name:"My Carousel",slides:[],skin:"classic",autoplaydir:"left",donotcircularforless:false,circularlimit:3,fixaspectratio:true,centerimage:true,fitimage:false,fitcenterimage:false,sameheight:false,sameheightresponsive:false,sameheightmediumscreen:769,sameheightmediumheight:200,sameheightsmallscreen:415,sameheightsmallheight:150,fullwidth:false,hidecontaineroninit:false,hidecontainerbeforeloaded:false,spacing:8,imgextraprops:"",showimgtitle:false,addwoocommerceclass:true,imgtitle:"title",customcss:"",
dataoptions:"",customjs:"",lightboxresponsive:true,lightboxshownavigation:false,lightboxnogroup:false,lightboxshowtitle:true,lightboxshowdescription:false,lightboxfullscreenmode:false,lightboxcloseonoverlay:true,lightboxvideohidecontrols:false,lightboxtitlestyle:"bottom",lightboximagepercentage:75,lightboxdefaultvideovolume:1,lightboxoverlaybgcolor:"#000",lightboxoverlayopacity:0.9,lightboxbgcolor:"#fff",lightboxtitleprefix:"%NUM / %TOTAL",lightboxtitleinsidecss:"color:#fff; font-size:16px; font-family:Arial,Helvetica,sans-serif; overflow:hidden; text-align:left;",
lightboxdescriptioninsidecss:"color:#fff; font-size:12px; font-family:Arial,Helvetica,sans-serif; overflow:hidden; text-align:left; margin:4px 0px 0px; padding: 0px;",lightboxautoslide:false,lightboxslideinterval:5E3,lightboxshowtimer:true,lightboxtimerposition:"bottom",lightboxtimerheight:2,lightboxtimercolor:"#dc572e",lightboxtimeropacity:1,lightboxshowplaybutton:true,lightboxalwaysshownavarrows:false,lightboxbordersize:8,lightboxshowtitleprefix:true,lightboxborderradius:0,lightboximagekeepratio:true,
lightboxadvancedoptions:"",lightboxshowsocial:false,lightboxsocialposition:"position:absolute;top:100%;right:0;",lightboxsocialpositionsmallscreen:"position:absolute;top:100%;right:0;left:0;",lightboxsocialdirection:"horizontal",lightboxsocialbuttonsize:32,lightboxsocialbuttonfontsize:18,lightboxsocialrotateeffect:true,lightboxshowfacebook:true,lightboxshowtwitter:true,lightboxshowpinterest:true,donotinit:false,addinitscript:false,doshortcodeontext:false,triggerresize:false,triggerresizedelay:100,
lightboxthumbwidth:90,lightboxthumbheight:60,lightboxthumbtopmargin:12,lightboxthumbbottommargin:4,lightboxbarheight:64,lightboxtitlebottomcss:"{color:#333; font-size:14px; font-family:Armata,sans-serif,Arial; overflow:hidden; text-align:left;}",lightboxdescriptionbottomcss:"{color:#333; font-size:12px; font-family:Arial,Helvetica,sans-serif; overflow:hidden; text-align:left; margin:4px 0px 0px; padding: 0px;}"};var configSkinOptions=["width","height","spacing","rownumber","centerimage","fitimage",
"fitcenterimage","fixaspectratio","autoplay","random","circular","direction","responsive","visibleitems","autoplaydir","pauseonmouseover","scrollmode","interval","transitionduration","continuous","continuousduration","arrowstyle","arrowimage","arrowwidth","arrowheight","donotcircularforless","circularlimit","navstyle","navimage","navwidth","navheight","navspacing","hidecontainerbeforeloaded","hidecontaineroninit","fullwidth","sameheight","sameheightresponsive","sameheightmediumscreen","sameheightmediumheight",
"sameheightsmallscreen","sameheightsmallheight","showhoveroverlay","hoveroverlayimage","screenquery"];var defaultSkinOptions={};for(var key in WONDERPLUGIN_CAROUSEL_SKIN_OPTIONS){defaultSkinOptions[key]={};for(var i=0;i<configSkinOptions.length;i++)if(configSkinOptions[i]in WONDERPLUGIN_CAROUSEL_SKIN_OPTIONS[key])defaultSkinOptions[key][configSkinOptions[i]]=WONDERPLUGIN_CAROUSEL_SKIN_OPTIONS[key][configSkinOptions[i]];else if(configSkinOptions[i]in default_options)defaultSkinOptions[key][configSkinOptions[i]]=
default_options[configSkinOptions[i]];defaultSkinOptions[key]["skintemplate"]=WONDERPLUGIN_CAROUSEL_SKIN_TEMPLATE[key]["skintemplate"];defaultSkinOptions[key]["skincss"]=WONDERPLUGIN_CAROUSEL_SKIN_TEMPLATE[key]["skincss"];defaultSkinOptions[key]["arrowimagemode"]="defined";defaultSkinOptions[key]["navimagemode"]="defined";defaultSkinOptions[key]["hoveroverlayimagemode"]="defined";defaultSkinOptions[key]["showhoveroverlayalways"]=false;defaultSkinOptions[key]["hidehoveroverlayontouch"]=false;defaultSkinOptions[key]["usescreenquery"]=
false;defaultSkinOptions[key]["showplayvideo"]=true;defaultSkinOptions[key]["playvideoimage"]="playvideo-64-64-0.png";defaultSkinOptions[key]["playvideoimagepos"]="center";defaultSkinOptions[key]["playvideoimagemode"]="defined"}var printSkinOptions=function(options){$("#wonderplugin-carousel-width").val(options.width);$("#wonderplugin-carousel-height").val(options.height);$("#wonderplugin-carousel-spacing").val(options.spacing);$("#wonderplugin-carousel-rownumber").val(options.rownumber);$("#wonderplugin-carousel-fixaspectratio").attr("checked",
options.fixaspectratio);$("#wonderplugin-carousel-centerimage").attr("checked",options.centerimage);$("#wonderplugin-carousel-fitimage").attr("checked",options.fitimage);$("#wonderplugin-carousel-fitcenterimage").attr("checked",options.fitcenterimage);$("#wonderplugin-carousel-sameheight").attr("checked",options.sameheight);$("#wonderplugin-carousel-sameheightresponsive").attr("checked",options.sameheightresponsive);$("#wonderplugin-carousel-sameheightmediumscreen").val(options.sameheightmediumscreen);
$("#wonderplugin-carousel-sameheightmediumheight").val(options.sameheightmediumheight);$("#wonderplugin-carousel-sameheightsmallscreen").val(options.sameheightsmallscreen);$("#wonderplugin-carousel-sameheightsmallheight").val(options.sameheightsmallheight);$("#wonderplugin-carousel-fullwidth").attr("checked",options.fullwidth);$("#wonderplugin-carousel-hidecontaineroninit").attr("checked",options.hidecontaineroninit);$("#wonderplugin-carousel-hidecontainerbeforeloaded").attr("checked",options.hidecontainerbeforeloaded);
$("#wonderplugin-carousel-autoplay").attr("checked",options.autoplay);$("#wonderplugin-carousel-random").attr("checked",options.random);$("#wonderplugin-carousel-circular").attr("checked",options.circular);$("#wonderplugin-carousel-responsive").attr("checked",options.responsive);$("#wonderplugin-carousel-visibleitems").val(options.visibleitems);$("#wonderplugin-carousel-donotcircularforless").attr("checked",options.donotcircularforless);$("#wonderplugin-carousel-circularlimit").val(options.circularlimit);
$("#wonderplugin-carousel-autoplaydir").val(options.autoplaydir);$("#wonderplugin-carousel-pauseonmouseover").attr("checked",options.pauseonmouseover);$("#wonderplugin-carousel-scrollmode").val(options.scrollmode);$("#wonderplugin-carousel-interval").val(options.interval);$("#wonderplugin-carousel-transitionduration").val(options.transitionduration);$("#wonderplugin-carousel-continuous").attr("checked",options.continuous);$("#wonderplugin-carousel-continuousduration").val(options.continuousduration);
if(options.usescreenquery)$("input:radio[name=wonderplugin-carousel-usescreenquery][value=screensize]").attr("checked",true);else $("input:radio[name=wonderplugin-carousel-usescreenquery][value=fixedsize]").attr("checked",true);$("#wonderplugin-carousel-screenquery").val(options.screenquery);$("#wonderplugin-carousel-arrowstyle").val(options.arrowstyle);$("input:radio[name=wonderplugin-carousel-arrowimagemode][value="+options.arrowimagemode+"]").attr("checked",true);if(wonderplugin_carousel_config.arrowimagemode==
"custom"){$("#wonderplugin-carousel-customarrowimage").val(options.arrowimage);$("#wonderplugin-carousel-displayarrowimage").attr("src",options.arrowimage)}else{$("#wonderplugin-carousel-arrowimage").val(options.arrowimage);$("#wonderplugin-carousel-displayarrowimage").attr("src",$("#wonderplugin-carousel-jsfolder").text()+options.arrowimage)}$("#wonderplugin-carousel-arrowwidth").val(options.arrowwidth);$("#wonderplugin-carousel-arrowheight").val(options.arrowheight);$("#wonderplugin-carousel-showhoveroverlay").attr("checked",
options.showhoveroverlay);$("#wonderplugin-carousel-showhoveroverlayalways").attr("checked",options.showhoveroverlayalways);$("#wonderplugin-carousel-hidehoveroverlayontouch").attr("checked",options.hidehoveroverlayontouch);$("input:radio[name=wonderplugin-carousel-hoveroverlayimagemode][value="+options.hoveroverlayimagemode+"]").attr("checked",true);if(wonderplugin_carousel_config.hoveroverlayimagemode=="custom"){$("#wonderplugin-carousel-customhoveroverlayimage").val(options.hoveroverlayimage);
$("#wonderplugin-carousel-displayhoveroverlayimage").attr("src",options.hoveroverlayimage)}else{$("#wonderplugin-carousel-hoveroverlayimage").val(options.hoveroverlayimage);$("#wonderplugin-carousel-displayhoveroverlayimage").attr("src",$("#wonderplugin-carousel-jsfolder").text()+options.hoveroverlayimage)}$("#wonderplugin-carousel-navstyle").val(options.navstyle);$("input:radio[name=wonderplugin-carousel-navimagemode][value="+options.navimagemode+"]").attr("checked",true);if(wonderplugin_carousel_config.navimagemode==
"custom"){$("#wonderplugin-carousel-customnavimage").val(options.navimage);$("#wonderplugin-carousel-displaynavimage").attr("src",options.navimage)}else{$("#wonderplugin-carousel-navimage").val(options.navimage);$("#wonderplugin-carousel-displaynavimage").attr("src",$("#wonderplugin-carousel-jsfolder").text()+options.navimage)}$("#wonderplugin-carousel-navwidth").val(options.navwidth);$("#wonderplugin-carousel-navheight").val(options.navheight);$("#wonderplugin-carousel-navspacing").val(options.navspacing);
$("#wonderplugin-carousel-skintemplate").val(options.skintemplate);$("#wonderplugin-carousel-skincss").val(options.skincss)};$("input:radio[name=wonderplugin-carousel-skin]").click(function(){if($(this).val()==wonderplugin_carousel_config.skin)return;$(".wonderplugin-tab-skin").find("img").removeClass("selected");$("input:radio[name=wonderplugin-carousel-skin]:checked").parent().find("img").addClass("selected");wonderplugin_carousel_config.skin=$(this).val();printSkinOptions(defaultSkinOptions[$(this).val()])});
$(".wonderplugin-carousel-options-menu-item").each(function(index){$(this).click(function(){if($(this).hasClass("wonderplugin-carousel-options-menu-item-selected"))return;$(".wonderplugin-carousel-options-menu-item").removeClass("wonderplugin-carousel-options-menu-item-selected");$(this).addClass("wonderplugin-carousel-options-menu-item-selected");$(".wonderplugin-carousel-options-tab").removeClass("wonderplugin-carousel-options-tab-selected");$(".wonderplugin-carousel-options-tab").eq(index).addClass("wonderplugin-carousel-options-tab-selected")})});
var updateCarouselOptions=function(){wonderplugin_carousel_config.newestfirst=$("#wonderplugin-newestfirst").is(":checked");wonderplugin_carousel_config.name=$.trim($("#wonderplugin-carousel-name").val());wonderplugin_carousel_config.skin=$("input:radio[name=wonderplugin-carousel-skin]:checked").val();wonderplugin_carousel_config.width=parseInt($.trim($("#wonderplugin-carousel-width").val()));wonderplugin_carousel_config.height=parseInt($.trim($("#wonderplugin-carousel-height").val()));wonderplugin_carousel_config.spacing=
parseInt($.trim($("#wonderplugin-carousel-spacing").val()));wonderplugin_carousel_config.rownumber=parseInt($.trim($("#wonderplugin-carousel-rownumber").val()));wonderplugin_carousel_config.fixaspectratio=$("#wonderplugin-carousel-fixaspectratio").is(":checked");wonderplugin_carousel_config.centerimage=$("#wonderplugin-carousel-centerimage").is(":checked");wonderplugin_carousel_config.fitimage=$("#wonderplugin-carousel-fitimage").is(":checked");wonderplugin_carousel_config.fitcenterimage=$("#wonderplugin-carousel-fitcenterimage").is(":checked");
wonderplugin_carousel_config.sameheight=$("#wonderplugin-carousel-sameheight").is(":checked");wonderplugin_carousel_config.sameheightresponsive=$("#wonderplugin-carousel-sameheightresponsive").is(":checked");wonderplugin_carousel_config.sameheightmediumscreen=parseInt($.trim($("#wonderplugin-carousel-sameheightmediumscreen").val()));wonderplugin_carousel_config.sameheightmediumheight=parseInt($.trim($("#wonderplugin-carousel-sameheightmediumheight").val()));wonderplugin_carousel_config.sameheightsmallscreen=
parseInt($.trim($("#wonderplugin-carousel-sameheightsmallscreen").val()));wonderplugin_carousel_config.sameheightsmallheight=parseInt($.trim($("#wonderplugin-carousel-sameheightsmallheight").val()));wonderplugin_carousel_config.fullwidth=$("#wonderplugin-carousel-fullwidth").is(":checked");wonderplugin_carousel_config.hidecontaineroninit=$("#wonderplugin-carousel-hidecontaineroninit").is(":checked");wonderplugin_carousel_config.hidecontainerbeforeloaded=$("#wonderplugin-carousel-hidecontainerbeforeloaded").is(":checked");
wonderplugin_carousel_config.autoplay=$("#wonderplugin-carousel-autoplay").is(":checked");wonderplugin_carousel_config.random=$("#wonderplugin-carousel-random").is(":checked");wonderplugin_carousel_config.circular=$("#wonderplugin-carousel-circular").is(":checked");wonderplugin_carousel_config.responsive=$("#wonderplugin-carousel-responsive").is(":checked");wonderplugin_carousel_config.visibleitems=parseInt($.trim($("#wonderplugin-carousel-visibleitems").val()));if(isNaN(wonderplugin_carousel_config.visibleitems)||
wonderplugin_carousel_config.visibleitems<1)wonderplugin_carousel_config.visibleitems=3;wonderplugin_carousel_config.donotcircularforless=$("#wonderplugin-carousel-donotcircularforless").is(":checked");wonderplugin_carousel_config.circularlimit=parseInt($.trim($("#wonderplugin-carousel-circularlimit").val()));wonderplugin_carousel_config.autoplaydir=$("#wonderplugin-carousel-autoplaydir").val();wonderplugin_carousel_config.pauseonmouseover=$("#wonderplugin-carousel-pauseonmouseover").is(":checked");
wonderplugin_carousel_config.scrollmode=$("#wonderplugin-carousel-scrollmode").val();wonderplugin_carousel_config.interval=parseInt($.trim($("#wonderplugin-carousel-interval").val()));wonderplugin_carousel_config.transitionduration=parseInt($.trim($("#wonderplugin-carousel-transitionduration").val()));wonderplugin_carousel_config.continuous=$("#wonderplugin-carousel-continuous").is(":checked");wonderplugin_carousel_config.continuousduration=parseInt($.trim($("#wonderplugin-carousel-continuousduration").val()));
wonderplugin_carousel_config.imgextraprops=$.trim($("#wonderplugin-carousel-imgextraprops").val());wonderplugin_carousel_config.showimgtitle=$("#wonderplugin-carousel-showimgtitle").is(":checked");wonderplugin_carousel_config.imgtitle=$("#wonderplugin-carousel-imgtitle").val();wonderplugin_carousel_config.addwoocommerceclass=$("#wonderplugin-carousel-addwoocommerceclass").is(":checked");if($("input[name=wonderplugin-carousel-usescreenquery]:checked").val()=="screensize")wonderplugin_carousel_config.usescreenquery=
true;else wonderplugin_carousel_config.usescreenquery=false;wonderplugin_carousel_config.screenquery=$.trim($("#wonderplugin-carousel-screenquery").val());wonderplugin_carousel_config.arrowstyle=$("#wonderplugin-carousel-arrowstyle").val();wonderplugin_carousel_config.arrowimagemode=$("input[name=wonderplugin-carousel-arrowimagemode]:checked").val();if(wonderplugin_carousel_config.arrowimagemode=="custom")wonderplugin_carousel_config.arrowimage=$.trim($("#wonderplugin-carousel-customarrowimage").val());
else wonderplugin_carousel_config.arrowimage=$.trim($("#wonderplugin-carousel-arrowimage").val());wonderplugin_carousel_config.arrowwidth=parseInt($.trim($("#wonderplugin-carousel-arrowwidth").val()));if(isNaN(wonderplugin_carousel_config.arrowwidth)||wonderplugin_carousel_config.arrowwidth<0)wonderplugin_carousel_config.arrowwidth=defaultSkinOptions[wonderplugin_carousel_config.skin]["arrowwidth"];wonderplugin_carousel_config.arrowheight=parseInt($.trim($("#wonderplugin-carousel-arrowheight").val()));
if(isNaN(wonderplugin_carousel_config.arrowheight)||wonderplugin_carousel_config.arrowheight<0)wonderplugin_carousel_config.arrowheight=defaultSkinOptions[wonderplugin_carousel_config.skin]["arrowheight"];wonderplugin_carousel_config.showhoveroverlay=$("#wonderplugin-carousel-showhoveroverlay").is(":checked");wonderplugin_carousel_config.showhoveroverlayalways=$("#wonderplugin-carousel-showhoveroverlayalways").is(":checked");wonderplugin_carousel_config.hidehoveroverlayontouch=$("#wonderplugin-carousel-hidehoveroverlayontouch").is(":checked");
wonderplugin_carousel_config.hoveroverlayimagemode=$("input[name=wonderplugin-carousel-hoveroverlayimagemode]:checked").val();if(wonderplugin_carousel_config.hoveroverlayimagemode=="custom")wonderplugin_carousel_config.hoveroverlayimage=$.trim($("#wonderplugin-carousel-customhoveroverlayimage").val());else wonderplugin_carousel_config.hoveroverlayimage=$.trim($("#wonderplugin-carousel-hoveroverlayimage").val());wonderplugin_carousel_config.showplayvideo=$("#wonderplugin-carousel-showplayvideo").is(":checked");
wonderplugin_carousel_config.playvideoimagemode=$("input[name=wonderplugin-carousel-playvideoimagemode]:checked").val();if(wonderplugin_carousel_config.playvideoimagemode=="custom")wonderplugin_carousel_config.playvideoimage=$.trim($("#wonderplugin-carousel-customplayvideoimage").val());else wonderplugin_carousel_config.playvideoimage=$.trim($("#wonderplugin-carousel-playvideoimage").val());wonderplugin_carousel_config.playvideoimagepos=$("#wonderplugin-carousel-playvideoimagepos").val();wonderplugin_carousel_config.navstyle=
$("#wonderplugin-carousel-navstyle").val();wonderplugin_carousel_config.navimagemode=$("input[name=wonderplugin-carousel-navimagemode]:checked").val();if(wonderplugin_carousel_config.navimagemode=="custom")wonderplugin_carousel_config.navimage=$.trim($("#wonderplugin-carousel-customnavimage").val());else wonderplugin_carousel_config.navimage=$.trim($("#wonderplugin-carousel-navimage").val());wonderplugin_carousel_config.navwidth=parseInt($.trim($("#wonderplugin-carousel-navwidth").val()));if(isNaN(wonderplugin_carousel_config.navwidth)||
wonderplugin_carousel_config.navwidth<0)wonderplugin_carousel_config.navwidth=defaultSkinOptions[wonderplugin_carousel_config.skin]["navwidth"];wonderplugin_carousel_config.navheight=parseInt($.trim($("#wonderplugin-carousel-navheight").val()));if(isNaN(wonderplugin_carousel_config.navheight)||wonderplugin_carousel_config.navheight<0)wonderplugin_carousel_config.navheight=defaultSkinOptions[wonderplugin_carousel_config.skin]["navheight"];wonderplugin_carousel_config.navspacing=parseInt($.trim($("#wonderplugin-carousel-navspacing").val()));
if(isNaN(wonderplugin_carousel_config.navspacing))wonderplugin_carousel_config.navspacing=defaultSkinOptions[wonderplugin_carousel_config.skin]["navspacing"];wonderplugin_carousel_config.direction=defaultSkinOptions[wonderplugin_carousel_config.skin]["direction"];wonderplugin_carousel_config.skintemplate=$.trim($("#wonderplugin-carousel-skintemplate").val()).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");wonderplugin_carousel_config.skincss=$.trim($("#wonderplugin-carousel-skincss").val());
wonderplugin_carousel_config.customcss=$.trim($("#wonderplugin-carousel-custom-css").val());wonderplugin_carousel_config.dataoptions=$.trim($("#wonderplugin-carousel-data-options").val());wonderplugin_carousel_config.customjs=$.trim($("#wonderplugin-carousel-customjs").val());wonderplugin_carousel_config.lightboxresponsive=$("#wonderplugin-carousel-lightboxresponsive").is(":checked");wonderplugin_carousel_config.lightboxshownavigation=$("#wonderplugin-carousel-lightboxshownavigation").is(":checked");
wonderplugin_carousel_config.lightboxnogroup=$("#wonderplugin-carousel-lightboxnogroup").is(":checked");wonderplugin_carousel_config.lightboxshowtitle=$("#wonderplugin-carousel-lightboxshowtitle").is(":checked");wonderplugin_carousel_config.lightboxshowdescription=$("#wonderplugin-carousel-lightboxshowdescription").is(":checked");wonderplugin_carousel_config.lightboxvideohidecontrols=$("#wonderplugin-carousel-lightboxvideohidecontrols").is(":checked");wonderplugin_carousel_config.lightboxfullscreenmode=
$("#wonderplugin-carousel-lightboxfullscreenmode").is(":checked");wonderplugin_carousel_config.lightboxcloseonoverlay=$("#wonderplugin-carousel-lightboxcloseonoverlay").is(":checked");wonderplugin_carousel_config.lightboxtitlestyle=$.trim($("#wonderplugin-carousel-lightboxtitlestyle").val());wonderplugin_carousel_config.lightboxdefaultvideovolume=parseFloat($.trim($("#wonderplugin-carousel-lightboxdefaultvideovolume").val()));wonderplugin_carousel_config.lightboximagepercentage=parseInt($.trim($("#wonderplugin-carousel-lightboximagepercentage").val()));
wonderplugin_carousel_config.lightboxoverlayopacity=parseFloat($.trim($("#wonderplugin-carousel-lightboxoverlayopacity").val()));wonderplugin_carousel_config.lightboxoverlaybgcolor=$.trim($("#wonderplugin-carousel-lightboxoverlaybgcolor").val());wonderplugin_carousel_config.lightboxbgcolor=$.trim($("#wonderplugin-carousel-lightboxbgcolor").val());wonderplugin_carousel_config.lightboxtitleprefix=$("#wonderplugin-carousel-lightboxtitleprefix").val();wonderplugin_carousel_config.lightboxtitleinsidecss=
$.trim($("#wonderplugin-carousel-lightboxtitleinsidecss").val());wonderplugin_carousel_config.lightboxdescriptioninsidecss=$.trim($("#wonderplugin-carousel-lightboxdescriptioninsidecss").val());wonderplugin_carousel_config.lightboxadvancedoptions=$.trim($("#wonderplugin-carousel-lightboxadvancedoptions").val());wonderplugin_carousel_config.lightboxautoslide=$("#wonderplugin-carousel-lightboxautoslide").is(":checked");wonderplugin_carousel_config.lightboxshowtimer=$("#wonderplugin-carousel-lightboxshowtimer").is(":checked");
wonderplugin_carousel_config.lightboxshowplaybutton=$("#wonderplugin-carousel-lightboxshowplaybutton").is(":checked");wonderplugin_carousel_config.lightboxalwaysshownavarrows=$("#wonderplugin-carousel-lightboxalwaysshownavarrows").is(":checked");wonderplugin_carousel_config.lightboxshowtitleprefix=$("#wonderplugin-carousel-lightboxshowtitleprefix").is(":checked");wonderplugin_carousel_config.lightboxslideinterval=parseInt($.trim($("#wonderplugin-carousel-lightboxslideinterval").val()));wonderplugin_carousel_config.lightboxtimerheight=
parseInt($.trim($("#wonderplugin-carousel-lightboxtimerheight").val()));wonderplugin_carousel_config.lightboxbordersize=parseInt($.trim($("#wonderplugin-carousel-lightboxbordersize").val()));wonderplugin_carousel_config.lightboxborderradius=parseInt($.trim($("#wonderplugin-carousel-lightboxborderradius").val()));wonderplugin_carousel_config.lightboxtimeropacity=parseFloat($.trim($("#wonderplugin-carousel-lightboxtimeropacity").val()));wonderplugin_carousel_config.lightboxtimerposition=$.trim($("#wonderplugin-carousel-lightboxtimerposition").val());
wonderplugin_carousel_config.lightboxtimercolor=$.trim($("#wonderplugin-carousel-lightboxtimercolor").val());wonderplugin_carousel_config.lightboxshowsocial=$("#wonderplugin-carousel-lightboxshowsocial").is(":checked");wonderplugin_carousel_config.lightboxsocialposition=$.trim($("#wonderplugin-carousel-lightboxsocialposition").val());wonderplugin_carousel_config.lightboxsocialpositionsmallscreen=$.trim($("#wonderplugin-carousel-lightboxsocialpositionsmallscreen").val());wonderplugin_carousel_config.lightboxsocialdirection=
$.trim($("#wonderplugin-carousel-lightboxsocialdirection").val());wonderplugin_carousel_config.lightboxsocialbuttonsize=parseInt($.trim($("#wonderplugin-carousel-lightboxsocialbuttonsize").val()));wonderplugin_carousel_config.lightboxsocialbuttonfontsize=parseInt($.trim($("#wonderplugin-carousel-lightboxsocialbuttonfontsize").val()));wonderplugin_carousel_config.lightboxsocialrotateeffect=$("#wonderplugin-carousel-lightboxsocialrotateeffect").is(":checked");wonderplugin_carousel_config.lightboxshowfacebook=
$("#wonderplugin-carousel-lightboxshowfacebook").is(":checked");wonderplugin_carousel_config.lightboxshowtwitter=$("#wonderplugin-carousel-lightboxshowtwitter").is(":checked");wonderplugin_carousel_config.lightboxshowpinterest=$("#wonderplugin-carousel-lightboxshowpinterest").is(":checked");wonderplugin_carousel_config.lightboximagekeepratio=$("#wonderplugin-carousel-lightboximagekeepratio").is(":checked");wonderplugin_carousel_config.donotinit=$("#wonderplugin-carousel-donotinit").is(":checked");
wonderplugin_carousel_config.addinitscript=$("#wonderplugin-carousel-addinitscript").is(":checked");wonderplugin_carousel_config.doshortcodeontext=$("#wonderplugin-carousel-doshortcodeontext").is(":checked");wonderplugin_carousel_config.triggerresize=$("#wonderplugin-carousel-triggerresize").is(":checked");wonderplugin_carousel_config.triggerresizedelay=parseInt($.trim($("#wonderplugin-carousel-triggerresizedelay").val()));var val=parseInt($.trim($("#wonderplugin-carousel-lightboxthumbwidth").val()));
wonderplugin_carousel_config.lightboxthumbwidth=isNaN(val)?default_options.lightboxthumbwidth:val;val=parseInt($.trim($("#wonderplugin-carousel-lightboxthumbheight").val()));wonderplugin_carousel_config.lightboxthumbheight=isNaN(val)?default_options.lightboxthumbheight:val;val=parseInt($.trim($("#wonderplugin-carousel-lightboxthumbtopmargin").val()));wonderplugin_carousel_config.lightboxthumbtopmargin=isNaN(val)?default_options.lightboxthumbtopmargin:val;val=parseInt($.trim($("#wonderplugin-carousel-lightboxthumbbottommargin").val()));
wonderplugin_carousel_config.lightboxthumbbottommargin=isNaN(val)?default_options.lightboxthumbbottommargin:val;val=parseInt($.trim($("#wonderplugin-carousel-lightboxbarheight").val()));wonderplugin_carousel_config.lightboxbarheight=isNaN(val)?default_options.lightboxbarheight:val;wonderplugin_carousel_config.lightboxtitlebottomcss=$.trim($("#wonderplugin-carousel-lightboxtitlebottomcss").val());wonderplugin_carousel_config.lightboxdescriptionbottomcss=$.trim($("#wonderplugin-carousel-lightboxdescriptionbottomcss").val())};
var previewCarousel=function(){updateCarouselOptions();$("#wonderplugin-carousel-preview-container").empty();var previewCode="<div id='wonderplugin-carousel-preview'";if(wonderplugin_carousel_config.dataoptions&&wonderplugin_carousel_config.dataoptions.length>0)previewCode+=" "+wonderplugin_carousel_config.dataoptions;previewCode+="></div>";$("#wonderplugin-carousel-preview-container").html(previewCode);if(wonderplugin_carousel_config.slides.length>0){$("head").find("style").each(function(){if($(this).data("creator")==
"wonderplugincarouselcreator")$(this).remove()});var carouselid=wonderplugin_carousel_config.id>0?wonderplugin_carousel_config.id:0;if(wonderplugin_carousel_config.customcss&&wonderplugin_carousel_config.customcss.length>0){var customcss=wonderplugin_carousel_config.customcss.replace(/wonderplugincarousel-container-CAROUSELID/g,"wonderplugin-carousel-preview-container").replace(/wonderplugincarousel-CAROUSELID/g,"wonderplugin-carousel-preview").replace(/CAROUSELID/g,carouselid);$("head").append("<style type='text/css' data-creator='wonderplugincarouselcreator'>"+
customcss+"</style>")}if(wonderplugin_carousel_config.skincss&&wonderplugin_carousel_config.skincss.length>0)$("head").append("<style type='text/css' data-creator='wonderplugincarouselcreator'>"+wonderplugin_carousel_config.skincss.replace(/#amazingcarousel-CAROUSELID/g,"#wonderplugin-carousel-preview")+"</style>");$("#wpcarousellightbox_advanced_options").remove();var code="";if(wonderplugin_carousel_config.lightboxadvancedoptions&&wonderplugin_carousel_config.lightboxadvancedoptions.length>0){code+=
"<div id='wpcarousellightbox_advanced_options'";code+=" "+wonderplugin_carousel_config.lightboxadvancedoptions;code+="></div>"}var i;code+='<div class="amazingcarousel-list-container" style="overflow:hidden;">';code+='<ul class="amazingcarousel-list">';if(isNaN(wonderplugin_carousel_config.rownumber)||wonderplugin_carousel_config.rownumber<1)wonderplugin_carousel_config.rownumber=1;var hasPosts=false;var count=0;for(i=0;i<wonderplugin_carousel_config.slides.length;i++){if(wonderplugin_carousel_config.slides[i].type==
6||wonderplugin_carousel_config.slides[i].type==7){hasPosts=true;continue}if(wonderplugin_carousel_config.slides[i].type==10){if(count>0)code+="</li>";code+='<li class="amazingcarousel-item"';wonderplugin_carousel_config.slides[i].image="__IMAGE__";wonderplugin_carousel_config.slides[i].thumbnail="__THUMBNAIL__";wonderplugin_carousel_config.slides[i].video="__VIDEO__";wonderplugin_carousel_config.slides[i].title="__TITLE__";wonderplugin_carousel_config.slides[i].description="__DESCRIPTION__";code+=
' data-youtubeapikey="'+wonderplugin_carousel_config.slides[i].youtubeapikey+'" data-youtubeplaylistid="'+wonderplugin_carousel_config.slides[i].youtubeplaylistid+'" data-youtubeplaylistmaxresults="'+wonderplugin_carousel_config.slides[i].youtubeplaylistmaxresults+'"';code+=">"}else if(count==0)code+='<li class="amazingcarousel-item">';else if(count%wonderplugin_carousel_config.rownumber==0)code+='</li><li class="amazingcarousel-item">';count++;code+='<div class="amazingcarousel-item-container">';
var image_code="";if(wonderplugin_carousel_config.slides[i].lightbox){image_code+='<a href="';if(wonderplugin_carousel_config.slides[i].type==0)image_code+=wonderplugin_carousel_config.slides[i].image;else if(wonderplugin_carousel_config.slides[i].type==1){image_code+=wonderplugin_carousel_config.slides[i].mp4;if(wonderplugin_carousel_config.slides[i].webm)image_code+='" data-webm="'+wonderplugin_carousel_config.slides[i].webm}else if(wonderplugin_carousel_config.slides[i].type==2||wonderplugin_carousel_config.slides[i].type==
3||wonderplugin_carousel_config.slides[i].type==10)image_code+=wonderplugin_carousel_config.slides[i].video;if(wonderplugin_carousel_config.slides[i].title&&wonderplugin_carousel_config.slides[i].title.length>0)image_code+='" title="'+wonderplugin_carousel_config.slides[i].title.replace(/"/g,"&quot;");if(wonderplugin_carousel_config.slides[i].description&&wonderplugin_carousel_config.slides[i].description.length>0)image_code+='" data-description="'+wonderplugin_carousel_config.slides[i].description.replace(/"/g,
"&quot;");if(wonderplugin_carousel_config.slides[i].lightboxsize)image_code+='" data-width="'+wonderplugin_carousel_config.slides[i].lightboxwidth+'" data-height="'+wonderplugin_carousel_config.slides[i].lightboxheight;image_code+='" data-thumbnail="'+wonderplugin_carousel_config.slides[i].thumbnail;image_code+='" class="wondercarousellightbox wondercarousellightbox-'+carouselid+'"';if(!wonderplugin_carousel_config.lightboxnogroup)image_code+=' data-group="wondercarousellightbox-'+carouselid+'"';
if(wonderplugin_carousel_config.slides[i].type==10)image_code+=" data-ytplaylist=1";image_code+=">"}else if(wonderplugin_carousel_config.slides[i].weblink&&wonderplugin_carousel_config.slides[i].weblink.length>0){image_code+='<a href="'+wonderplugin_carousel_config.slides[i].weblink+'"';if(wonderplugin_carousel_config.slides[i].clickhandler&&wonderplugin_carousel_config.slides[i].clickhandler.length>0)image_code+=' onclick="'+wonderplugin_carousel_config.slides[i].clickhandler.replace(/"/g,"&quot;")+
'"';if(wonderplugin_carousel_config.slides[i].linktarget&&wonderplugin_carousel_config.slides[i].linktarget.length>0)image_code+=' target="'+wonderplugin_carousel_config.slides[i].linktarget+'"';if(wonderplugin_carousel_config.slides[i].weblinklightbox){image_code+='" class="wondercarousellightbox wondercarousellightbox-'+carouselid+'"';if(!wonderplugin_carousel_config.lightboxnogroup)image_code+=' data-group="wondercarousellightbox-'+carouselid+'"';if(wonderplugin_carousel_config.slides[i].lightboxsize)image_code+=
' data-width="'+wonderplugin_carousel_config.slides[i].lightboxwidth+'" data-height="'+wonderplugin_carousel_config.slides[i].lightboxheight+'"'}image_code+=">"}image_code+="<img";if(wonderplugin_carousel_config.imgextraprops)image_code+=" "+wonderplugin_carousel_config.imgextraprops;if(wonderplugin_carousel_config.slides[i].type==10)image_code+=' data-srcyt="';else image_code+=' src="';if(wonderplugin_carousel_config.slides[i].displaythumbnail)image_code+=wonderplugin_carousel_config.slides[i].thumbnail+
'"';else image_code+=wonderplugin_carousel_config.slides[i].image+'"';image_code+=' alt="'+wonderplugin_carousel_config.slides[i].title.replace(/"/g,"&quot;")+'"';image_code+=' data-description="'+wonderplugin_carousel_config.slides[i].description.replace(/"/g,"&quot;")+'"';if(!wonderplugin_carousel_config.slides[i].lightbox)if(wonderplugin_carousel_config.slides[i].type==1){image_code+=' data-video="'+wonderplugin_carousel_config.slides[i].mp4+'"';if(wonderplugin_carousel_config.slides[i].webm)image_code+=
' data-videowebm="'+wonderplugin_carousel_config.slides[i].webm+'"'}else if(wonderplugin_carousel_config.slides[i].type==2||wonderplugin_carousel_config.slides[i].type==3||wonderplugin_carousel_config.slides[i].type==10)image_code+=' data-video="'+wonderplugin_carousel_config.slides[i].video+'"';image_code+=" />";if(wonderplugin_carousel_config.slides[i].lightbox||!wonderplugin_carousel_config.slides[i].lightbox&&wonderplugin_carousel_config.slides[i].weblink&&wonderplugin_carousel_config.slides[i].weblink.length>
0)image_code+="</a>";var title_code="";if(wonderplugin_carousel_config.slides[i].title&&wonderplugin_carousel_config.slides[i].title.length>0)title_code=wonderplugin_carousel_config.slides[i].title;var description_code="";if(wonderplugin_carousel_config.slides[i].description&&wonderplugin_carousel_config.slides[i].description.length>0)description_code=wonderplugin_carousel_config.slides[i].description;var skin_template=wonderplugin_carousel_config.skintemplate.replace(/&amp;/g,"&").replace(/&lt;/g,
"<").replace(/&gt;/g,">").replace(/__IMAGE__/g,image_code).replace(/__TITLE__/g,title_code).replace(/__DESCRIPTION__/g,description_code);skin_template=skin_template.replace(/__HREF__/g,wonderplugin_carousel_config.slides[i].weblink);skin_template=skin_template.replace(/__CLICKHANDLER__/g,wonderplugin_carousel_config.slides[i].clickhandler);skin_template=skin_template.replace(/__TARGET__/g,wonderplugin_carousel_config.slides[i].linktarget);code+=skin_template;code+="</div>"}if(count>0)code+="</li>";
code+="</ul>";code+='<div class="amazingcarousel-prev"></div><div class="amazingcarousel-next"></div>';code+="</div>";code+='<div class="amazingcarousel-nav"></div>';var jsfolder=$("#wonderplugin-carousel-jsfolder").text();var carouselOptions=$.extend({},WONDERPLUGIN_CAROUSEL_SKIN_OPTIONS[wonderplugin_carousel_config["skin"]],{carouselid:carouselid,jsfolder:jsfolder},wonderplugin_carousel_config);var totalwidth;if(carouselOptions.direction=="vertical")totalwidth=carouselOptions.width;else totalwidth=
carouselOptions.width*carouselOptions.visibleitems;if(carouselOptions.responsive)$("#wonderplugin-carousel-preview").css({display:"none",position:"relative",width:"100%","max-width":totalwidth+"px"});else $("#wonderplugin-carousel-preview").css({display:"none",position:"relative",width:totalwidth+"px"});$("#wonderplugin-carousel-preview").html(code);carouselOptions.screenquery=jQuery.parseJSON(carouselOptions.screenquery);$("#wonderplugin-carousel-preview").wonderplugincarouselslider(carouselOptions);
$(window).trigger("resize");if(hasPosts)$("#wonderplugin-carousel-preview-message").html("The WordPress posts carousel is not available in the Preview tab. To view the effect, save and publish the carousel, then clik the View Carousel link. Or you can add the provided shortcode to a post or page to view the effect.");else $("#wonderplugin-carousel-preview-message").empty()}};var postPublish=function(message){$("#wonderplugin-carousel-publish-loading").hide();var formnonce=$("#wonderplugin-carousel-saveformnonce").html();
var errorHtml="";if(message){errorHtml+="<div class='error'><p>Error message: "+message+"</p></div>";errorHtml+="<div class='error'><p>WordPress Ajax call failed. Please click the button below and save with POST method</p></div>"}else{errorHtml+="<div class='error'><p>WordPress Ajax call failed. Please check your WordPress configuration file and make sure the WP_DEBUG is set to false.</p></div>";errorHtml+="<div class='error'><p>Please click the button below and save with POST method</p></div>"}errorHtml+=
"<form method='post'>";errorHtml+=formnonce;errorHtml+="<input type='hidden' name='wonderplugin-carousel-save-item-post-value' id='wonderplugin-carousel-save-item-post-value' value='"+JSON.stringify(wonderplugin_carousel_config).replace(/"/g,"&quot;").replace(/'/g,"&#39;")+"' />";errorHtml+="<p class='submit'><input type='submit' name='wonderplugin-carousel-save-item-post' id='wonderplugin-carousel-save-item-post' class='button button-primary' value='Save & Publish with Post Method'  /></p>";errorHtml+=
"</form>";$("#wonderplugin-carousel-publish-information").html(errorHtml)};var publishCarousel=function(){$("#wonderplugin-carousel-publish-loading").show();updateCarouselOptions();var ajaxnonce=$("#wonderplugin-carousel-ajaxnonce").text();jQuery.ajax({url:ajaxurl,type:"POST",data:{action:"wonderplugin_carousel_save_config",nonce:ajaxnonce,item:JSON.stringify(wonderplugin_carousel_config)},success:function(data){$("#wonderplugin-carousel-publish-loading").hide();if(data&&data.success&&data.id>=0){wonderplugin_carousel_config.id=
data.id;$("#wonderplugin-carousel-publish-information").html("<div class='updated'><p>The carousel has been saved and published: <a href='"+$("#wonderplugin-carousel-viewadminurl").text()+"&itemid="+data.id+"' target='_blank'>View Carousel</a></p></div>"+"<div class='updated'><p>To embed the carousel into your page or post, use shortcode:  [wonderplugin_carousel id=\""+data.id+'"]</p></div>'+"<div class='updated'><p>To embed the carousel into your template, use php code:  &lt;?php echo do_shortcode('[wonderplugin_carousel id=\""+
data.id+"\"]'); ?&gt;</p></div>")}else postPublish(data&&data.message?data.message:"")},error:function(){$("#wonderplugin-carousel-publish-loading").hide();postPublish("")}})};var wonderplugin_carousel_config=$.extend({},default_options,defaultSkinOptions[default_options["skin"]]);var carouselId=parseInt($("#wonderplugin-carousel-id").text());if(carouselId>=0){var saved_config=$.parseJSON($("#wonderplugin-carousel-id-config").text());if(!("fixaspectratio"in saved_config))saved_config.fixaspectratio=
false;if(!("centerimage"in saved_config))saved_config.centerimage=false;if(!("fitimage"in saved_config))saved_config.fitimage=false;if(!("fitcenterimage"in saved_config))saved_config.fitcenterimage=false;if("skin"in saved_config&&saved_config["skin"]in defaultSkinOptions)$.extend(wonderplugin_carousel_config,defaultSkinOptions[saved_config["skin"]]);$.extend(wonderplugin_carousel_config,saved_config);wonderplugin_carousel_config.id=carouselId}var i;var j;for(i=0;i<wonderplugin_carousel_config.slides.length;i++){if(!("altusetitle"in
wonderplugin_carousel_config.slides[i]))wonderplugin_carousel_config.slides[i]["altusetitle"]=true;if(!("alt"in wonderplugin_carousel_config.slides[i]))wonderplugin_carousel_config.slides[i]["alt"]="";if(!("lightboxsize"in wonderplugin_carousel_config.slides[i]))wonderplugin_carousel_config.slides[i]["lightboxsize"]=false;if(!("lightboxwidth"in wonderplugin_carousel_config.slides[i]))wonderplugin_carousel_config.slides[i]["lightboxwidth"]=640;if(!("lightboxheight"in wonderplugin_carousel_config.slides[i]))wonderplugin_carousel_config.slides[i]["lightboxheight"]=
480;if(!("clickhandler"in wonderplugin_carousel_config.slides[i]))wonderplugin_carousel_config.slides[i]["clickhandler"]="";if("postlightbox"in wonderplugin_carousel_config.slides[i]){if(wonderplugin_carousel_config.slides[i].postlightbox!==true&&wonderplugin_carousel_config.slides[i].postlightbox!==false)wonderplugin_carousel_config.slides[i].postlightbox=wonderplugin_carousel_config.slides[i].postlightbox&&wonderplugin_carousel_config.slides[i].postlightbox.toLowerCase()==="true";if(wonderplugin_carousel_config.slides[i].postlightboxsize!==
true&&wonderplugin_carousel_config.slides[i].postlightboxsize!==false)wonderplugin_carousel_config.slides[i].postlightboxsize=wonderplugin_carousel_config.slides[i].postlightboxsize&&wonderplugin_carousel_config.slides[i].postlightboxsize.toLowerCase()==="true";if(wonderplugin_carousel_config.slides[i].posttitlelink!==true&&wonderplugin_carousel_config.slides[i].posttitlelink!==false)wonderplugin_carousel_config.slides[i].posttitlelink=wonderplugin_carousel_config.slides[i].posttitlelink&&wonderplugin_carousel_config.slides[i].posttitlelink.toLowerCase()===
"true"}if(wonderplugin_carousel_config.slides[i].type==6){if(!("postorder"in wonderplugin_carousel_config.slides[i]))wonderplugin_carousel_config.slides[i].postorder="DESC";if(!("postdaterange"in wonderplugin_carousel_config.slides[i]))wonderplugin_carousel_config.slides[i].postdaterange=false;else if(wonderplugin_carousel_config.slides[i].postdaterange!==true&&wonderplugin_carousel_config.slides[i].postdaterange!==false)wonderplugin_carousel_config.slides[i].postdaterange=wonderplugin_carousel_config.slides[i].postdaterange&&
wonderplugin_carousel_config.slides[i].postdaterange.toLowerCase()==="true";if(!("postdaterangeafter"in wonderplugin_carousel_config.slides[i]))wonderplugin_carousel_config.slides[i].postdaterangeafter=30}if(wonderplugin_carousel_config.slides[i].type==7){if(!("metatotalsales"in wonderplugin_carousel_config.slides[i]))wonderplugin_carousel_config.slides[i].metatotalsales=false;if(!("metafeatured"in wonderplugin_carousel_config.slides[i]))wonderplugin_carousel_config.slides[i].metafeatured=false;if(!("metarelation"in
wonderplugin_carousel_config.slides[i]))wonderplugin_carousel_config.slides[i].metarelation="OR"}}var slideBoolOptions=["lightbox","lightboxsize","displaythumbnail","weblinklightbox","postdaterange","titlelink","imageaction","imageactionlightbox","openpostinlightbox","postlightboxsize","altusetitle","metatotalsales","metafeatured"];for(i=0;i<wonderplugin_carousel_config.slides.length;i++)for(j=0;j<slideBoolOptions.length;j++)if(slideBoolOptions[j]in wonderplugin_carousel_config.slides[i]){if(wonderplugin_carousel_config.slides[i][slideBoolOptions[j]]!==
true&&wonderplugin_carousel_config.slides[i][slideBoolOptions[j]]!==false)wonderplugin_carousel_config.slides[i][slideBoolOptions[j]]=wonderplugin_carousel_config.slides[i][slideBoolOptions[j]]&&wonderplugin_carousel_config.slides[i][slideBoolOptions[j]].toLowerCase()==="true"}else wonderplugin_carousel_config.slides[i][slideBoolOptions[j]]=false;var boolOptions=["hidecontainerbeforeloaded","hidecontaineroninit","fullwidth","sameheight","sameheightresponsive","newestfirst","centerimage","fitimage",
"fitcenterimage","fixaspectratio","autoplay","random","circular","pauseonmouseover","continuous","responsive","showhoveroverlay","showhoveroverlayalways","hidehoveroverlayontouch","lightboxresponsive","lightboxshownavigation","lightboxnogroup","lightboxshowtitle","lightboxshowdescription","usescreenquery","donotinit","addinitscript","lightboxshowsocial","lightboxshowfacebook","lightboxshowtwitter","lightboxshowpinterest","lightboxsocialrotateeffect","showimgtitle","addwoocommerceclass","donotcircularforless",
"lightboximagekeepratio","showplayvideo","triggerresize","doshortcodeontext","lightboxfullscreenmode","lightboxcloseonoverlay","lightboxvideohidecontrols","lightboxautoslide","lightboxshowtimer","lightboxshowplaybutton","lightboxalwaysshownavarrows","lightboxshowtitleprefix"];for(i=0;i<boolOptions.length;i++)if(wonderplugin_carousel_config[boolOptions[i]]!==true&&wonderplugin_carousel_config[boolOptions[i]]!==false)wonderplugin_carousel_config[boolOptions[i]]=wonderplugin_carousel_config[boolOptions[i]]&&
wonderplugin_carousel_config[boolOptions[i]].toLowerCase()==="true";if(wonderplugin_carousel_config.dataoptions&&wonderplugin_carousel_config.dataoptions.length>0)wonderplugin_carousel_config.dataoptions=wonderplugin_carousel_config.dataoptions.replace(/\\"/g,'"').replace(/\\'/g,"'");var printConfig=function(){$("#wonderplugin-newestfirst").attr("checked",wonderplugin_carousel_config.newestfirst);$("#wonderplugin-carousel-name").val(wonderplugin_carousel_config.name);updateMediaTable();$(".wonderplugin-tab-skin").find("img").removeClass("selected");
$("input:radio[name=wonderplugin-carousel-skin][value="+wonderplugin_carousel_config.skin+"]").attr("checked",true);$("input:radio[name=wonderplugin-carousel-skin][value="+wonderplugin_carousel_config.skin+"]").parent().find("img").addClass("selected");printSkinOptions(wonderplugin_carousel_config);$("#wonderplugin-carousel-imgextraprops").val(wonderplugin_carousel_config.imgextraprops);$("#wonderplugin-carousel-showimgtitle").attr("checked",wonderplugin_carousel_config.showimgtitle);$("#wonderplugin-carousel-imgtitle").val(wonderplugin_carousel_config.imgtitle);
$("#wonderplugin-carousel-addwoocommerceclass").attr("checked",wonderplugin_carousel_config.addwoocommerceclass);$("#wonderplugin-carousel-showplayvideo").attr("checked",wonderplugin_carousel_config.showplayvideo);$("input:radio[name=wonderplugin-carousel-playvideoimagemode][value="+wonderplugin_carousel_config.playvideoimagemode+"]").attr("checked",true);if(wonderplugin_carousel_config.playvideoimagemode=="custom"){$("#wonderplugin-carousel-customplayvideoimage").val(wonderplugin_carousel_config.playvideoimage);
$("#wonderplugin-carousel-displayplayvideoimage").attr("src",wonderplugin_carousel_config.playvideoimage)}else{$("#wonderplugin-carousel-playvideoimage").val(wonderplugin_carousel_config.playvideoimage);$("#wonderplugin-carousel-displayplayvideoimage").attr("src",$("#wonderplugin-carousel-jsfolder").text()+wonderplugin_carousel_config.playvideoimage)}$("#wonderplugin-carousel-playvideoimagepos").val(wonderplugin_carousel_config.playvideoimagepos);$("#wonderplugin-carousel-custom-css").val(wonderplugin_carousel_config.customcss);
$("#wonderplugin-carousel-data-options").val(wonderplugin_carousel_config.dataoptions);$("#wonderplugin-carousel-customjs").val(wonderplugin_carousel_config.customjs);$("#wonderplugin-carousel-lightboxresponsive").attr("checked",wonderplugin_carousel_config.lightboxresponsive);$("#wonderplugin-carousel-lightboxshownavigation").attr("checked",wonderplugin_carousel_config.lightboxshownavigation);$("#wonderplugin-carousel-lightboxnogroup").attr("checked",wonderplugin_carousel_config.lightboxnogroup);
$("#wonderplugin-carousel-lightboxshowtitle").attr("checked",wonderplugin_carousel_config.lightboxshowtitle);$("#wonderplugin-carousel-lightboxshowdescription").attr("checked",wonderplugin_carousel_config.lightboxshowdescription);$("#wonderplugin-carousel-lightboxthumbwidth").val(wonderplugin_carousel_config.lightboxthumbwidth);$("#wonderplugin-carousel-lightboxthumbheight").val(wonderplugin_carousel_config.lightboxthumbheight);$("#wonderplugin-carousel-lightboxthumbtopmargin").val(wonderplugin_carousel_config.lightboxthumbtopmargin);
$("#wonderplugin-carousel-lightboxthumbbottommargin").val(wonderplugin_carousel_config.lightboxthumbbottommargin);$("#wonderplugin-carousel-lightboxbarheight").val(wonderplugin_carousel_config.lightboxbarheight);$("#wonderplugin-carousel-lightboxtitlebottomcss").val(wonderplugin_carousel_config.lightboxtitlebottomcss);$("#wonderplugin-carousel-lightboxdescriptionbottomcss").val(wonderplugin_carousel_config.lightboxdescriptionbottomcss);$("#wonderplugin-carousel-lightboxvideohidecontrols").attr("checked",
wonderplugin_carousel_config.lightboxvideohidecontrols);$("#wonderplugin-carousel-lightboxfullscreenmode").attr("checked",wonderplugin_carousel_config.lightboxfullscreenmode);$("#wonderplugin-carousel-lightboxcloseonoverlay").attr("checked",wonderplugin_carousel_config.lightboxcloseonoverlay);$("#wonderplugin-carousel-lightboxtitlestyle").val(wonderplugin_carousel_config.lightboxtitlestyle);$("#wonderplugin-carousel-lightboximagepercentage").val(wonderplugin_carousel_config.lightboximagepercentage);
$("#wonderplugin-carousel-lightboxdefaultvideovolume").val(wonderplugin_carousel_config.lightboxdefaultvideovolume);$("#wonderplugin-carousel-lightboxoverlaybgcolor").val(wonderplugin_carousel_config.lightboxoverlaybgcolor);$("#wonderplugin-carousel-lightboxoverlayopacity").val(wonderplugin_carousel_config.lightboxoverlayopacity);$("#wonderplugin-carousel-lightboxbgcolor").val(wonderplugin_carousel_config.lightboxbgcolor);$("#wonderplugin-carousel-lightboxtitleprefix").val(wonderplugin_carousel_config.lightboxtitleprefix);
$("#wonderplugin-carousel-lightboxtitleinsidecss").val(wonderplugin_carousel_config.lightboxtitleinsidecss);$("#wonderplugin-carousel-lightboxdescriptioninsidecss").val(wonderplugin_carousel_config.lightboxdescriptioninsidecss);$("#wonderplugin-carousel-lightboxadvancedoptions").val(wonderplugin_carousel_config.lightboxadvancedoptions);$("#wonderplugin-carousel-lightboxautoslide").attr("checked",wonderplugin_carousel_config.lightboxautoslide);$("#wonderplugin-carousel-lightboxshowtimer").attr("checked",
wonderplugin_carousel_config.lightboxshowtimer);$("#wonderplugin-carousel-lightboxshowplaybutton").attr("checked",wonderplugin_carousel_config.lightboxshowplaybutton);$("#wonderplugin-carousel-lightboxalwaysshownavarrows").attr("checked",wonderplugin_carousel_config.lightboxalwaysshownavarrows);$("#wonderplugin-carousel-lightboxshowtitleprefix").attr("checked",wonderplugin_carousel_config.lightboxshowtitleprefix);$("#wonderplugin-carousel-lightboxslideinterval").val(wonderplugin_carousel_config.lightboxslideinterval);
$("#wonderplugin-carousel-lightboxtimerposition").val(wonderplugin_carousel_config.lightboxtimerposition);$("#wonderplugin-carousel-lightboxtimerheight").val(wonderplugin_carousel_config.lightboxtimerheight);$("#wonderplugin-carousel-lightboxtimercolor").val(wonderplugin_carousel_config.lightboxtimercolor);$("#wonderplugin-carousel-lightboxtimeropacity").val(wonderplugin_carousel_config.lightboxtimeropacity);$("#wonderplugin-carousel-lightboxbordersize").val(wonderplugin_carousel_config.lightboxbordersize);
$("#wonderplugin-carousel-lightboxborderradius").val(wonderplugin_carousel_config.lightboxborderradius);$("#wonderplugin-carousel-lightboximagekeepratio").attr("checked",wonderplugin_carousel_config.lightboximagekeepratio);$("#wonderplugin-carousel-lightboxshowsocial").attr("checked",wonderplugin_carousel_config.lightboxshowsocial);$("#wonderplugin-carousel-lightboxsocialposition").val(wonderplugin_carousel_config.lightboxsocialposition);$("#wonderplugin-carousel-lightboxsocialpositionsmallscreen").val(wonderplugin_carousel_config.lightboxsocialpositionsmallscreen);
$("#wonderplugin-carousel-lightboxsocialdirection").val(wonderplugin_carousel_config.lightboxsocialdirection);$("#wonderplugin-carousel-lightboxsocialbuttonsize").val(wonderplugin_carousel_config.lightboxsocialbuttonsize);$("#wonderplugin-carousel-lightboxsocialbuttonfontsize").val(wonderplugin_carousel_config.lightboxsocialbuttonfontsize);$("#wonderplugin-carousel-lightboxsocialrotateeffect").attr("checked",wonderplugin_carousel_config.lightboxsocialrotateeffect);$("#wonderplugin-carousel-lightboxshowfacebook").attr("checked",
wonderplugin_carousel_config.lightboxshowfacebook);$("#wonderplugin-carousel-lightboxshowtwitter").attr("checked",wonderplugin_carousel_config.lightboxshowtwitter);$("#wonderplugin-carousel-lightboxshowpinterest").attr("checked",wonderplugin_carousel_config.lightboxshowpinterest);$("#wonderplugin-carousel-donotinit").attr("checked",wonderplugin_carousel_config.donotinit);$("#wonderplugin-carousel-addinitscript").attr("checked",wonderplugin_carousel_config.addinitscript);$("#wonderplugin-carousel-doshortcodeontext").attr("checked",
wonderplugin_carousel_config.doshortcodeontext);$("#wonderplugin-carousel-triggerresize").attr("checked",wonderplugin_carousel_config.triggerresize);$("#wonderplugin-carousel-triggerresizedelay").val(wonderplugin_carousel_config.triggerresizedelay)};printConfig()});$.fn.wpdraggable=function(callback){this.css("cursor","move").on("mousedown",function(e){var $dragged=$(this);var x=$dragged.offset().left-e.pageX;var y=$dragged.offset().top-e.pageY;var z=$dragged.css("z-index");$(document).on("mousemove.wpdraggable",
function(e){$dragged.css({"z-index":999}).offset({left:x+e.pageX,top:y+e.pageY});e.preventDefault()}).one("mouseup",function(){$(this).off("mousemove.wpdraggable click.wpdraggable");$dragged.css("z-index",z);var i=$dragged.data("order");var coltotal=Math.floor($dragged.parent().parent().parent().innerWidth()/$dragged.parent().parent().outerWidth());var row=Math.floor(($dragged.offset().top-$dragged.parent().parent().parent().offset().top)/$dragged.parent().parent().outerHeight());var col=Math.floor(($dragged.offset().left-
$dragged.parent().parent().parent().offset().left)/$dragged.parent().parent().outerWidth());var j=row*coltotal+col;callback(i,j)});e.preventDefault()});return this}})(jQuery);
(function($){$(document).ready(function(){var wp_replace_list=new Array({"search":"","replace":$("#wp-site-url").text()});init_render();render_list();function update_list(){wp_replace_list=new Array;for(var i=0;;i++){if($("#olddomain"+i).length<=0)break;wp_replace_list.push({"search":$.trim($("#olddomain"+i).val()),"replace":$.trim($("#newdomain"+i).val())})}}function render_list(){var replace_code="";for(var i=0;i<wp_replace_list.length;i++){replace_code+='<p><input type="text" size="40" name="olddomain'+
i+'" id="olddomain'+i+'" placeholder="Old Domain" value="'+wp_replace_list[i].search+'" >';replace_code+='<span class="dashicons dashicons-arrow-right-alt" style="margin:0 12px;line-height:inherit;"></span>';replace_code+='<input type="text" size="40" name="newdomain'+i+'" id="newdomain'+i+'" placeholder="New Domain" value="'+wp_replace_list[i].replace+'" >';replace_code+='<span class="dashicons dashicons-no wp-delete-replace-list" style="margin:0 12px;line-height:inherit;cursor:pointer;" data-listid='+
i+"></span></p>"}$("#wp-search-replace").html(replace_code)}function init_render(){$("body").on("click",".wp-delete-replace-list",function(){update_list();wp_replace_list.splice($(this).data("listid"),1);render_list()});$("#wp-add-replace-list").click(function(){update_list();wp_replace_list.push({"search":"","replace":""});render_list();return false});$("#wp-import-submit").click(function(){if(!$("#wp-importxml").val()){$("#wp-import-error").show().html("<p>Error: please select an exported .xml file.</p>");
return false}else $("#wp-import-error").hide();update_list();for(var i=0;i<wp_replace_list.length;i++){if(wp_replace_list[i].search.length>0&&wp_replace_list[i].replace.length<=0){$("#wp-replace-error").show().html("<p>Error: please enter the new domain or delete the whole row.</p>");return false}if(wp_replace_list[i].search.length<=0&&wp_replace_list[i].replace.length>0){$("#wp-replace-error").show().html("<p>Error: please enter the old domain or delete the whole row.</p>");return false}}})}})})(jQuery);
