| 79 | | HtmlTidy.prototype.onGenerateOnce = function() { |
| 80 | | var editor = this.editor; |
| 81 | | |
| 82 | | var ifr = document.createElement("iframe"); |
| 83 | | ifr.name = "htiframe_name"; |
| 84 | | var s = ifr.style; |
| 85 | | s.position = "absolute"; |
| 86 | | s.width = s.height = s.border = s.left = s.top = s.padding = s.margin = "0px"; |
| 87 | | document.body.appendChild(ifr); |
| 88 | | |
| 89 | | var frm = '<form id="htiform_id" name="htiform_name" method="post" target="htiframe_name" action="'; |
| 90 | | frm += _editor_url + 'plugins/HtmlTidy/html-tidy-logic.php'; |
| 91 | | frm += '"><textarea name="htisource_name" id="htisource_id">'; |
| 92 | | frm += '</textarea></form>'; |
| 93 | | |
| 94 | | var newdiv = document.createElement('div'); |
| 95 | | newdiv.style.display = "none"; |
| 96 | | newdiv.innerHTML = frm; |
| 97 | | document.body.appendChild(newdiv); |
| 98 | | }; |
| 99 | | |
| 103 | | switch (id) { |
| 104 | | case "HT-html-tidy": |
| 105 | | |
| 106 | | var oldhtml = editor.getHTML(); |
| 107 | | |
| 108 | | // Ask the server for some nice new html, based on the old... |
| 109 | | var myform = document.getElementById('htiform_id'); |
| 110 | | var txtarea = document.getElementById('htisource_id'); |
| 111 | | txtarea.value = editor.getHTML(); |
| 112 | | |
| 113 | | // Apply the 'meanwhile' text, e.g. "Tidying HTML, please wait..." |
| 114 | | editor.setHTML(i18n['tidying']); |
| 115 | | |
| 116 | | // The returning tidying processing script needs to find the editor |
| 117 | | window._editorRef = editor; |
| 118 | | |
| 119 | | // ...And send our old source off for processing! |
| 120 | | myform.submit(); |
| | 82 | switch (id) |
| | 83 | { |
| | 84 | case "HT-html-tidy": |
| | 85 | { |
| | 86 | var oldhtml = editor.getHTML(); |
| | 87 | // Ask the server for some nice new html, based on the old... |
| | 88 | HTMLArea._postback(_editor_url + 'plugins/HtmlTidy/html-tidy-logic.php', {'htisource_name' : oldhtml}, |
| | 89 | function(javascriptResponse) { eval(javascriptResponse) }); |
| | 90 | } |