return "rgb(" + parseInt(s.substring(0, 2), 16) + "," + parseInt(s.substring(2, 4), 16) + "," + parseInt(s.substring(4, 6), 16) + ")"; } return s; }; TinyMCE_Engine.prototype.convertSpansToFonts = function(doc) { var sizes = tinyMCE.getParam('font_size_style_values').replace(/\s+/, '').split(','); var h = doc.body.innerHTML; h = h.replace(/ 0) { tinyMCE.setAttrib(s[i], 'size', fSize); s[i].style.fontSize = ''; } var fFace = s[i].style.fontFamily; if (fFace != null && fFace != "") { tinyMCE.setAttrib(s[i], 'face', fFace); s[i].style.fontFamily = ''; } var fColor = s[i].style.color; if (fColor != null && fColor != "") { tinyMCE.setAttrib(s[i], 'color', tinyMCE.convertRGBToHex(fColor)); s[i].style.color = ''; } } }; TinyMCE_Engine.prototype.convertFontsToSpans = function(doc) { var sizes = tinyMCE.getParam('font_size_style_values').replace(/\s+/, '').split(','); var h = doc.body.innerHTML; h = h.replace(/ 0 && fSize < 8) { if (fsClasses != null) tinyMCE.setAttrib(s[i], 'class', fsClasses[fSize-1]); else s[i].style.fontSize = sizes[fSize-1]; } s[i].removeAttribute('size'); } if (fFace != "") { s[i].style.fontFamily = fFace; s[i].removeAttribute('face'); } if (fColor != "") { s[i].style.color = fColor; s[i].removeAttribute('color'); } } }; TinyMCE_Engine.prototype.cleanupAnchors = function(doc) { var i, cn, x, an = doc.getElementsByTagName("a"); for (i=0; i=0; x--) tinyMCE.insertAfter(cn[x], an[i]); } } }; TinyMCE_Engine.prototype.getContent = function(editor_id) { if (typeof(editor_id) != "undefined") tinyMCE.selectedInstance = tinyMCE.getInstanceById(editor_id); if (tinyMCE.selectedInstance) return tinyMCE._cleanupHTML(this.selectedInstance, this.selectedInstance.getDoc(), tinyMCE.settings, this.selectedInstance.getBody(), false, true); return null; }; TinyMCE_Engine.prototype._cleanupHTML = function(inst, doc, config, element, visual, on_save, on_submit) { var h, d, t1, t2, t3, t4, t5, c, s; if (!tinyMCE.settings.cleanup) return inst.getBody().innerHTML; on_save = typeof(on_save) == 'undefined' ? false : on_save; c = inst.cleanup; s = inst.settings; d = c.settings.debug; if (d) t1 = new Date().getTime(); if (on_save && tinyMCE.getParam("convert_fonts_to_spans")) tinyMCE.convertFontsToSpans(doc); // Call custom cleanup code tinyMCE._customCleanup(inst, on_save ? "get_from_editor_dom" : "insert_to_editor_dom", doc.body); if (d) t2 = new Date().getTime(); c.settings.on_save = on_save; //for (var i=0; i<100; i++) c.idCount = 0; if (s.cleanup_serializer == "xml") h = c.serializeNodeAsXML(element); else h = c.serializeNodeAsHTML(element); if (d) t3 = new Date().getTime(); // Post processing h = h.replace(/<\/?(body|head|html)[^>]*>/gi, ''); h = h.replace(new RegExp(' (rowspan="1"|colspan="1")', 'g'), ''); h = h.replace(/


<\/p>/g, '
'); h = h.replace(/

( | )<\/p>


( | )<\/p>/g, '


'); h = h.replace(/\s*
\s*<\/td>/g, ' '); h = h.replace(/

\s*
\s*<\/p>/g, '

 

'); h = h.replace(/

\s*( | )\s*
\s*( | )\s*<\/p>/g, '

 

'); h = h.replace(/

\s*( | )\s*
\s*<\/p>/g, '

 

'); h = h.replace(/

\s*
\s* \s*<\/p>/g, '

 

'); h = h.replace(/(.*?)<\/a>/g, '$1'); h = h.replace(/]*)>\s*<\/p>/g, ' 

'); // Clean body if (/^\s*(
|

 <\/p>|

 <\/p>|

<\/p>)\s*$/.test(h)) h = ''; // If preformatted if (s.preformatted) { h = h.replace(/^

