1 | /* |
---|
2 | * FCKeditor - The text editor for internet |
---|
3 | * Copyright (C) 2003-2006 Frederico Caldeira Knabben |
---|
4 | * |
---|
5 | * Licensed under the terms of the GNU Lesser General Public License: |
---|
6 | * http://www.opensource.org/licenses/lgpl-license.php |
---|
7 | * |
---|
8 | * For further information visit: |
---|
9 | * http://www.fckeditor.net/ |
---|
10 | * |
---|
11 | * "Support Open Source software. What about a donation today?" |
---|
12 | * |
---|
13 | * File Name: fckdebug.js |
---|
14 | * Debug window control and operations. |
---|
15 | * |
---|
16 | * File Authors: |
---|
17 | * Frederico Caldeira Knabben (fredck@fckeditor.net) |
---|
18 | */ |
---|
19 | |
---|
20 | var FCKDebug = new Object() ; |
---|
21 | |
---|
22 | FCKDebug.Output = function( message, color, noParse ) |
---|
23 | { |
---|
24 | if ( ! FCKConfig.Debug ) return ; |
---|
25 | |
---|
26 | if ( !noParse && message != null && isNaN( message ) ) |
---|
27 | message = message.replace(/</g, "<") ; |
---|
28 | |
---|
29 | if ( !this.DebugWindow || this.DebugWindow.closed ) |
---|
30 | this.DebugWindow = window.open( FCKConfig.BasePath + 'fckdebug.html', 'FCKeditorDebug', 'menubar=no,scrollbars=no,resizable=yes,location=no,toolbar=no,width=600,height=500', true ) ; |
---|
31 | |
---|
32 | if ( this.DebugWindow && this.DebugWindow.Output) |
---|
33 | { |
---|
34 | try |
---|
35 | { |
---|
36 | this.DebugWindow.Output( message, color ) ; |
---|
37 | } |
---|
38 | catch ( e ) {} // Ignore errors |
---|
39 | } |
---|
40 | } |
---|
41 | |
---|
42 | FCKDebug.OutputObject = function( anyObject, color ) |
---|
43 | { |
---|
44 | if ( ! FCKConfig.Debug ) return ; |
---|
45 | |
---|
46 | var message ; |
---|
47 | |
---|
48 | if ( anyObject != null ) |
---|
49 | { |
---|
50 | message = 'Properties of: ' + anyObject + '</b><blockquote>' ; |
---|
51 | |
---|
52 | for (var prop in anyObject) |
---|
53 | { |
---|
54 | try |
---|
55 | { |
---|
56 | var sVal = anyObject[ prop ] ? anyObject[ prop ] + '' : '[null]' ; |
---|
57 | message += '<b>' + prop + '</b> : ' + sVal.replace(/</g, '<') + '<br>' ; |
---|
58 | } |
---|
59 | catch (e) |
---|
60 | { |
---|
61 | try |
---|
62 | { |
---|
63 | message += '<b>' + prop + '</b> : [' + typeof( anyObject[ prop ] ) + ']<br>' ; |
---|
64 | } |
---|
65 | catch (e) |
---|
66 | { |
---|
67 | message += '<b>' + prop + '</b> : [-error-]<br>' ; |
---|
68 | } |
---|
69 | } |
---|
70 | } |
---|
71 | |
---|
72 | message += '</blockquote><b>' ; |
---|
73 | } else |
---|
74 | message = 'OutputObject : Object is "null".' ; |
---|
75 | |
---|
76 | FCKDebug.Output( message, color, true ) ; |
---|
77 | } |
---|