From 96f5cc942bad58e604466002edce9127b80ebf2d Mon Sep 17 00:00:00 2001 From: Jonathan Frederic Date: Fri, 1 Nov 2013 18:39:18 +0000 Subject: [PATCH 1/2] Fix blank space added by included Javascript on page refresh or notebook load --- IPython/html/static/notebook/js/outputarea.js | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/IPython/html/static/notebook/js/outputarea.js b/IPython/html/static/notebook/js/outputarea.js index 91886df25..073461941 100644 --- a/IPython/html/static/notebook/js/outputarea.js +++ b/IPython/html/static/notebook/js/outputarea.js @@ -290,7 +290,7 @@ var IPython = (function (IPython) { OutputArea.prototype.append_output = function (json, dynamic) { // If dynamic is true, javascript output will be eval'd. this.expand(); - + console.log('appending output'); // Clear the output if clear is queued. var needs_height_reset = false; if (this.clear_queued) { @@ -425,11 +425,12 @@ var IPython = (function (IPython) { OutputArea.prototype.append_display_data = function (json, dynamic) { var toinsert = this.create_output_area(); - this.append_mime_type(json, toinsert, dynamic); - this._safe_append(toinsert); - // If we just output latex, typeset it. - if ( (json.latex !== undefined) || (json.html !== undefined) ) { - this.typeset(); + if (this.append_mime_type(json, toinsert, dynamic)) { + this._safe_append(toinsert); + // If we just output latex, typeset it. + if ( (json.latex !== undefined) || (json.html !== undefined) ) { + this.typeset(); + } } }; @@ -446,13 +447,16 @@ var IPython = (function (IPython) { if(type == 'javascript'){ if (dynamic) { this.append_javascript(json.javascript, md, element, dynamic); + return true; } } else { this['append_'+type](json[type], md, element); + return true; } - return; + return false; } } + return false; }; @@ -469,6 +473,7 @@ var IPython = (function (IPython) { container.append(element); // Div for js shouldn't be drawn, as it will add empty height to the area. container.hide(); + console.log('append js'); // If the Javascript appends content to `element` that should be drawn, then // it must also call `container.show()`. try { From 1a5e26dd5a6a6f0102b98c8adef734875b105649 Mon Sep 17 00:00:00 2001 From: Jonathan Frederic Date: Fri, 1 Nov 2013 18:45:02 +0000 Subject: [PATCH 2/2] Removed left over log statements --- IPython/html/static/notebook/js/outputarea.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/IPython/html/static/notebook/js/outputarea.js b/IPython/html/static/notebook/js/outputarea.js index 073461941..6b47cf090 100644 --- a/IPython/html/static/notebook/js/outputarea.js +++ b/IPython/html/static/notebook/js/outputarea.js @@ -290,7 +290,6 @@ var IPython = (function (IPython) { OutputArea.prototype.append_output = function (json, dynamic) { // If dynamic is true, javascript output will be eval'd. this.expand(); - console.log('appending output'); // Clear the output if clear is queued. var needs_height_reset = false; if (this.clear_queued) { @@ -473,7 +472,6 @@ var IPython = (function (IPython) { container.append(element); // Div for js shouldn't be drawn, as it will add empty height to the area. container.hide(); - console.log('append js'); // If the Javascript appends content to `element` that should be drawn, then // it must also call `container.show()`. try {