2 lines
7.0 KiB
JavaScript
2 lines
7.0 KiB
JavaScript
|
!function(){"use strict";var e=function(t){var n=t,l=function(){return n};return{get:l,set:function(e){n=e},clone:function(){return e(l())}}},t=tinymce.util.Tools.resolve("tinymce.PluginManager"),n=tinymce.util.Tools.resolve("tinymce.util.Tools"),l=tinymce.util.Tools.resolve("tinymce.html.DomParser"),i=tinymce.util.Tools.resolve("tinymce.html.Node"),r=tinymce.util.Tools.resolve("tinymce.html.Serializer"),o=function(e){return e.getParam("fullpage_hide_in_source_view")},a=function(e){return e.getParam("fullpage_default_xml_pi")},c=function(e){return e.getParam("fullpage_default_encoding")},s=function(e){return e.getParam("fullpage_default_font_family")},u=function(e){return e.getParam("fullpage_default_font_size")},d=function(e){return e.getParam("fullpage_default_text_color")},f=function(e){return e.getParam("fullpage_default_title")},g=function(e){return e.getParam("fullpage_default_doctype","<!DOCTYPE html>")},m=function(e){return l({validate:!1,root_name:"#document"}).parse(e)},h=m,p=function(e,t){var l,i,r=m(t),o={};function a(e,t){return e.attr(t)||""}return o.fontface=s(e),o.fontsize=u(e),7===(l=r.firstChild).type&&(o.xml_pi=!0,(i=/encoding="([^"]+)"/.exec(l.value))&&(o.docencoding=i[1])),(l=r.getAll("#doctype")[0])&&(o.doctype="<!DOCTYPE"+l.value+">"),(l=r.getAll("title")[0])&&l.firstChild&&(o.title=l.firstChild.value),n.each(r.getAll("meta"),function(e){var t,n=e.attr("name"),l=e.attr("http-equiv");n?o[n.toLowerCase()]=e.attr("content"):"Content-Type"===l&&(t=/charset\s*=\s*(.*)\s*/gi.exec(e.attr("content")))&&(o.docencoding=t[1])}),(l=r.getAll("html")[0])&&(o.langcode=a(l,"lang")||a(l,"xml:lang")),o.stylesheets=[],n.each(r.getAll("link"),function(e){"stylesheet"===e.attr("rel")&&o.stylesheets.push(e.attr("href"))}),(l=r.getAll("body")[0])&&(o.langdir=a(l,"dir"),o.style=a(l,"style"),o.visited_color=a(l,"vlink"),o.link_color=a(l,"link"),o.active_color=a(l,"alink")),o},y=function(e,t,l){var o,a,c,s,u,d=e.dom;function f(e,t,n){e.attr(t,n||undefined)}function g(e){a.firstChild?a.insert(e,a.firstChild):a.append(e)}o=m(l),(a=o.getAll("head")[0])||(s=o.getAll("html")[0],a=new i("head",1),s.firstChild?s.insert(a,s.firstChild,!0):s.append(a)),s=o.firstChild,t.xml_pi?(u='version="1.0"',t.docencoding&&(u+=' encoding="'+t.docencoding+'"'),7!==s.type&&(s=new i("xml",7),o.insert(s,o.firstChild,!0)),s.value=u):s&&7===s.type&&s.remove(),s=o.getAll("#doctype")[0],t.doctype?(s||(s=new i("#doctype",10),t.xml_pi?o.insert(s,o.firstChild):g(s)),s.value=t.doctype.substring(9,t.doctype.length-1)):s&&s.remove(),s=null,n.each(o.getAll("meta"),function(e){"Content-Type"===e.attr("http-equiv")&&(s=e)}),t.docencoding?(s||((s=new i("meta",1)).attr("http-equiv","Content-Type"),s.shortEnded=!0,g(s)),s.attr("content","text/html; charset="+t.docencoding)):s&&s.remove(),s=o.getAll("title")[0],t.title?(s?s.empty():g(s=new i("title",1)),s.append(new i("#text",3)).value=t.title):s&&s.remove(),n.each("keywords,description,author,copyright,robots".split(","),function(e){var n,l,r=o.getAll("meta"),a=t[e];for(n=0;n<r.length;n++)if((l=r[n]).attr("name")===e)return void(a?l.attr("content",a):l.remove());a&&((s=new i("meta",1)).attr("name",e),s.attr("content",a),s.shortEnded=!0,g(s))});var h={};return n.each(o.getAll("link"),function(e){"stylesheet"===e.attr("rel")&&(h[e.attr("href")]=e)}),n.each(t.stylesheets,function(e){h[e]||((s=new i("link",1)).attr({rel:"stylesheet",text:"text/css",href:e}),s.shortEnded=!0,g(s)),delete h[e]}),n.each(h,function(e){e.remove()}),(s=o.getAll("body")[0])&&(f(s,"dir",t.langdir),f(s,"style",t.style),f(s,"vlink",t.visited_color),f(s,"link",t.link_color),f(s,"alink",t.active_color),d.setAttribs(e.getBody(),{style:t.style,dir:t.dir,vLink:t.visited_color,link:t.link_color,aLink:t.active_color})),(s=o.getAll("html")[0])&&(f(s,"lang",t.langcode),f(s,"xml:lang",t.langcode)),a.firstChild||a.remove(),(c=r({validate:!1,indent:!0,apply_source_formatting:!0,indent_before:"head,html,body,meta,title,script,link,style",indent_after:"head,html,body,meta,title,script,link,style"}).serialize(o)).substring(0,c.indexOf("</body>"))},v=function(e,
|