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