| 1 |
if(jQuery(document).ready((function($){$("body").on("click","#wpzinc-tinymce-modal div.mce-cancel button, .wpzinc-backbone-modal .media-frame-toolbar .media-toolbar button.cancel",(function(t){"undefined"==typeof tinyMCE||!tinyMCE.activeEditor||tinyMCE.activeEditor.isHidden()?(wpZincModal.close(),void 0!==wpZincModal&&wpZincModal.content(new wpZincModalContent)):tinymce.activeEditor.windowManager.close()})),$("body").on("click","#wpzinc-tinymce-modal div.mce-insert button, .wpzinc-backbone-modal .media-frame-toolbar .media-toolbar button.insert",(function(t){t.preventDefault();var e=$("form.wpzinc-tinymce-popup"),n="["+$('input[name="shortcode"]',$(e)).val(),i=!1;$("input, select, textarea",$(e)).each((function(t){if(void 0===$(this).data("shortcode"))return!0;if(!$(this).val())return!0;if(0==$(this).val().length)return!0;var e=$(this).data("shortcode"),o="0"!=$(this).data("trim"),a=$(this).val();return!e.length||(e.search("}")>-1&&e.search("{")>-1&&(e=e.replace(/{|}/gi,(function(t){return""})),e=$(e,$(this).parent().parent()).val()),void 0!==$(this).data("shortcode-prepend")&&(e=$(this).data("shortcode-prepend")+e),Array.isArray(a)&&(a=a.join(",")),o&&(a=a.trim()),"1"==$(this).data("enclose")?(i=a,!0):void(n+=" "+e.trim()+'="'+a+'"'))})),n+="]",i&&(n+=i+"[/"+$('input[name="shortcode"]',$(e)).val()+"]");let o=$('input[name="editor_type"]',$(e)).val();switch(o){case"tinymce":"undefined"!=typeof tinyMCE&&tinyMCE.activeEditor&&!tinyMCE.activeEditor.isHidden()&&(tinyMCE.activeEditor.execCommand("mceReplaceContent",!1,n),tinyMCE.activeEditor.windowManager.close());break;case"quicktags":QTags.insertContent(n),wpZincModal.close(),void 0!==wpZincModal&&wpZincModal.content(new wpZincModalContent);break;default:$(o).val(n),wpZincModal.close(),void 0!==wpZincModal&&wpZincModal.content(new wpZincModalContent);break}}))})),"undefined"!=typeof wp&&void 0!==wp.media){var wpZincModal=new wp.media.view.Modal({controller:{trigger:function(){}},className:"wpzinc-backbone-modal"}),wpZincModalContent=wp.Backbone.View.extend({template:wp.template("wpzinc-modal")});wpZincModal.content(new wpZincModalContent)} |