3 JSAN.use('MochiKit.LoggingPane');
5 MochiKit.LoggingPane.LoggingPane.prototype.colorTable = {
13 JSAN.use('CXGN.Effects');
15 SGNLoggingPane = window.SGNLoggingPane || {};
18 inline_create_link_id : 'MKLPinline_create',
19 inline_destroy_link_id : 'MKLPinline_destroy',
20 window_create_link_id: 'MKLPwindow_create',
21 window_destroy_link_id: 'MKLPwindow_destroy',
24 create: function (inline) {
25 var uid = '_MochiKit_LoggingPane';
26 if(!inline){ //determine height of window
27 var messages = MochiKit.Logging.logger.getMessages();
29 for(i = 0; i < messages.length; i++){
30 var message = messages[i].info.join(" ");
31 cr_count += message.search("\\n"); //count cr's in message
32 cr_count++; //implicit cr for message
34 var height = cr_count*20; //20 pixels is approximate line-height?
35 if(height<200) height=200;
36 if(height>500) height=500;
37 SGNLoggingPane.LP = MochiKit.LoggingPane.createLoggingPane(false, height);
38 //Effects.swapElements(SGNLoggingPane.window_create_link_id, SGNLoggingPane.window_destroy_link_id);
40 else { //Open an Inline Logging Pane
41 SGNLoggingPane.LP = MochiKit.LoggingPane.createLoggingPane(true);
43 //redefine closePane() to perform SGN-related tasks when the
44 //pane is closed using the native button
45 SGNLoggingPane.LP.closePane = MochiKit.Base.bind(
51 if (MochiKit.LoggingPane._loggingPane == this) {
52 MochiKit.LoggingPane._loggingPane = null;
54 this.logger.removeListener(uid+'_Listener');
57 debugPane.loggingPane = null;
59 catch(e) { logFatal("Bookmarklet was closed incorrectly."); }
61 debugPane.parentNode.removeChild(debugPane);
63 //This is the stuff we added
65 Effects.swapElements(SGNLoggingPane.inline_destroy_link_id, SGNLoggingPane.inline_create_link_id);
67 if(DeveloperSettings){
68 DeveloperSettings.setValue('logging_pane_open', 0);
69 DeveloperSettings.save();
80 }, SGNLoggingPane.LP);
82 var debugPane = window.document.getElementById(uid);
83 var closeButton = debugPane.getElementsByTagName('button')[3];
84 var divBody = debugPane.getElementsByTagName('div')[0];
85 closeButton.onclick = SGNLoggingPane.LP.closePane;
87 if(Effects && typeof(Effects.swapElements) == "function"){
88 Effects.swapElements(SGNLoggingPane.inline_create_link_id, SGNLoggingPane.inline_destroy_link_id);
90 if(DeveloperSettings){
91 DeveloperSettings.setValue('logging_pane_open', 1);
92 DeveloperSettings.save();
98 destroy: function () {
99 SGNLoggingPane.LP.closePane();
100 if(Effects && typeof(Effects.swapElements) == "function") {
101 Effects.swapElements(SGNLoggingPane.inline_destroy_link_id, SGNLoggingPane.inline_create_link_id);
102 // Effects.swapElements(SGNLoggingPane.window_destroy_link_id, SGNLoggingPane.window_create_link_id);
104 if(DeveloperSettings){
105 DeveloperSettings.setValue('logging_pane_open', 0);
106 DeveloperSettings.save();
110 //redefine link handles:
111 handles: function (ic, id, wc, wd) {
113 SGNLoggingPane.inline_create_link_id = ic;
116 SGNLoggingPane.inline_destroy_link_id = id;
119 SGNLoggingPane.window_create_link_id = wc;
122 SGNLoggingPane.window_destroy_link_id = wd;