1 var devkit = parent.tinyMCE.plugins['devkit'], logEnabled = true, flip = false, book = null;
\r
4 var log, i, f = document.forms[0];
\r
6 devkit._winLoaded = true;
\r
10 for (i=0; i<log.length; i++)
\r
13 f.logfilter.value = devkit._logFilter;
\r
16 function changeFilter(f) {
\r
17 devkit._logFilter = f;
\r
20 function toggleLog(s) {
\r
24 function toggleFlip() {
\r
25 document.getElementById('flipbtn').src = flip ? 'images/flip_down.gif' : 'images/flip_up.gif';
\r
28 parent.document.getElementById('devkit').className = 'devkitup';
\r
30 parent.document.getElementById('devkit').className = 'devkitdown';
\r
38 if (!logEnabled || !new RegExp(devkit._logFilter, 'gi').test(s))
\r
42 l = d.getElementById('log');
\r
43 n = d.createElement('span');
\r
45 n.innerHTML = tinyMCE.xmlEncode(s);
\r
48 l.scrollTop = l.scrollHeight;
\r
51 function renderInfo() {
\r
52 var se = document.getElementById('info'), n, sn, inst, h = '', sel, rng, instCount = 0, rc;
\r
54 h += '<h2>Browser info:</h2>';
\r
56 h += '<table border="0" cellpadding="0" cellspacing="0" class="data">';
\r
57 h += addRenderInfo('navigator.userAgent', navigator.userAgent);
\r
58 h += addRenderInfo('navigator.appName', navigator.appName);
\r
59 h += addRenderInfo('navigator.platform', navigator.platform);
\r
60 h += addRenderInfo('navigator.language', navigator.language, 'bspec');
\r
61 h += addRenderInfo('navigator.browserLanguage', navigator.browserLanguage, 'bspec');
\r
62 h += addRenderInfo('navigator.systemLanguage', navigator.systemLanguage, 'bspec');
\r
63 h += addRenderInfo('navigator.userLanguage', navigator.userLanguage, 'bspec');
\r
64 h += addRenderInfo('opera.buildNumber("inconspicuous")', typeof(opera) != 'undefined' && opera.buildNumber ? opera.buildNumber('inconspicuous') : null, 'bspec');
\r
65 h += addRenderInfo('window.innerWidth', parent.window.innerWidth, 'bspec');
\r
66 h += addRenderInfo('window.innerHeight', parent.window.innerHeight, 'bspec');
\r
67 h += addRenderInfo('document.body.offsetWidth', parent.document.body.offsetWidth);
\r
68 h += addRenderInfo('document.body.offsetHeight', parent.document.body.offsetHeight);
\r
69 h += addRenderInfo('screen.width', screen.width);
\r
70 h += addRenderInfo('screen.height', screen.height);
\r
71 h += addRenderInfo('screen.availWidth', screen.availWidth);
\r
72 h += addRenderInfo('screen.availHeight', screen.availHeight);
\r
73 h += addRenderInfo('screen.colorDepth', screen.colorDepth);
\r
74 h += addRenderInfo('screen.pixelDepth', screen.pixelDepth, 'bspec');
\r
75 h += addRenderInfo('document.contentType', document.contentType, 'bspec');
\r
78 h += '<h2>TinyMCE_Engine info:</h2>';
\r
80 h += '<table border="0" cellpadding="0" cellspacing="0" class="data">';
\r
81 h += addRenderInfo('baseURL', tinyMCE.baseURL);
\r
82 h += addRenderInfo('selectedInstance.editorId', tinyMCE.selectedInstance ? tinyMCE.selectedInstance.editorId : null);
\r
83 h += addRenderInfo('selectedElement.nodeName', tinyMCE.selectedElement ? tinyMCE.selectedElement.nodeName : null, 'dep');
\r
84 h += addRenderInfo('loadedFiles',tinyMCE.loadedFiles.join(','));
\r
85 h += addRenderInfo('isMSIE', tinyMCE.isMSIE);
\r
86 h += addRenderInfo('isMSIE5', tinyMCE.isMSIE5);
\r
87 h += addRenderInfo('isMSIE5_0', tinyMCE.isMSIE5_0);
\r
88 h += addRenderInfo('isMSIE7', tinyMCE.isMSIE7);
\r
89 h += addRenderInfo('isGecko', tinyMCE.isGecko);
\r
90 h += addRenderInfo('isSafari', tinyMCE.isSafari);
\r
91 h += addRenderInfo('isOpera', tinyMCE.isOpera);
\r
92 h += addRenderInfo('isMac', tinyMCE.isMac);
\r
93 h += addRenderInfo('isNS7', tinyMCE.isNS7);
\r
94 h += addRenderInfo('isNS71', tinyMCE.isNS71);
\r
95 h += addRenderInfo('idCounter', tinyMCE.idCounter);
\r
96 h += addRenderInfo('currentConfig', tinyMCE.currentConfig);
\r
97 h += addRenderInfo('majorVersion', tinyMCE.majorVersion);
\r
98 h += addRenderInfo('minorVersion', tinyMCE.minorVersion);
\r
99 h += addRenderInfo('releaseDate', tinyMCE.releaseDate);
\r
100 h += addRenderInfo('documentBasePath', tinyMCE.documentBasePath);
\r
101 h += addRenderInfo('documentURL', tinyMCE.documentURL);
\r
104 for (n in tinyMCE.instances) {
\r
105 inst = tinyMCE.instances[n];
\r
107 if (!tinyMCE.isInstance(inst))
\r
110 sel = inst.selection.getSel();
\r
111 rng = inst.selection.getRng();
\r
113 h += '<h2>TinyMCE_Control(' + (instCount++) + ') id: ' + inst.editorId + '</h2>';
\r
114 h += '<table border="0" cellpadding="0" cellspacing="0" class="data">';
\r
116 h += addRenderInfo('editorId', inst.editorId);
\r
117 h += addRenderInfo('visualAid', inst.visualAid);
\r
118 h += addRenderInfo('foreColor', inst.foreColor);
\r
119 h += addRenderInfo('backColor', inst.backColor);
\r
120 h += addRenderInfo('formTargetElementId', inst.formTargetElementId);
\r
121 h += addRenderInfo('formElement', inst.formElement ? inst.formElement.nodeName : null);
\r
122 h += addRenderInfo('oldTargetElement', inst.oldTargetElement ? inst.oldTargetElement.nodeName : null);
\r
123 h += addRenderInfo('linkElement', inst.linkElement ? inst.linkElement.nodeName : null, 'dep');
\r
124 h += addRenderInfo('imgElement', inst.imgElement ? inst.imgElement.nodeName : null, 'dep');
\r
125 h += addRenderInfo('selectedNode', inst.selectedNode ? inst.selectedNode.nodeName : null, 'dep');
\r
126 h += addRenderInfo('targetElement', inst.targetElement ? inst.targetElement.nodeName : null);
\r
127 h += addRenderInfo('getBody().nodeName', inst.getBody() ? inst.getBody().nodeName : null);
\r
128 h += addRenderInfo('getBody().getAttribute("id")', inst.getBody() ? inst.getBody().getAttribute("id") : null);
\r
129 h += addRenderInfo('getDoc().location', inst.getDoc() ? inst.getDoc().location : null);
\r
130 h += addRenderInfo('startContent', inst.startContent);
\r
131 h += addRenderInfo('isHidden()', inst.isHidden());
\r
132 h += addRenderInfo('isDirty()', inst.isDirty());
\r
133 h += addRenderInfo('undoRedo.undoLevels.length', inst.undoRedo.undoLevels.length);
\r
134 h += addRenderInfo('undoRedo.undoIndex', inst.undoRedo.undoIndex);
\r
135 h += addRenderInfo('selection.getSelectedHTML()', inst.selection.getSelectedHTML());
\r
136 h += addRenderInfo('selection.isCollapsed()', inst.selection.isCollapsed() || 'false');
\r
137 h += addRenderInfo('selection.getSelectedText()', inst.selection.getSelectedText());
\r
138 h += addRenderInfo('selection.getFocusElement().nodeName', inst.selection.getFocusElement().nodeName);
\r
139 h += addRenderInfo('selection.getFocusElement().outerHTML', tinyMCE.getOuterHTML(inst.selection.getFocusElement()));
\r
141 if ((tinyMCE.isGecko || tinyMCE.isOpera) && sel && rng) {
\r
142 h += addRenderInfo('selection.getSel().anchorNode.nodeName', sel.anchorNode ? sel.anchorNode.nodeName : null, 'bspec');
\r
143 h += addRenderInfo('selection.getSel().anchorOffset', sel.anchorOffset, 'bspec');
\r
144 h += addRenderInfo('selection.getSel().focusNode.nodeName', sel.focusNode ? sel.focusNode.nodeName : null, 'bspec');
\r
145 h += addRenderInfo('selection.getSel().focusOffset', sel.focusOffset, 'bspec');
\r
146 h += addRenderInfo('selection.getRng().startContainer.nodeName', rng.startContainer ? rng.startContainer.nodeName : null, 'bspec');
\r
147 h += addRenderInfo('selection.getRng().startOffset', rng.startOffset, 'bspec');
\r
148 h += addRenderInfo('selection.getRng().endContainer.nodeName', rng.endContainer ? rng.endContainer.nodeName : null, 'bspec');
\r
149 h += addRenderInfo('selection.getRng().endOffset', rng.endOffset, 'bspec');
\r
152 if (typeof(rng.item) != 'undefined' || typeof(rng.htmlText) != 'undefined') {
\r
154 h += addRenderInfo('selection.getSel().type', sel.type, 'bspec');
\r
155 h += addRenderInfo('selection.getRng().htmlText', rng.htmlText, 'bspec');
\r
156 h += addRenderInfo('selection.getRng().text', rng.text, 'bspec');
\r
158 h += addRenderInfo('selection.getRng().item(0).nodeName', rng.item(0).nodeName, 'bspec');
\r
164 h += '<p>Fields marked in <strong class="bspec">gray</strong> is not cross browser and should be used with care.</p>';
\r
165 h += '<p>Fields marked <strong class="dep">red</strong> are marked deprecated and will be removed in the future.</p><br />';
\r
170 function addRenderInfo(n, v, c) {
\r
171 return '<tr><td' + (c ? ' class="' + c + '"' : '')+ '>' + n + '</td><td><input type="text" value="' + tinyMCE.xmlEncode(v != null ? ('' + v).replace(/[\r\n]/g, '') : 'null') + '" /></td></tr>';
\r
174 function renderSettings() {
\r
175 var se = document.getElementById('settings'), n, sn, inst, h = '', v;
\r
177 for (n in tinyMCE.instances) {
\r
178 inst = tinyMCE.instances[n];
\r
180 if (!tinyMCE.isInstance(inst))
\r
183 h += '<h2>Instance id: ' + inst.editorId + '</h2>';
\r
184 h += '<table border="0" cellpadding="0" cellspacing="0" class="data">';
\r
186 for (sn in inst.settings) {
\r
187 v = inst.settings[sn];
\r
189 h += '<tr><td class="col1">' + tinyMCE.xmlEncode(sn) + '</td><td><input type="text" value="' + tinyMCE.xmlEncode(v) + '" /></td></tr>';
\r
198 function renderContent() {
\r
199 var se = document.getElementById('content'), n, inst, h = '';
\r
201 for (n in tinyMCE.instances) {
\r
202 inst = tinyMCE.instances[n];
\r
204 if (!tinyMCE.isInstance(inst))
\r
207 h += '<h2>Instance id: ' + inst.editorId + '</h2>';
\r
209 h += '<h3>Start content - inst.startContent:</h3>';
\r
210 h += '<div>' + tinyMCE.xmlEncode(inst.startContent) + '</div>';
\r
212 h += '<h3>Raw content - inst.getBody().innerHTML or inst.getHTML(true):</h3>';
\r
213 h += '<div>' + tinyMCE.xmlEncode(inst.getHTML(true)) + '</div>';
\r
215 h += '<h3>Cleaned content - inst.getHTML():</h3>';
\r
216 h += '<div>' + tinyMCE.xmlEncode(inst.getHTML()) + '</div>';
\r
218 if (inst.serializedHTML) {
\r
219 h += '<h3>Serialized HTML content - inst.serializedHTML:</h3>';
\r
220 h += '<div>' + tinyMCE.xmlEncode(inst.serializedHTML) + '</div>';
\r
227 function renderCommandStates() {
\r
228 var se = document.getElementById('command_states'), n, inst, h = '', v, ex;
\r
229 var cmds = new Array('2D-Position','AbsolutePosition','BackColor','BlockDirLTR','BlockDirRTL','Bold','BrowseMode','Copy','CreateBookmark','CreateLink','Cut','Delete','DirLTR','DirRTL','EditMode','enableInlineTableEditing','enableObjectResizing','FontName','FontSize','ForeColor','FormatBlock','Indent','InsertButton','InsertFieldset','InsertHorizontalRule','InsertIFrame','InsertImage','InsertInputButton','InsertInputCheckbox','InsertInputFileUpload','InsertInputHidden','InsertInputImage','InsertInputPassword','InsertInputRadio','InsertInputReset','InsertInputSubmit','InsertInputText','InsertMarquee','InsertOrderedList','InsertParagraph','InsertSelectDropdown','InsertSelectListbox','InsertTextArea','InsertUnorderedList','Italic','JustifyCenter','JustifyFull','JustifyLeft','JustifyNone','JustifyRight','LiveResize','MultipleSelection','Open','Outdent','OverWrite','Paste','PlayImage','Redo','Refresh','RemoveFormat','SaveAs','SelectAll','SizeToControl','SizeToControlHeight','SizeToControlWidth','Stop','StopImage','StrikeThrough','styleWithCSS','Subscript','Superscript','UnBookmark','Underline','Undo','Unlink','Unselect'), i;
\r
231 for (n in tinyMCE.instances) {
\r
232 inst = tinyMCE.instances[n];
\r
234 if (!tinyMCE.isInstance(inst))
\r
237 h += '<h2>Instance id: ' + inst.editorId + '</h2>';
\r
238 h += '<table border="0" cellpadding="0" cellspacing="0" class="data">';
\r
240 for (i=0; i<cmds.length; i++) {
\r
244 v = tinyMCE.isGecko || inst.getDoc().queryCommandSupported(cmds[i]);
\r
245 v = v ? inst.queryCommandState(cmds[i]) : 'Not supported';
\r
247 v = 'Not supported';
\r
250 h += '<tr><td><input type="text" value="' + tinyMCE.xmlEncode(cmds[i]) + '" /></td><td><input type="text" value="' + tinyMCE.xmlEncode(v) + '" /></td></tr>';
\r
259 function renderUndoRedo() {
\r
260 var se = document.getElementById('undo_redo'), inst, n, h = '', i, le, id, d, ur;
\r
261 var f = document.forms[0];
\r
263 if (tinyMCE.undoLevels) {
\r
264 le = tinyMCE.undoLevels;
\r
266 h += '<h2>Global undo/redo</h2>';
\r
267 h += '<table border="0" cellpadding="0" cellspacing="0" width="50%" class="data">';
\r
268 h += '<tr><td>undoLevels.length</td><td>' + le.length + '</td></tr>';
\r
269 h += '<tr><td>undoIndex</td><td>' + tinyMCE.undoIndex + '</td></tr>';
\r
272 for (i=0; i<le.length; i++)
\r
273 h += '<h3>Level: ' + i + ', Instance: ' + (le[i] ? le[i].editorId : 'null') + '</h3>';
\r
276 for (n in tinyMCE.instances) {
\r
277 inst = tinyMCE.instances[n];
\r
279 if (!tinyMCE.isInstance(inst))
\r
282 ur = inst.undoRedo;
\r
283 le = ur.undoLevels;
\r
285 h += '<hr /><h2>Instance id: ' + inst.editorId + '</h2>';
\r
286 h += '<table border="0" cellpadding="0" cellspacing="0" width="50%" class="data">';
\r
287 h += '<tr><td>undoLevels.length</td><td>' + le.length + '</td></tr>';
\r
288 h += '<tr><td>undoIndex</td><td>' + ur.undoIndex + '</td></tr>';
\r
289 h += '<tr><td>typingUndoIndex</td><td>' + ur.typingUndoIndex + '</td></tr>';
\r
290 h += '<tr><td>undoRedo</td><td>' + ur.undoRedo + '</td></tr>';
\r
293 for (i=0; i<le.length; i++) {
\r
294 h += '<h3>Level: ' + i + (!le[i].bookmark ? "" : " [bookmark]") + '</h3>';
\r
295 h += '<div class="undodata">' + tinyMCE.xmlEncode(le[i].content) + '</div>';
\r
297 if (i > 0 && f.undo_diff.checked) {
\r
298 d = diff_main(i > 0 ? le[i-1].content.replace(/[\r\n]+/g, '') : null, le[i].content.replace(/[\r\n]+/g, ''), false);
\r
299 diff_cleanup_semantic(d);
\r
300 h += '<h3>Diff ' + (i-1) + ',' + i + '</h3><div class="undodata">' + diff_prettyhtml(d) + '</div>';
\r
308 function clearLog() {
\r
309 document.getElementById('log').innerHTML = '';
\r
310 devkit._startTime = null;
\r
313 function cancelAction() {
\r
314 parent.document.getElementById('devkit').style.display = 'none';
\r
317 function toggleDebugEvents(s) {
\r
318 devkit._debugEvents(s);
\r
321 function storeSelection() {
\r
322 book = tinyMCE.selectedInstance.selection.getBookmark();
\r
327 function restoreSelection() {
\r
328 tinyMCE.selectedInstance.selection.moveToBookmark(book);
\r