tinymce.ui.FloatPanel.zIndex=100100,tinymce.PluginManager.add("wordpress",function(a){function b(b){var c,d,e,f=0;d="hide"===b,a.theme.panel&&(e=a.theme.panel.find(".toolbar:not(.menubar)")),!e||e.length<2||"hide"===b&&!e[1].visible()||(!b&&e[1].visible()&&(b="hide"),tinymce.each(e,function(a,c){c>0&&("hide"===b?(a.hide(),f+=30):(a.show(),f-=30))}),f&&!d&&(c=a.getContentAreaContainer().firstChild,j.setStyle(c,"height",c.clientHeight+f),"hide"===b?(setUserSetting("hidetb","1"),g&&g.active(!1)):(setUserSetting("hidetb","0"),g&&g.active(!0))))}function c(a){return a.replace(/\[embed\]([\s\S]+?)\[\/embed\][\s\u00a0]*/g,function(a,b){return''+b+''})}function d(a){return a.replace(/]+>/g,function(a){if(-1!==a.indexOf('class="wp-oembed')){var b=a.match(/alt="([^\"]+)"/);b[1]&&(a="[embed]"+b[1]+"[/embed]")}return a})}function e(b,c){var d,e,f,g,h;f=a.dom.getViewPort(a.getWin()),d=j.getPos(a.getContentAreaContainer()),e=a.dom.getPos(b),g=Math.max(e.x-f.x,0)+d.x,h=Math.max(e.y-f.y,0)+d.y,j.setStyles(c,{top:h+5+"px",left:g+5+"px",display:"block"})}function f(){j.hide(j.select("#wp_editbtns, #wp_gallerybtns"))}var g,h,i,j=tinymce.DOM,k=0;return a.addButton("wp_adv",{tooltip:"Toolbar Toggle",cmd:"WP_Adv",onPostRender:function(){g=this}}),a.on("PostRender",function(){"1"===getUserSetting("hidetb","1")&&b("hide")}),a.addCommand("WP_Adv",function(){b()}),a.on("focus",function(){window.wpActiveEditor=a.id}),a.on("BeforeSetContent",function(a){a.content&&(-1!==a.content.indexOf("/g,function(a,b){return''})),-1!==a.content.indexOf("")&&(a.content=a.content.replace(//g,'')))}),a.on("PostProcess",function(a){a.get&&(a.content=a.content.replace(/]+>/g,function(a){var b,c="";return-1!==a.indexOf("wp-more-tag")&&(-1!==a.indexOf("mce-wp-more")?((b=a.match(/data-wp-more="([^"]+)"/))&&(c=b[1]),a=""):-1!==a.indexOf("mce-wp-nextpage")&&(a="")),a}))}),a.on("ResolveName",function(b){var c=a.dom,d=b.target;"IMG"===d.nodeName&&c.hasClass(d,"wp-more-tag")&&(c.hasClass(d,"mce-wp-more")?b.name="more":c.hasClass(d,"mce-wp-nextpage")&&(b.name="nextpage"))}),a.on("PreProcess",function(b){var c;b.save&&(c=a.dom.select("img.wp-more-tag",b.node),c.length&&tinymce.each(c,function(b){var c,d=b.parentNode;"P"===d.nodeName&&d.childNodes.length>1&&(c=a.dom.create("p"),d.parentNode.insertBefore(c,d),c.appendChild(b))}))}),a.addCommand("WP_More",function(b){var c,d,e,f,g,h="wp-more-tag",i=tinymce.Env.ie?"":'
',j=a.dom,k=a.selection.getNode();return b=b||"more",h+=" mce-wp-"+b,e="more"===b?"More...":"Next Page",d='',"BODY"===k.nodeName?void a.insertContent("

"+d+"

"):(c=j.getParent(k,function(a){return a.parentNode&&"BODY"===a.parentNode.nodeName?!0:!1},a.getBody()),void(c&&(f=j.create("p",null,d),j.insertAfter(f,c),(g=f.nextSibling)||(g=j.create("p",null,i),j.insertAfter(g,f)),a.nodeChanged(),a.selection.setCursorLocation(g,0))))}),a.addCommand("WP_Page",function(){a.execCommand("WP_More","nextpage")}),a.addCommand("WP_Help",function(){a.windowManager.open({url:tinymce.baseURL+"/wp-mce-help.php",width:450,height:420,inline:1})}),a.addCommand("WP_Medialib",function(){"undefined"!=typeof wp&&wp.media&&wp.media.editor&&wp.media.editor.open(a.id)}),a.addButton("wp_more",{tooltip:"Insert Read More tag",onclick:function(){a.execCommand("WP_More","more")}}),a.addButton("wp_page",{tooltip:"Page break",onclick:function(){a.execCommand("WP_More","nextpage")}}),a.addButton("wp_help",{tooltip:"Help",cmd:"WP_Help"}),"undefined"!=typeof wp&&wp.media&&wp.media.editor&&a.addMenuItem("add_media",{text:"Add Media",icon:"wp-media-library",context:"insert",cmd:"WP_Medialib"}),a.addMenuItem("wp_more",{text:"Insert Read More tag",icon:"wp_more",context:"insert",onclick:function(){a.execCommand("WP_More","more")}}),a.addMenuItem("wp_page",{text:"Page break",icon:"wp_page",context:"insert",onclick:function(){a.execCommand("WP_More","nextpage")}}),a.on("BeforeExecCommand",function(b){!tinymce.Env.webkit||"InsertUnorderedList"!==b.command&&"InsertOrderedList"!==b.command||(i||(i=a.dom.create("style",{type:"text/css"},"#tinymce,#tinymce span,#tinymce li,#tinymce li>span,#tinymce p,#tinymce p>span{font:medium sans-serif;color:#000;line-height:normal;}")),a.getDoc().head.appendChild(i))}),a.on("ExecCommand",function(b){tinymce.Env.webkit&&i&&("InsertUnorderedList"===b.command||"InsertOrderedList"===b.command)&&a.dom.remove(i)}),a.on("init",function(){var b,c,d=tinymce.Env,e=0,f=["mceContentBody"],g=a.getDoc(),h=a.dom;"rtl"===a.getParam("directionality")&&f.push("rtl"),d.ie&&(9===parseInt(d.ie,10)?f.push("ie9"):8===parseInt(d.ie,10)?f.push("ie8"):d.ie<8&&f.push("ie7")),f.push("wp-editor"),tinymce.each(f,function(a){a&&h.addClass(g.body,a)}),a.on("BeforeSetContent",function(a){a.content&&(a.content=a.content.replace(/

\s*<(p|div|ul|ol|dl|table|blockquote|h[1-6]|fieldset|pre|address)( [^>]*)?>/gi,"<$1$2>"),a.content=a.content.replace(/<\/(p|div|ul|ol|dl|table|blockquote|h[1-6]|fieldset|pre|address)>\s*<\/p>/gi,""))}),"undefined"!=typeof window.jQuery&&window.jQuery(document).triggerHandler("tinymce-editor-init",[a]),"ontouchstart"in window||h.bind(g,"onwheel"in g?"wheel":"mousewheel",function(f){var h,i,j=g.documentElement;a.settings.wp_fullscreen||("function"!=typeof g.hasFocus||g.hasFocus())&&("undefined"!=typeof f.deltaY?(h=f.deltaY,"undefined"!=typeof f.deltaMode&&f.deltaMode===f.DOM_DELTA_LINE&&(h*=20)):h=-f.wheelDelta,d.webkit?g.body.scrollTop+=h:j.scrollTop+=h,i=j.scrollTop||g.body.scrollTop,b===i?(e+=h,window.clearTimeout(c),c=window.setTimeout(function(){e=0},1e3)):e=0,b=i,e>1e3||-1e3>e||f.preventDefault())}),h.bind(g,"dragstart dragend dragover drop",function(a){"undefined"!=typeof window.jQuery&&window.jQuery(document).triggerHandler(a.type)})}),"undefined"!=typeof window.jQuery&&a.on("keyup",function(b){var c=b.keyCode||b.charCode;c!==k&&((13===c||8===k||46===k)&&window.jQuery(document).triggerHandler("wpcountwords",[a.getContent({format:"raw"})]),k=c)}),a.on("SaveContent",function(b){return a.isHidden()?void(b.content=b.element.value):(b.content=b.content.replace(/

(
|\u00a0|\uFEFF)?<\/p>/g,"

 

"),void(a.getParam("wpautop",!0)&&"undefined"!=typeof window.switchEditors&&(b.content=window.switchEditors.pre_wpautop(b.content))))}),a.on("preInit",function(){a.schema.addValidElements("@[id|accesskey|class|dir|lang|style|tabindex|title|contenteditable|draggable|dropzone|hidden|spellcheck|translate],i,b")}),h="alt+shift",a.addShortcut(h+"+c","","JustifyCenter"),a.addShortcut(h+"+r","","JustifyRight"),a.addShortcut(h+"+l","","JustifyLeft"),a.addShortcut(h+"+j","","JustifyFull"),a.addShortcut(h+"+q","","mceBlockQuote"),a.addShortcut(h+"+u","","InsertUnorderedList"),a.addShortcut(h+"+o","","InsertOrderedList"),a.addShortcut(h+"+n","","mceSpellCheck"),a.addShortcut(h+"+s","","unlink"),a.addShortcut(h+"+m","","WP_Medialib"),a.addShortcut(h+"+z","","WP_Adv"),a.addShortcut(h+"+t","","WP_More"),a.addShortcut(h+"+d","","Strikethrough"),a.addShortcut(h+"+h","","WP_Help"),a.addShortcut(h+"+p","","WP_Page"),a.addShortcut("ctrl+s","",function(){"undefined"!=typeof wp&&wp.autosave&&wp.autosave.server.triggerSave()}),a.on("init",function(){a.dom.bind(a.getWin(),"scroll",function(){f()}),a.dom.bind(a.getBody(),"dragstart",function(){f()})}),a.on("BeforeExecCommand",function(){f()}),a.on("SaveContent",function(){f()}),a.on("MouseDown",function(a){"IMG"!==a.target.nodeName&&f()}),a.on("keydown",function(a){(a.which===tinymce.util.VK.DELETE||a.which===tinymce.util.VK.BACKSPACE)&&f()}),{_showButtons:e,_hideButtons:f,_setEmbed:c,_getEmbed:d}});