/, '');
		h = h.replace(/<\/pre>$/, '');
		h = '
' + h + '
'; } // Gecko specific processing if (tinyMCE.isGecko) { h = h.replace(//g, ''); h = h.replace(/]*)>\s*
\s*<\/td>/g, ' '); } if (s.force_br_newlines) h = h.replace(/

( | )<\/p>/g, '
'); // Call custom cleanup code h = tinyMCE._customCleanup(inst, on_save ? "get_from_editor" : "insert_to_editor", h); // Remove internal classes if (on_save) { h = h.replace(new RegExp(' ?(mceItem[a-zA-Z0-9]*|' + s.visual_table_class + ')', 'g'), ''); h = h.replace(new RegExp(' ?class=""', 'g'), ''); } if (s.remove_linebreaks && !c.settings.indent) h = h.replace(/\n|\r/g, ' '); if (d) t4 = new Date().getTime(); if (on_save && c.settings.indent) h = c.formatHTML(h); // If encoding (not recommended option) if (on_submit && (s.encoding == "xml" || s.encoding == "html")) h = c.xmlEncode(h); if (d) t5 = new Date().getTime(); if (c.settings.debug) tinyMCE.debug("Cleanup in ms: Pre=" + (t2-t1) + ", Serialize: " + (t3-t2) + ", Post: " + (t4-t3) + ", Format: " + (t5-t4) + ", Sum: " + (t5-t1) + "."); return h; }; function TinyMCE_Cleanup() { this.isMSIE = (navigator.appName == "Microsoft Internet Explorer"); this.rules = tinyMCE.clearArray(new Array()); // Default config this.settings = { indent_elements : 'head,table,tbody,thead,tfoot,form,tr,ul,ol,blockquote,object', newline_before_elements : 'h1,h2,h3,h4,h5,h6,pre,address,div,ul,ol,li,meta,option,area,title,link,base,script,td', newline_after_elements : 'br,hr,p,pre,address,div,ul,ol,meta,option,area,link,base,script', newline_before_after_elements : 'html,head,body,table,thead,tbody,tfoot,tr,form,ul,blockquote,p,object,param,hr,div', indent_char : '\t', indent_levels : 1, entity_encoding : 'raw', valid_elements : '*[*]', entities : '', url_converter : '', invalid_elements : '', verify_html : false }; this.vElements = tinyMCE.clearArray(new Array()); this.vElementsRe = ''; this.closeElementsRe = /^(IMG|BR|HR|LINK|META|BASE)$/; this.codeElementsRe = /^(SCRIPT|STYLE)$/; this.mceAttribs = { href : 'mce_href', src : 'mce_src', type : 'mce_type' }; } TinyMCE_Cleanup.prototype = { init : function(s) { var n, a, i, ir, or, st; for (n in s) this.settings[n] = s[n]; // Setup code formating s = this.settings; // Setup regexps this.inRe = this._arrayToRe(s.indent_elements.split(','), '', '^<(', ')[^>]*'); this.ouRe = this._arrayToRe(s.indent_elements.split(','), '', '^<\\/(', ')[^>]*'); this.nlBeforeRe = this._arrayToRe(s.newline_before_elements.split(','), 'gi', '<(', ')([^>]*)>'); this.nlAfterRe = this._arrayToRe(s.newline_after_elements.split(','), 'gi', '<(', ')([^>]*)>'); this.nlBeforeAfterRe = this._arrayToRe(s.newline_before_after_elements.split(','), 'gi', '<(\\/?)(', ')([^>]*)>'); if (s.invalid_elements != '') this.iveRe = this._arrayToRe(s.invalid_elements.toUpperCase().split(','), 'g', '^(', ')$'); else this.iveRe = null; // Setup separator st = ''; for (i=0; i