diff --git a/IPython/frontend/html/notebook/static/js/notebook.js b/IPython/frontend/html/notebook/static/js/notebook.js index c3f6c38..a7937ce 100644 --- a/IPython/frontend/html/notebook/static/js/notebook.js +++ b/IPython/frontend/html/notebook/static/js/notebook.js @@ -443,7 +443,7 @@ var IPython = (function (IPython) { }; - // Cell collapsing + // Cell collapsing and output clearing Notebook.prototype.collapse = function (index) { var i = this.index_or_selected(index); @@ -465,6 +465,18 @@ var IPython = (function (IPython) { }; }; + + Notebook.prototype.clear_all_output = function () { + var ncells = this.ncells(); + var cells = this.cells(); + for (var i=0; i<ncells; i++) { + if (cells[i] instanceof IPython.CodeCell) { + cells[i].clear_output(); + } + }; + }; + + // Kernel related things Notebook.prototype.start_kernel = function () { diff --git a/IPython/frontend/html/notebook/static/js/panelsection.js b/IPython/frontend/html/notebook/static/js/panelsection.js index 792ac1c..2e0df3a 100644 --- a/IPython/frontend/html/notebook/static/js/panelsection.js +++ b/IPython/frontend/html/notebook/static/js/panelsection.js @@ -137,6 +137,9 @@ var IPython = (function (IPython) { this.content.find('#expand_cell').click(function () { IPython.notebook.expand(); }); + this.content.find('#clear_all_output').click(function () { + IPython.notebook.clear_all_output(); + }); this.content.find('#delete_cell').click(function () { IPython.notebook.delete_cell(); }); diff --git a/IPython/frontend/html/notebook/templates/notebook.html b/IPython/frontend/html/notebook/templates/notebook.html index e7a71ab..004bcde 100644 --- a/IPython/frontend/html/notebook/templates/notebook.html +++ b/IPython/frontend/html/notebook/templates/notebook.html @@ -89,7 +89,15 @@ <button id="to_html">HTML</button> <button id="to_markdown">Markdown</button> </span> - <!-- <span class="button_label">Format</span> --> + <span class="button_label">Format</span> + </div> + <div class="section_row"> + <span id="toggle_output" class="section_row_buttons"> + <button id="collapse_cell">Collapse</button> + <button id="expand_cell">Expand</button> + <button id="clear_all_output">Clear All</button> + </span> + <span class="button_label">Output</span> </div> <div class="section_row"> <span id="insert" class="section_row_buttons"> @@ -106,13 +114,6 @@ <span class="button_label">Move</span> </div> <div class="section_row"> - <span id="toggle_output" class="section_row_buttons"> - <button id="collapse_cell">Collapse</button> - <button id="expand_cell">Expand</button> - </span> - <span class="button_label">Output</span> - </div> - <div class="section_row"> <span id="run_cells" class="section_row_buttons"> <button id="run_selected_cell">Selected</button> <button id="run_all_cells">All</button>