tinymce.ui.FloatPanel.zIndex=100100,tinymce.PluginManager.add("wordpress",function(b){var i,t,r,v,a,d,_=tinymce.DOM,c=tinymce.each,s=b.editorManager.i18n.translate,n=0;function e(n){var e,o=0,t="hide"===n;!(e=b.theme.panel?b.theme.panel.find(".toolbar:not(.menubar)"):e)||e.length<2||"hide"===n&&!e[1].visible()||(!n&&e[1].visible()&&(n="hide"),c(e,function(e,t){0/g,function(e,t){return''})),-1!==e.content.indexOf("\x3c!--nextpage--\x3e")&&(n=s("Page break"),e.content=e.content.replace(//g,'')))}),b.on("PostProcess",function(e){e.get&&(e.content=e.content.replace(/]+>/g,function(e){var t,n="";return-1!==e.indexOf('data-wp-more="more"')?e="\x3c!--more"+(n=(t=e.match(/data-wp-more-text="([^"]+)"/))?t[1]:n)+"--\x3e":-1!==e.indexOf('data-wp-more="nextpage"')&&(e="\x3c!--nextpage--\x3e"),e}))}),b.on("ResolveName",function(e){var t;"IMG"===e.target.nodeName&&(t=b.dom.getAttrib(e.target,"data-wp-more"))&&(e.name=t)}),b.addCommand("WP_More",function(e){var t,n="wp-more-tag",o=b.dom,i=b.selection.getNode();n+=" mce-wp-"+(e=e||"more"),t=s("more"===e?"Read more...":"Next page"),e='',"BODY"===i.nodeName||"P"===i.nodeName&&"BODY"===i.parentNode.nodeName?b.insertContent(e):(i=o.getParent(i,function(e){return!(!e.parentNode||"BODY"!==e.parentNode.nodeName)},b.getBody()))&&("P"===i.nodeName?i.appendChild(o.create("p",null,e).firstChild):o.insertAfter(o.create("p",null,e),i),b.nodeChanged())}),b.addCommand("WP_Code",function(){b.formatter.toggle("code")}),b.addCommand("WP_Page",function(){b.execCommand("WP_More","nextpage")}),b.addCommand("WP_Help",function(){b.windowManager.open({url:tinymce.baseURL+"/wp-mce-help.php",title:"Keyboard Shortcuts",width:450,height:420,classes:"wp-help",buttons:{text:"Close",onclick:"close"}})}),b.addCommand("WP_Medialib",function(){"undefined"!=typeof wp&&wp.media&&wp.media.editor&&wp.media.editor.open(b.id)}),b.addButton("wp_more",{tooltip:"Insert Read More tag",onclick:function(){b.execCommand("WP_More","more")}}),b.addButton("wp_page",{tooltip:"Page break",onclick:function(){b.execCommand("WP_More","nextpage")}}),b.addButton("wp_help",{tooltip:"Keyboard Shortcuts",cmd:"WP_Help"}),b.addButton("wp_code",{tooltip:"Code",cmd:"WP_Code",stateSelector:"code"}),"undefined"!=typeof wp&&wp.media&&wp.media.editor&&b.addMenuItem("add_media",{text:"Add Media",icon:"wp-media-library",context:"insert",cmd:"WP_Medialib"}),b.addMenuItem("wp_more",{text:"Insert Read More tag",icon:"wp_more",context:"insert",onclick:function(){b.execCommand("WP_More","more")}}),b.addMenuItem("wp_page",{text:"Page break",icon:"wp_page",context:"insert",onclick:function(){b.execCommand("WP_More","nextpage")}}),b.on("BeforeExecCommand",function(e){!tinymce.Env.webkit||"InsertUnorderedList"!==e.command&&"InsertOrderedList"!==e.command||(t=t||b.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;}"),b.getDoc().head.appendChild(t))}),b.on("ExecCommand",function(e){tinymce.Env.webkit&&t&&("InsertUnorderedList"===e.command||"InsertOrderedList"===e.command)&&b.dom.remove(t)}),b.on("init",function(){var e=tinymce.Env,t=["mceContentBody"],n=b.getDoc(),o=b.dom;tinymce.Env.iOS&&o.addClass(n.documentElement,"ios"),"rtl"===b.getParam("directionality")&&(t.push("rtl"),o.setAttrib(n.documentElement,"dir","rtl")),e.ie?9===parseInt(e.ie,10)?t.push("ie9"):8===parseInt(e.ie,10)?t.push("ie8"):e.ie<8&&t.push("ie7"):e.webkit&&t.push("webkit"),t.push("wp-editor"),c(t,function(e){e&&o.addClass(n.body,e)}),b.on("BeforeSetContent",function(e){e.content&&(e.content=e.content.replace(/

\s*<(p|div|ul|ol|dl|table|blockquote|h[1-6]|fieldset|pre|address)( [^>]*)?>/gi,"<$1$2>"),e.content=e.content.replace(/<\/(p|div|ul|ol|dl|table|blockquote|h[1-6]|fieldset|pre|address)>\s*<\/p>/gi,""))}),void 0!==window.jQuery&&window.jQuery(document).triggerHandler("tinymce-editor-init",[b]),window.tinyMCEPreInit&&window.tinyMCEPreInit.dragDropUpload&&o.bind(n,"dragstart dragend dragover drop",function(e){void 0!==window.jQuery&&window.jQuery(document).trigger(new window.jQuery.Event(e))}),b.getParam("wp_paste_filters",!0)&&(tinymce.Env.webkit||b.on("PastePreProcess",function(e){e.content=e.content.replace(/(<[^>]+) style="[^"]*"([^>]*>)/gi,"$1$2"),e.content=e.content.replace(/(<[^>]+) data-mce-style=([^>]+>)/gi,"$1 style=$2")}),b.on("PastePostProcess",function(e){c(o.select("p",e.node),function(e){o.isEmpty(e)&&o.remove(e)})}))}),void 0!==window.jQuery&&b.on("keyup",function(e){e=e.keyCode||e.charCode;e!==n&&(13!==e&&8!==n&&46!==n||window.jQuery(document).triggerHandler("wpcountwords",[b.getContent({format:"raw"})]),n=e)}),b.on("SaveContent",function(e){b.inline||!b.isHidden()?(e.content=e.content.replace(/

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

 

"),b.getParam("wpautop",!0)&&void 0!==window.switchEditors&&(e.content=window.switchEditors.pre_wpautop(e.content))):e.content=e.element.value}),b.on("BeforeSetContent",function(e){var t=tinymce.Env.webkit?"


":"

";e.content&&(e.content=e.content.replace(/

(?: |\u00a0|\uFEFF|\s)+<\/p>/gi,t))}),b.on("preInit",function(){b.schema.addValidElements("@[id|accesskey|class|dir|lang|style|tabindex|title|contenteditable|draggable|dropzone|hidden|spellcheck|translate],i,b"),tinymce.Env.iOS&&(b.settings.height=300),c({c:"JustifyCenter",r:"JustifyRight",l:"JustifyLeft",j:"JustifyFull",q:"mceBlockQuote",u:"InsertUnorderedList",o:"InsertOrderedList",s:"unlink",m:"WP_Medialib",z:"WP_Adv",t:"WP_More",d:"Strikethrough",h:"WP_Help",p:"WP_Page",x:"WP_Code"},function(e,t){b.shortcuts.add("access+"+t,"",e)}),b.addShortcut("meta+s","",function(){"undefined"!=typeof wp&&wp.autosave&&wp.autosave.server.triggerSave()})}),a=tinymce.ui.Factory,d=b.settings,b.shortcuts.add("alt+119","",function(){var e;r&&(e=r.find("toolbar")[0])&&e.focus(!0)}),b.on("nodechange",function(e){var t=b.selection.isCollapsed(),t={element:e.element,parents:e.parents,collapsed:t};b.fire("wptoolbar",t),v=t.selection||t.element,r&&r.hide(),t.toolbar&&t.toolbar.show()}),b.wp=b.wp||{},b.wp._createToolbar=function(e){var t,n,o=[];function i(){t.hide()}return c(e,function(i){var t;function e(){var e=b.selection;"bullist"===t&&e.selectorChanged("ul > li",function(e,t){for(var n,o=t.parents.length;o--&&"OL"!==(n=t.parents[o].nodeName)&&"UL"!=n;);i.active(e&&"UL"===n)}),"numlist"===t&&e.selectorChanged("ol > li",function(e,t){for(var n,o=t.parents.length;o--&&"OL"!==(n=t.parents[o].nodeName)&&"UL"!==n;);i.active(e&&"OL"===n)}),i.settings.stateSelector&&e.selectorChanged(i.settings.stateSelector,function(e){i.active(e)},!0),i.settings.disabledStateSelector&&e.selectorChanged(i.settings.disabledStateSelector,function(e){i.disabled(e)})}"|"===i?n=null:a.has(i)?(i={type:i},d.toolbar_items_size&&(i.size=d.toolbar_items_size),o.push(i),n=null):(n||(n={type:"buttongroup",items:[]},o.push(n)),b.buttons[i]&&(t=i,(i="function"==typeof(i=b.buttons[t])?i():i).type=i.type||"button",d.toolbar_items_size&&(i.size=d.toolbar_items_size),i=a.create(i),n.items.push(i),b.initialized?e():b.on("init",e)))}),(t=a.create({type:"panel",layout:"stack",classes:"toolbar-grp inline-toolbar-grp",ariaRoot:!0,ariaRemember:!0,items:[{type:"toolbar",layout:"flow",items:o}]})).on("show",function(){(r=this).reposition()}),t.on("hide",function(){r=!1}),t.on("keydown",function(e){27===e.keyCode&&(this.hide(),b.focus())}),t.on("remove",function(){_.unbind(window,"resize scroll",i),b.dom.unbind(b.getWin(),"resize scroll",i),b.off("blur hide",i)}),b.once("init",function(){_.bind(window,"resize scroll",i),b.dom.bind(b.getWin(),"resize scroll",i),b.on("blur hide",i)}),t.reposition=function(){var e,t,n,o,i,r,a,d,c,s,l,m,p,u,g,f,w,h=this.getEl(),y=0;if(v)return n=window.pageYOffset||document.documentElement.scrollTop,o=tinymce.$("#wpadminbar")[0],i=tinymce.$(".mce-toolbar-grp",b.getContainer())[0],a=((r=v.getBoundingClientRect()).left+r.right)/2,d=(r.top+r.bottom)/2,c=r.top,s=void 0-r.bottom,l=window.innerWidth,p=(m=h.offsetWidth)/2,w=document.getElementById(b.id+"_ifr"),u=_.getPos(w),g=w.offsetWidth,w.offsetHeight,(w=(f=h.offsetHeight)+8+5)<=c?(t=" mce-arrow-down",e=r.top+u.y-f-8):w<=s?(t=" mce-arrow-up",e=r.bottom+u.y):(e=5,t=w<=d?" mce-arrow-down":" mce-arrow-up"),i=i?_.getPos(i).y+i.clientHeight:u.y,n&&ig?p=u.x+(g-m)/2:l<=m?(t+=" mce-arrow-full",p=0):p<0&&r.left+m>l||lg+u.x&&(t+=" mce-arrow-right",p=r.right-m+u.x),h.className=h.className.replace(/ ?mce-arrow-[\w]+/g,""),h.className+=t,_.setStyles(h,{left:p,top:e}),this},t.hide().renderTo(document.body),t},{_showButtons:o,_hideButtons:o,_setEmbed:o,_getEmbed:o}});