diff --git a/IPython/frontend/html/notebook/static/js/cell.js b/IPython/frontend/html/notebook/static/js/cell.js index d49e456a623..0abc78f8e49 100644 --- a/IPython/frontend/html/notebook/static/js/cell.js +++ b/IPython/frontend/html/notebook/static/js/cell.js @@ -226,17 +226,24 @@ var IPython = (function (IPython) { } }; + /** + * Show/Hide CodeMirror LineNumber + * @method show_line_numbers + * + * @param value {Bool} show (true), or hide (false) the line number in CodeMirror + **/ + Cell.prototype.show_line_numbers = function (value) { + this.code_mirror.setOption('lineNumbers', value); + this.code_mirror.refresh(); + }; + /** * Toggle CodeMirror LineNumber * @method toggle_line_numbers **/ Cell.prototype.toggle_line_numbers = function () { - if (this.code_mirror.getOption('lineNumbers') == false) { - this.code_mirror.setOption('lineNumbers', true); - } else { - this.code_mirror.setOption('lineNumbers', false); - } - this.code_mirror.refresh(); + var val = this.code_mirror.getOption('lineNumbers'); + this.show_line_numbers(!val); }; /** diff --git a/IPython/frontend/html/notebook/static/js/toolbar.js b/IPython/frontend/html/notebook/static/js/toolbar.js index 8ebb5f98b75..428ffa019a5 100644 --- a/IPython/frontend/html/notebook/static/js/toolbar.js +++ b/IPython/frontend/html/notebook/static/js/toolbar.js @@ -40,7 +40,7 @@ var IPython = (function (IPython) { * { * label:'my button', * icon:'ui-icon-disk', - * callback:function(){alert('hoho'), + * callback:function(){alert('hoho')}, * id : 'my_button_id', // this is optional * }, * {