/*! This file is auto-generated */ !function(n,v,i,x){"use strict";var l={},r={};v.mce=v.mce||{},v.mce.views={register:function(e,t){l[e]=v.mce.View.extend(_.extend(t,{type:e}))},unregister:function(e){delete l[e]},get:function(e){return l[e]},unbind:function(){_.each(r,function(e){e.unbind()})},setMarkers:function(e,a){var r,t,d=[{content:e}],c=this;return _.each(l,function(s,o){t=d.slice(),d=[],_.each(t,function(e){var t,n,i=e.content;if(e.processed)d.push(e);else{for(;i&&(t=s.prototype.match(i));)t.index&&d.push({content:i.substring(0,t.index)}),t.options.editor=a,n=(r=c.createInstance(o,t.content,t.options)).loader?".":r.text,d.push({content:r.ignore?n:'

'+n+"

",processed:!0}),i=i.slice(t.index+t.content.length);i&&d.push({content:i})}})}),(e=_.pluck(d,"content").join("")).replace(/

\s*

")},createInstance:function(e,t,n,i){var s,o,a=this.get(e);return-1!==t.indexOf("[")&&-1!==t.indexOf("]")&&(t=t.replace(/\[[^\]]+\]/g,function(e){return e.replace(/[\r\n]/g,"")})),!i&&(o=this.getInstance(t))?o:(s=encodeURIComponent(t),n=_.extend(n||{},{text:t,encodedText:s}),r[s]=new a(n))},getInstance:function(e){return"string"==typeof e?r[encodeURIComponent(e)]:r[x(e).attr("data-wpview-text")]},getText:function(e){return decodeURIComponent(x(e).attr("data-wpview-text")||"")},render:function(t){_.each(r,function(e){e.render(null,t)})},update:function(e,t,n,i){var s=this.getInstance(n);s&&s.update(e,t,n,i)},edit:function(n,i){var s=this.getInstance(i);s&&s.edit&&s.edit(s.text,function(e,t){s.update(e,n,i,t)})},remove:function(e,t){var n=this.getInstance(t);n&&n.remove(e,t)}},v.mce.View=function(e){_.extend(this,e),this.initialize()},v.mce.View.extend=Backbone.View.extend,_.extend(v.mce.View.prototype,{content:null,loader:!0,initialize:function(){},getContent:function(){return this.content},render:function(e,t){null!=e&&(this.content=e),e=this.getContent(),(this.loader||e)&&(t&&this.unbind(),this.replaceMarkers(),e?this.setContent(e,function(e,t){x(t).data("rendered",!0),this.bindNode.call(this,e,t)},!!t&&null):this.setLoader())},bindNode:function(){},unbindNode:function(){},unbind:function(){this.getNodes(function(e,t){this.unbindNode.call(this,e,t)},!0)},getEditors:function(t){_.each(tinymce.editors,function(e){e.plugins.wpview&&t.call(this,e)},this)},getNodes:function(n,i){this.getEditors(function(e){var t=this;x(e.getBody()).find('[data-wpview-text="'+t.encodedText+'"]').filter(function(){var e;return null==i||(e=!0===x(this).data("rendered"),i?e:!e)}).each(function(){n.call(t,e,this,this)})})},getMarkers:function(n){this.getEditors(function(e){var t=this;x(e.getBody()).find('[data-wpview-marker="'+this.encodedText+'"]').each(function(){n.call(t,e,this)})})},replaceMarkers:function(){this.getMarkers(function(e,t){var n,i=t===e.selection.getNode();this.loader||x(t).text()===tinymce.DOM.decode(this.text)?(n=e.$('

'),e.undoManager.ignore(function(){e.$(t).replaceWith(n)}),i&&setTimeout(function(){e.undoManager.ignore(function(){e.selection.select(n[0]),e.selection.collapse()})})):e.dom.setAttrib(t,"data-wpview-marker",null)})},removeMarkers:function(){this.getMarkers(function(e,t){e.dom.setAttrib(t,"data-wpview-marker",null)})},setContent:function(n,i,e){_.isObject(n)&&(n.sandbox||n.head||-1!==n.body.indexOf("'),e.undoManager.transact(function(){t.innerHTML="",t.appendChild(_.isString(n)?e.dom.createFragment(n):n),e.dom.add(t,"span",{class:"wpview-end"})}),i&&i.call(this,e,t)},e)},setIframes:function(f,m,g,e){var w=this;if(-1!==m.indexOf("[")&&-1!==m.indexOf("]")){var t=new RegExp("\\[\\/?(?:"+n.mceViewL10n.shortcodes.join("|")+")[^\\]]*?\\]","g");m=m.replace(t,function(e){return e.replace(//g,">")})}this.getNodes(function(t,e){var n,i,s,o,a,r,d=t.dom,c="",l=t.getBody().className||"",u=t.getDoc().getElementsByTagName("head")[0];if(tinymce.each(d.$('link[rel="stylesheet"]',u),function(e){e.href&&-1===e.href.indexOf("skins/lightgray/content.min.css")&&-1===e.href.indexOf("skins/wordpress/wp-content.css")&&(c+=d.getOuterHTML(e))}),w.iframeHeight&&d.add(e,"span",{"data-mce-bogus":1,style:{display:"block",width:"100%",height:w.iframeHeight}},"\u200b"),t.undoManager.transact(function(){e.innerHTML="",n=d.add(e,"iframe",{src:tinymce.Env.ie?'javascript:""':"",frameBorder:"0",allowTransparency:"true",scrolling:"no",class:"wpview-sandbox",style:{width:"100%",display:"block"},height:w.iframeHeight}),d.add(e,"span",{class:"mce-shim"}),d.add(e,"span",{class:"wpview-end"})}),n.contentWindow){if(i=n.contentWindow,(s=i.document).open(),s.write(''+f+c+''+m+""),s.close(),w.iframeHeight&&(r=!0,setTimeout(function(){r=!1,h()},3e3)),x(i).on("load",h).on("unload",function(){t.isHidden()||(x(e).data("rendered",null),setTimeout(function(){v.mce.views.render()}))}),o=i.MutationObserver||i.WebKitMutationObserver||i.MozMutationObserver)s.body?p():s.addEventListener("DOMContentLoaded",p,!1);else for(a=1;a<6;a++)setTimeout(h,700*a);g&&g.call(w,t,e)}function h(){var e;r||n.contentWindow&&(e=x(n),w.iframeHeight=x(s.body).height(),e.height()!==w.iframeHeight&&(e.height(w.iframeHeight),t.nodeChanged()))}function p(){new o(_.debounce(h,100)).observe(s.body,{attributes:!0,childList:!0,subtree:!0})}},e)},setLoader:function(e){this.setContent('
')},setError:function(e,t){this.setContent('

'+e+"

")},match:function(e){var t=i.next(this.type,e);if(t)return{index:t.index,content:t.content,options:{shortcode:t.shortcode}}},update:function(i,s,o,a){_.find(l,function(e,t){var n=e.prototype.match(i);if(n)return x(o).data("rendered",!1),s.dom.setAttrib(o,"data-wpview-text",encodeURIComponent(i)),v.mce.views.createInstance(t,i,n.options,a).render(),s.selection.select(o),s.nodeChanged(),s.focus(),!0})},remove:function(e,t){this.unbindNode.call(this,e,t),e.dom.remove(t),e.focus()}})}(window,window.wp,window.wp.shortcode,window.jQuery),function(n,e,s,o){var t,i,a,r,d,c,l;function u(e){var t={};return n.tinymce?!e||-1===e.indexOf("<")&&-1===e.indexOf(">")?e:(d=d||new n.tinymce.html.Schema(t),c=c||new n.tinymce.html.DomParser(t,d),(l=l||new n.tinymce.html.Serializer(t,d)).serialize(c.parse(e,{forced_root_block:!1}))):e.replace(/<[^>]+>/g,"")}t={state:[],edit:function(e,t){var n=this.type,i=s[n].edit(e);this.pausePlayers&&this.pausePlayers(),_.each(this.state,function(e){i.state(e).on("update",function(e){t(s[n].shortcode(e).string(),"gallery"===n)})}),i.on("close",function(){i.detach()}),i.open()}},i=_.extend({},t,{state:["gallery-edit"],template:s.template("editor-gallery"),initialize:function(){var e=s.gallery.attachments(this.shortcode,s.view.settings.post.id),t=this.shortcode.attrs.named,n=this;e.more().done(function(){e=e.toJSON(),_.each(e,function(e){e.sizes&&(t.size&&e.sizes[t.size]?e.thumbnail=e.sizes[t.size]:e.sizes.thumbnail?e.thumbnail=e.sizes.thumbnail:e.sizes.full&&(e.thumbnail=e.sizes.full))}),n.render(n.template({verifyHTML:u,attachments:e,columns:t.columns?parseInt(t.columns,10):s.galleryDefaults.columns}))}).fail(function(e,t){n.setError(t)})}}),a=_.extend({},t,{action:"parse-media-shortcode",initialize:function(){var t=this,e=null;this.url&&(this.loader=!1,this.shortcode=s.embed.shortcode({url:this.text})),t.editor&&(e=t.editor.getBody().clientWidth),wp.ajax.post(this.action,{post_ID:s.view.settings.post.id,type:this.shortcode.tag,shortcode:this.shortcode.string(),maxwidth:e}).done(function(e){t.render(e)}).fail(function(e){t.url?(t.ignore=!0,t.removeMarkers()):t.setError(e.message||e.statusText,"admin-media")}),this.getEditors(function(e){e.on("wpview-selected",function(){t.pausePlayers()})})},pausePlayers:function(){this.getNodes(function(e,t,n){var i=o("iframe.wpview-sandbox",n).get(0);(i=i&&i.contentWindow)&&i.mejs&&_.each(i.mejs.players,function(e){try{e.pause()}catch(e){}})})}}),r=_.extend({},a,{action:"parse-embed",edit:function(e,t){var n=s.embed.edit(e,this.url),i=this;this.pausePlayers(),n.state("embed").props.on("change:url",function(e,t){t&&e.get("url")&&(n.state("embed").metadata=e.toJSON())}),n.state("embed").on("select",function(){var e=n.state("embed").metadata;i.url?t(e.url):t(s.embed.shortcode(e).string())}),n.on("close",function(){n.detach()}),n.open()}}),e.register("gallery",_.extend({},i)),e.register("audio",_.extend({},a,{state:["audio-details"]})),e.register("video",_.extend({},a,{state:["video-details"]})),e.register("playlist",_.extend({},a,{state:["playlist-edit","video-playlist-edit"]})),e.register("embed",_.extend({},r)),e.register("embedURL",_.extend({},r,{match:function(e){var t=/(^|

(?:]+>\s*<\/span>)?)(https?:\/\/[^\s"]+?)((?:]+>\s*<\/span>)?<\/p>\s*|$)/gi.exec(e);if(t)return{index:t.index+t[1].length,content:t[2],options:{url:!0}}}}))}(window,window.wp.mce.views,window.wp.media,window.jQuery);