Changeset 3130 for branches/2.2/expressoMail1_2/js/rich_text_editor.js
- Timestamp:
- 08/04/10 10:10:14 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2/expressoMail1_2/js/rich_text_editor.js
r1296 r3130 64 64 parentDiv.appendChild(checkbox); 65 65 parentDiv.appendChild(text); 66 } 67 68 cRichTextEditor.prototype.loadStyle = function(tag, css_file) { 69 var theRules = new Array(); 70 var stylePRE = ""; 71 for(var s = 0; s < document.styleSheets.length; s++) { 72 if(document.styleSheets[s].href != null && 73 document.styleSheets[s].href.match("templates/"+template+"/"+css_file)){ 74 if (document.styleSheets[s].cssRules) 75 theRules = document.styleSheets[s].cssRules; 76 else if (document.styleSheets[s].rules) 77 theRules = document.styleSheets[s].rules; 78 break; 79 } 80 } 81 for(var s = 0;s < theRules.length; s++){ 82 if(theRules[s].selectorText.toLowerCase() == tag.toLowerCase()){ 83 stylePRE = theRules[s].style; 84 break; 85 } 86 } 87 var _body = Element(this.editor); 88 var i_doc = (document.all) ? _body.contentWindow.document: _body.contentDocument; 89 var hh1 = i_doc.getElementsByTagName('head')[0]; 90 // For IE 91 if(typeof(hh1) == 'undefined'){ 92 hh1 = i_doc.createElement("head"); 93 i_doc.appendChild(hh1); 94 } 95 var ss1 = i_doc.createElement('style'); 96 ss1.setAttribute("type", "text/css"); 97 var def = tag.toLowerCase()+' {'+stylePRE.cssText+'}'; 98 if (ss1.styleSheet) { 99 ss1.styleSheet.cssText = def; 100 } else { 101 var tt1 = i_doc.createTextNode(def); 102 ss1.appendChild(tt1); 103 } 104 hh1.appendChild(ss1); 66 105 } 67 106
Note: See TracChangeset
for help on using the changeset viewer.