src/pyams_skin/resources/js/ext/tinymce/dev/plugins/fullpage/plugin.min.js
changeset 557 bca7a7e058a3
equal deleted inserted replaced
-1:000000000000 557:bca7a7e058a3
       
     1 tinymce.PluginManager.add("fullpage",function(d){var j=tinymce.each,f=tinymce.html.Node;var h,k;function i(){var m=l();d.windowManager.open({title:"Document properties",data:m,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(n){g(tinymce.extend(m,n.data))}})}function l(){var n=e(),p={},q,o;function m(t,r){var s=t.attr(r);return s||""}p.fontface=d.getParam("fullpage_default_fontface","");p.fontsize=d.getParam("fullpage_default_fontsize","");q=n.firstChild;if(q.type==7){p.xml_pi=true;o=/encoding="([^"]+)"/.exec(q.value);if(o){p.docencoding=o[1]}}q=n.getAll("#doctype")[0];if(q){p.doctype="<!DOCTYPE"+q.value+">"}q=n.getAll("title")[0];if(q&&q.firstChild){p.title=q.firstChild.value}j(n.getAll("meta"),function(u){var s=u.attr("name"),r=u.attr("http-equiv"),t;if(s){p[s.toLowerCase()]=u.attr("content")}else{if(r=="Content-Type"){t=/charset\s*=\s*(.*)\s*/gi.exec(u.attr("content"));if(t){p.docencoding=t[1]}}}});q=n.getAll("html")[0];if(q){p.langcode=m(q,"lang")||m(q,"xml:lang")}p.stylesheets=[];tinymce.each(n.getAll("link"),function(r){if(r.attr("rel")=="stylesheet"){p.stylesheets.push(r.attr("href"))}});q=n.getAll("body")[0];if(q){p.langdir=m(q,"dir");p.style=m(q,"style");p.visited_color=m(q,"vlink");p.link_color=m(q,"link");p.active_color=m(q,"alink")}return p}function g(q){var p,n,s,u,v,o=d.dom;function m(y,w,x){y.attr(w,x?x:undefined)}function t(w){if(n.firstChild){n.insert(w,n.firstChild)}else{n.append(w)}}p=e();n=p.getAll("head")[0];if(!n){u=p.getAll("html")[0];n=new f("head",1);if(u.firstChild){u.insert(n,u.firstChild,true)}else{u.append(n)}}u=p.firstChild;if(q.xml_pi){v='version="1.0"';if(q.docencoding){v+=' encoding="'+q.docencoding+'"'}if(u.type!=7){u=new f("xml",7);p.insert(u,p.firstChild,true)}u.value=v}else{if(u&&u.type==7){u.remove()}}u=p.getAll("#doctype")[0];if(q.doctype){if(!u){u=new f("#doctype",10);if(q.xml_pi){p.insert(u,p.firstChild)}else{t(u)}}u.value=q.doctype.substring(9,q.doctype.length-1)}else{if(u){u.remove()}}u=null;j(p.getAll("meta"),function(w){if(w.attr("http-equiv")=="Content-Type"){u=w}});if(q.docencoding){if(!u){u=new f("meta",1);u.attr("http-equiv","Content-Type");u.shortEnded=true;t(u)}u.attr("content","text/html; charset="+q.docencoding)}else{if(u){u.remove()}}u=p.getAll("title")[0];if(q.title){if(!u){u=new f("title",1);t(u)}else{u.empty()}u.append(new f("#text",3)).value=q.title}else{if(u){u.remove()}}j("keywords,description,author,copyright,robots".split(","),function(x){var w=p.getAll("meta"),y,A,z=q[x];for(y=0;y<w.length;y++){A=w[y];if(A.attr("name")==x){if(z){A.attr("content",z)}else{A.remove()}return}}if(z){u=new f("meta",1);u.attr("name",x);u.attr("content",z);u.shortEnded=true;t(u)}});var r={};tinymce.each(p.getAll("link"),function(w){if(w.attr("rel")=="stylesheet"){r[w.attr("href")]=w}});tinymce.each(q.stylesheets,function(w){if(!r[w]){u=new f("link",1);u.attr({rel:"stylesheet",text:"text/css",href:w});u.shortEnded=true;t(u)}delete r[w]});tinymce.each(r,function(w){w.remove()});u=p.getAll("body")[0];if(u){m(u,"dir",q.langdir);m(u,"style",q.style);m(u,"vlink",q.visited_color);m(u,"link",q.link_color);m(u,"alink",q.active_color);o.setAttribs(d.getBody(),{style:q.style,dir:q.dir,vLink:q.visited_color,link:q.link_color,aLink:q.active_color})}u=p.getAll("html")[0];if(u){m(u,"lang",q.langcode);m(u,"xml:lang",q.langcode)}if(!n.firstChild){n.remove()}s=new tinymce.html.Serializer({validate:false,indent:true,apply_source_formatting:true,indent_before:"head,html,body,meta,title,script,link,style",indent_after:"head,html,body,meta,title,script,link,style"}).serialize(p);h=s.substring(0,s.indexOf("</body>"))}function e(){return new tinymce.html.DomParser({validate:false,root_name:"#document"}).parse(h)}function b(v){var s,m,r=v.content,o,w="",n=d.dom,t;if(v.selection){return}function u(x){return x.replace(/<\/?[A-Z]+/g,function(y){return y.toLowerCase()})}if(v.format=="raw"&&h){return}if(v.source_view&&d.getParam("fullpage_hide_in_source_view")){return}if(r.length===0&&!v.source_view){r=tinymce.trim(h)+"\n"+tinymce.trim(r)+"\n"+tinymce.trim(k)}r=r.replace(/<(\/?)BODY/gi,"<$1body");s=r.indexOf("<body");if(s!=-1){s=r.indexOf(">",s);h=u(r.substring(0,s+1));m=r.indexOf("</body",s);if(m==-1){m=r.length}v.content=r.substring(s+1,m);k=u(r.substring(m))}else{h=a();k="\n</body>\n</html>"}o=e();j(o.getAll("style"),function(x){if(x.firstChild){w+=x.firstChild.value}});t=o.getAll("body")[0];if(t){n.setAttribs(d.getBody(),{style:t.attr("style")||"",dir:t.attr("dir")||"",vLink:t.attr("vlink")||"",link:t.attr("link")||"",aLink:t.attr("alink")||""})}n.remove("fullpage_styles");var q=d.getDoc().getElementsByTagName("head")[0];if(w){n.add(q,"style",{id:"fullpage_styles"},w);t=n.get("fullpage_styles");if(t.styleSheet){t.styleSheet.cssText=w}}var p={};tinymce.each(q.getElementsByTagName("link"),function(x){if(x.rel=="stylesheet"&&x.getAttribute("data-mce-fullpage")){p[x.href]=x}});tinymce.each(o.getAll("link"),function(y){var x=y.attr("href");if(!p[x]&&y.attr("rel")=="stylesheet"){n.add(q,"link",{rel:"stylesheet",text:"text/css",href:x,"data-mce-fullpage":"1"})}delete p[x]});tinymce.each(p,function(x){x.parentNode.removeChild(x)})}function a(){var o="",n,m="";if(d.getParam("fullpage_default_xml_pi")){o+='<?xml version="1.0" encoding="'+d.getParam("fullpage_default_encoding","ISO-8859-1")+'" ?>\n'}o+=d.getParam("fullpage_default_doctype","<!DOCTYPE html>");o+="\n<html>\n<head>\n";if((n=d.getParam("fullpage_default_title"))){o+="<title>"+n+"</title>\n"}if((n=d.getParam("fullpage_default_encoding"))){o+='<meta http-equiv="Content-Type" content="text/html; charset='+n+'" />\n'}if((n=d.getParam("fullpage_default_font_family"))){m+="font-family: "+n+";"}if((n=d.getParam("fullpage_default_font_size"))){m+="font-size: "+n+";"}if((n=d.getParam("fullpage_default_text_color"))){m+="color: "+n+";"}o+="</head>\n<body"+(m?' style="'+m+'"':"")+">\n";return o}function c(m){if(!m.selection&&(!m.source_view||!d.getParam("fullpage_hide_in_source_view"))){m.content=tinymce.trim(h)+"\n"+tinymce.trim(m.content)+"\n"+tinymce.trim(k)}}d.addCommand("mceFullPageProperties",i);d.addButton("fullpage",{title:"Document properties",cmd:"mceFullPageProperties"});d.addMenuItem("fullpage",{text:"Document properties",cmd:"mceFullPageProperties",context:"file"});d.on("BeforeSetContent",b);d.on("GetContent",c)});