!function(){var a={},b=function(b){for(var c=a[b],e=c.deps,f=c.defn,g=e.length,h=new Array(g),i=0;i"})}),c},c=function(a){return a.replace(//g,function(a,b){return unescape(b)})};return{protectHtml:b,unprotectHtml:c}}),g("0",["1","2","3","4","5","6"],function(a,b,c,d,e,f){return d.add("fullpage",function(d){function g(){var a=h();d.windowManager.open({title:"Document properties",data:a,defaults:{type:"textbox",size:40},body:[{name:"title",label:"Title"},{name:"keywords",label:"Keywords"},{name:"description",label:"Description"},{name:"robots",label:"Robots"},{name:"author",label:"Author"},{name:"docencoding",label:"Encoding"}],onSubmit:function(b){i(e.extend(a,b.data))}})}function h(){function a(a,b){var c=a.attr(b);return c||""}var b,c,f=j(),g={};return g.fontface=d.getParam("fullpage_default_fontface",""),g.fontsize=d.getParam("fullpage_default_fontsize",""),b=f.firstChild,7==b.type&&(g.xml_pi=!0,c=/encoding="([^"]+)"/.exec(b.value),c&&(g.docencoding=c[1])),b=f.getAll("#doctype")[0],b&&(g.doctype=""),b=f.getAll("title")[0],b&&b.firstChild&&(g.title=b.firstChild.value),p(f.getAll("meta"),function(a){var b,c=a.attr("name"),d=a.attr("http-equiv");c?g[c.toLowerCase()]=a.attr("content"):"Content-Type"==d&&(b=/charset\s*=\s*(.*)\s*/gi.exec(a.attr("content")),b&&(g.docencoding=b[1]))}),b=f.getAll("html")[0],b&&(g.langcode=a(b,"lang")||a(b,"xml:lang")),g.stylesheets=[],e.each(f.getAll("link"),function(a){"stylesheet"==a.attr("rel")&&g.stylesheets.push(a.attr("href"))}),b=f.getAll("body")[0],b&&(g.langdir=a(b,"dir"),g.style=a(b,"style"),g.visited_color=a(b,"vlink"),g.link_color=a(b,"link"),g.active_color=a(b,"alink")),g}function i(a){function f(a,b,c){a.attr(b,c?c:void 0)}function g(a){i.firstChild?i.insert(a,i.firstChild):i.append(a)}var h,i,k,l,m,o=d.dom;h=j(),i=h.getAll("head")[0],i||(l=h.getAll("html")[0],i=new b("head",1),l.firstChild?l.insert(i,l.firstChild,!0):l.append(i)),l=h.firstChild,a.xml_pi?(m='version="1.0"',a.docencoding&&(m+=' encoding="'+a.docencoding+'"'),7!=l.type&&(l=new b("xml",7),h.insert(l,h.firstChild,!0)),l.value=m):l&&7==l.type&&l.remove(),l=h.getAll("#doctype")[0],a.doctype?(l||(l=new b("#doctype",10),a.xml_pi?h.insert(l,h.firstChild):g(l)),l.value=a.doctype.substring(9,a.doctype.length-1)):l&&l.remove(),l=null,p(h.getAll("meta"),function(a){"Content-Type"==a.attr("http-equiv")&&(l=a)}),a.docencoding?(l||(l=new b("meta",1),l.attr("http-equiv","Content-Type"),l.shortEnded=!0,g(l)),l.attr("content","text/html; charset="+a.docencoding)):l&&l.remove(),l=h.getAll("title")[0],a.title?(l?l.empty():(l=new b("title",1),g(l)),l.append(new b("#text",3)).value=a.title):l&&l.remove(),p("keywords,description,author,copyright,robots".split(","),function(c){var d,e,f=h.getAll("meta"),i=a[c];for(d=0;d"))}function j(){return new a({validate:!1,root_name:"#document"}).parse(n)}function k(a){function b(a){return a.replace(/<\/?[A-Z]+/g,function(a){return a.toLowerCase()})}var c,g,h,i,k,m="",q=d.dom;if(!(a.selection||(h=f.protectHtml(d.settings.protect,a.content),"raw"==a.format&&n||a.source_view&&d.getParam("fullpage_hide_in_source_view")))){0!==h.length||a.source_view||(h=e.trim(n)+"\n"+e.trim(h)+"\n"+e.trim(o)),h=h.replace(/<(\/?)BODY/gi,"<$1body"),c=h.indexOf("",c),n=b(h.substring(0,c+1)),g=h.indexOf("\n"),i=j(),p(i.getAll("style"),function(a){a.firstChild&&(m+=a.firstChild.value)}),k=i.getAll("body")[0],k&&q.setAttribs(d.getBody(),{style:k.attr("style")||"",dir:k.attr("dir")||"",vLink:k.attr("vlink")||"",link:k.attr("link")||"",aLink:k.attr("alink")||""}),q.remove("fullpage_styles");var r=d.getDoc().getElementsByTagName("head")[0];m&&(q.add(r,"style",{id:"fullpage_styles"},m),k=q.get("fullpage_styles"),k.styleSheet&&(k.styleSheet.cssText=m));var s={};e.each(r.getElementsByTagName("link"),function(a){"stylesheet"==a.rel&&a.getAttribute("data-mce-fullpage")&&(s[a.href]=a)}),e.each(i.getAll("link"),function(a){var b=a.attr("href");return!b||(s[b]||"stylesheet"!=a.attr("rel")||q.add(r,"link",{rel:"stylesheet",text:"text/css",href:b,"data-mce-fullpage":"1"}),void delete s[b])}),e.each(s,function(a){a.parentNode.removeChild(a)})}}function l(){var a,b="",c="";return d.getParam("fullpage_default_xml_pi")&&(b+='\n'),b+=d.getParam("fullpage_default_doctype",""),b+="\n\n\n",(a=d.getParam("fullpage_default_title"))&&(b+=""+a+"\n"),(a=d.getParam("fullpage_default_encoding"))&&(b+='\n'),(a=d.getParam("fullpage_default_font_family"))&&(c+="font-family: "+a+";"),(a=d.getParam("fullpage_default_font_size"))&&(c+="font-size: "+a+";"),(a=d.getParam("fullpage_default_text_color"))&&(c+="color: "+a+";"),b+="\n\n"}function m(a){a.selection||a.source_view&&d.getParam("fullpage_hide_in_source_view")||(a.content=f.unprotectHtml(e.trim(n)+"\n"+e.trim(a.content)+"\n"+e.trim(o)))}var n,o,p=e.each;d.addCommand("mceFullPageProperties",g),d.addButton("fullpage",{title:"Document properties",cmd:"mceFullPageProperties"}),d.addMenuItem("fullpage",{text:"Document properties",cmd:"mceFullPageProperties",context:"file"}),d.on("BeforeSetContent",k),d.on("GetContent",m)}),function(){}}),d("0")()}();