/** Wonderplugin Video Embed * Copyright 2018 Magic Hills Pty Ltd All Rights Reserved * Website: http://www.wonderplugin.com * Version 1.7 */ (function($){tinymce.PluginManager.add("wpve_mce_button",function(editor,url){editor.addButton("wpve_mce_button",{text:" Video",title:"Wonder Video Embed",icon:true,image:url+"/logo-72.png",onclick:function(){wpve_options_form(editor)}})});function get_url_arams(href){var result={};if(href.indexOf("?")<0)return result;var params=href.substring(href.indexOf("?")+1).split("&");for(var i=0;i/g,">").replace(/"/g,""")}function double_escape_html(s){return escape_html(s).replace(/&/g,"&")}function wpve_options_form(editor){$(".wpve-mce-dialog").remove();var pluginbaseurl="";var helpurl="";var lightboxinstalled=false;if(WONDERPLUGIN_VIDEO_MCE_EDITOR){if(WONDERPLUGIN_VIDEO_MCE_EDITOR.pluginurl&&WONDERPLUGIN_VIDEO_MCE_EDITOR.pluginurl.length>0)pluginbaseurl= WONDERPLUGIN_VIDEO_MCE_EDITOR.pluginurl;if(WONDERPLUGIN_VIDEO_MCE_EDITOR.helpurl&&WONDERPLUGIN_VIDEO_MCE_EDITOR.helpurl.length>0)helpurl=WONDERPLUGIN_VIDEO_MCE_EDITOR.helpurl;if(WONDERPLUGIN_VIDEO_MCE_EDITOR.lightboxinstalled)lightboxinstalled=WONDERPLUGIN_VIDEO_MCE_EDITOR.lightboxinstalled}var videotype="iframe";var iframe="";var mp4="";var webm="";var poster="";var videowidth=600;var videoheight=400;var keepaspectratio=1;var autoplay=0;var loop=0;var videocss="position:relative;display:block;background-color:#000;overflow:hidden;max-width:100%;margin:0 auto;"; var playbutton=pluginbaseurl+"engine/playvideo-64-64-0.png";var lightbox=0;var lightboxsize=1;var lightboxwidth=960;var lightboxheight=540;var lightboxtitle="";var lightboxgroup="";var lightboxshownavigation=0;var autoopen=0;var autoopendelay=0;var autoclose=0;var showimage="";var lightboxoptions="";var form='
';form+='
Video
';form+= '
Lightbox
';form+='
Options
';form+='';form+='
';form+='

';form+='

";form+='
';form+='';form+="
";form+='

"; form+='
';form+="

";form+="
";form+='';form+='';form+="

";form+="

";form+="
"; form+='';form+='';form+="

";form+="

";form+="
";form+='';form+=''; form+="

";form+="
";form+="
";form+='
';form+="* To play in lightbox, Wonder Lightbox must be installed and activated.

';form+='

'; form+='
';form+='

/

';form+="

";form+="
"; form+='';form+='';form+="

";form+='';form+='

';form+='

';form+="

";form+=''; form+='  ';form+="

";form+='

";form+="
";form+="
";form+='
';form+='

/

';form+='

';form+='    ';form+='    

';form+="

* Autoplay does not work on mobile and tablets.

";form+="

";form+='

';form+="

";form+="
";form+='';form+=''; if(pluginbaseurl&&pluginbaseurl.length>0){form+='OR "}form+="

";form+="
";form+='

'; form+="
";$(form).appendTo("body").hide();$(".wpve-mce-dialog").dialog({dialogClass:"wp-dialog",autoOpen:true,height:"auto",width:800,modal:true});if($(".wpve-mce-dialog").dialog("instance")&&$(".wpve-mce-dialog").dialog("instance").uiDialog)if(WONDERPLUGIN_VIDEO_MCE_EDITOR&&WONDERPLUGIN_VIDEO_MCE_EDITOR.zindex)$(".wpve-mce-dialog").dialog("instance").uiDialog.css("z-index",WONDERPLUGIN_VIDEO_MCE_EDITOR.zindex);$(".wpve-mce-submit").click(function(){var content="[wonderplugin_video";var videotype= $('input[name="wpve-videotype"]:checked').val();if(videotype=="iframe"){var iframe=$.trim($('input[name="wpve-iframe"]').val());if(iframe.length<=0){$(".wpve-error-msg").text("Please enter a YouTube, Vimeo, Wistia or iFrame video URL").show();return}content+=' iframe="'+iframe+'"'}else{content+=' videotype="mp4"';var mp4=$.trim($('input[name="wpve-mp4"]').val());if(mp4.length<=0){$(".wpve-error-msg").text("Please enter an MP4 video URL").show();return}content+=' mp4="'+mp4+'"';var webm=$.trim($('input[name="wpve-webm"]').val()); if(webm.length>0)content+=' webm="'+webm+'"';else content+=' webm=""';var poster=$.trim($('input[name="wpve-poster"]').val());if(poster.length>0)content+=' poster="'+poster+'"';else content+=' poster=""'}if($('input[name="wpve-lightbox"]').is(":checked"))content+=" lightbox=1";else content+=" lightbox=0";if($('input[name="wpve-lightboxsize"]').is(":checked"))content+=" lightboxsize=1";else content+=" lightboxsize=0";content+=" lightboxwidth="+$('input[name="wpve-lightboxwidth"]').val()+" lightboxheight="+ $('input[name="wpve-lightboxheight"]').val();if($('input[name="wpve-autoopen"]').is(":checked"))content+=" autoopen=1";else content+=" autoopen=0";content+=" autoopendelay="+$('input[name="wpve-autoopendelay"]').val();if($('input[name="wpve-autoclose"]').is(":checked"))content+=" autoclose=1";else content+=" autoclose=0";var lightboxtitle=$.trim($('input[name="wpve-lightboxtitle"]').val());if(lightboxtitle.length>0)content+=' lightboxtitle="'+double_escape_html(lightboxtitle)+'"';else content+=' lightboxtitle=""'; var lightboxgroup=$.trim($('input[name="wpve-lightboxgroup"]').val());if(lightboxgroup.length>0)content+=' lightboxgroup="'+lightboxgroup+'"';else content+=' lightboxgroup=""';if($('input[name="wpve-lightboxshownavigation"]').is(":checked"))content+=" lightboxshownavigation=1";else content+=" lightboxshownavigation=0";var showimage=$.trim($('input[name="wpve-showimage"]').val());if(showimage.length>0)content+=' showimage="'+showimage+'"';else content+=' showimage=""';var lightboxoptions=$.trim($('textarea[name="wpve-lightboxoptions"]').val()); if(lightboxoptions.length>0)content+=' lightboxoptions="'+double_escape_html(lightboxoptions)+'"';else content+=' lightboxoptions=""';content+=" videowidth="+$('input[name="wpve-videowidth"]').val();content+=" videoheight="+$('input[name="wpve-videoheight"]').val();if($('input[name="wpve-keepaspectratio"]').is(":checked"))content+=" keepaspectratio=1";else content+=" keepaspectratio=0";if($('input[name="wpve-autoplay"]').is(":checked"))content+=" autoplay=1";else content+=" autoplay=0";if($('input[name="wpve-loop"]').is(":checked"))content+= " loop=1";else content+=" loop=0";var videocss=$.trim($('input[name="wpve-videocss"]').val()).replace(/"/g,'\\"');if(videocss.length>0)content+=' videocss="'+videocss+'"';else content+=' videocss=""';var playbutton=$.trim($('input[name="wpve-playbutton"]').val());if(playbutton.length>0)content+=' playbutton="'+playbutton+'"';else content+=' playbutton=""';content+="]";editor.insertContent(content);$(".wpve-mce-dialog").dialog("close")})}})(jQuery);