src/crypto.c: possible fix for memory leak related
[citadel.git] / webcit / tiny_mce / themes / advanced / jscripts / source_editor.js
1 function saveContent() {\r
2         tinyMCE.setContent(document.getElementById('htmlSource').value);\r
3         tinyMCE.closeWindow(window);\r
4 }\r
5 \r
6 // Fixes some charcode issues\r
7 function fixContent(html) {\r
8         html = html.replace(new RegExp('<(p|hr|table|tr|td|ol|ul|object|embed|li|blockquote)', 'gi'),'\n<$1');\r
9         html = html.replace(new RegExp('<\/(p|ol|ul|li|table|tr|td|blockquote|object)>', 'gi'),'</$1>\n');\r
10         html = tinyMCE.regexpReplace(html, '<br />','<br />\n','gi');\r
11         html = tinyMCE.regexpReplace(html, '\n\n','\n','gi');\r
12         return html;\r
13 }\r
14 \r
15 function onLoadInit() {\r
16         tinyMCEPopup.resizeToInnerSize();\r
17 \r
18         document.forms[0].htmlSource.value = fixContent(tinyMCE.getContent(tinyMCE.getWindowArg('editor_id')));\r
19         resizeInputs();\r
20         setWrap('off');\r
21 }\r
22 \r
23 function setWrap(val) {\r
24         // hard soft off\r
25         document.forms[0].htmlSource.wrap = val;\r
26 }\r
27 \r
28 function toggleWordWrap(elm) {\r
29         if (elm.checked)\r
30                 setWrap('soft');\r
31         else\r
32                 setWrap('off');\r
33 }\r
34 \r
35 var wHeight=0, wWidth=0, owHeight=0, owWidth=0;\r
36 \r
37 function resizeInputs() {\r
38         if (!tinyMCE.isMSIE) {\r
39                  wHeight = self.innerHeight-80;\r
40                  wWidth = self.innerWidth-16;\r
41         } else {\r
42                  wHeight = document.body.clientHeight - 80;\r
43                  wWidth = document.body.clientWidth - 16;\r
44         }\r
45 \r
46         document.forms[0].htmlSource.style.height = Math.abs(wHeight) + 'px';\r
47         document.forms[0].htmlSource.style.width  = Math.abs(wWidth) + 'px';\r
48 }\r
49 \r
50 function renderWordWrap() {\r
51         if (tinyMCE.isMSIE)\r
52                 document.write('<input type="checkbox" name="wraped" id="wraped" onclick="toggleWordWrap(this);" class="wordWrapCode" /><label for="wraped">{$lang_theme_code_wordwrap}</label>');\r
53 }\r