diff --git a/IPython/frontend/html/notebook/static/js/notebook.js b/IPython/frontend/html/notebook/static/js/notebook.js index 103c01c..64b2eb4 100644 --- a/IPython/frontend/html/notebook/static/js/notebook.js +++ b/IPython/frontend/html/notebook/static/js/notebook.js @@ -762,24 +762,6 @@ var IPython = (function (IPython) { }; }; - Notebook.prototype.publish_notebook = function () { - var w = window.open('', '_blank', 'scrollbars=1,menubar=1'); - var html = '
' + - $('head').clone().html() + - '' + - '' + - $('#notebook').clone().html() + - ''; - - w.document.open(); - w.document.write(html); - w.document.close(); - - return false; - }; Notebook.prototype.notebook_saved = function (data, status, xhr) { this.dirty = false; diff --git a/IPython/frontend/html/notebook/static/js/notebook_main.js b/IPython/frontend/html/notebook/static/js/notebook_main.js index 8a7e386..fe1edce 100644 --- a/IPython/frontend/html/notebook/static/js/notebook_main.js +++ b/IPython/frontend/html/notebook/static/js/notebook_main.js @@ -26,6 +26,7 @@ $(document).ready(function () { IPython.pager = new IPython.Pager('div#pager', 'div#pager_splitter'); IPython.left_panel = new IPython.LeftPanel('div#left_panel', 'div#left_panel_splitter'); IPython.save_widget = new IPython.SaveWidget('span#save_widget'); + IPython.print_widget = new IPython.PrintWidget('span#print_widget'); IPython.notebook = new IPython.Notebook('div#notebook'); IPython.kernel_status_widget = new IPython.KernelStatusWidget('#kernel_status'); IPython.kernel_status_widget.status_idle(); diff --git a/IPython/frontend/html/notebook/static/js/printwidget.js b/IPython/frontend/html/notebook/static/js/printwidget.js new file mode 100644 index 0000000..d9d2baf --- /dev/null +++ b/IPython/frontend/html/notebook/static/js/printwidget.js @@ -0,0 +1,54 @@ +var IPython = (function (IPython) { + + var PrintWidget = function (selector) { + this.selector = selector; + if (this.selector !== undefined) { + this.element = $(selector); + this.style(); + this.bind_events(); + } + }; + + PrintWidget.prototype.style = function () { + this.element.find('button#print_notebook').button(); + }; + + PrintWidget.prototype.bind_events = function () { + var that = this; + this.element.find('button#print_notebook').click(function () { + that.print_notebook(); + }); + }; + + PrintWidget.prototype.enable = function () { + this.element.find('button#print_notebook').button('enable'); + }; + + PrintWidget.prototype.disable = function () { + this.element.find('button#print_notebook').button('disable'); + }; + + PrintWidget.prototype.print_notebook = function () { + var w = window.open('', '_blank', 'scrollbars=1,menubar=1'); + var html = '' + + $('head').clone().html() + + '' + + '' + + $('#notebook').clone().html() + + ''; + + w.document.open(); + w.document.write(html); + w.document.close(); + + return false; + }; + + IPython.PrintWidget = PrintWidget; + + return IPython; + +}(IPython)); \ No newline at end of file diff --git a/IPython/frontend/html/notebook/static/js/savewidget.js b/IPython/frontend/html/notebook/static/js/savewidget.js index 8c1d732..e7dd49e 100644 --- a/IPython/frontend/html/notebook/static/js/savewidget.js +++ b/IPython/frontend/html/notebook/static/js/savewidget.js @@ -21,7 +21,6 @@ var IPython = (function (IPython) { SaveWidget.prototype.style = function () { this.element.find('input#notebook_name').addClass('ui-widget ui-widget-content'); this.element.find('button#save_notebook').button(); - this.element.find('button#publish_notebook').button(); var left_panel_width = $('div#left_panel').outerWidth(); var left_panel_splitter_width = $('div#left_panel_splitter').outerWidth(); $('span#save_widget').css({marginLeft:left_panel_width+left_panel_splitter_width}); @@ -34,10 +33,6 @@ var IPython = (function (IPython) { IPython.notebook.save_notebook(); that.set_document_title(); }); - - this.element.find('button#publish_notebook').click(function () { - IPython.notebook.publish_notebook(); - }); }; @@ -89,23 +84,23 @@ var IPython = (function (IPython) { SaveWidget.prototype.status_save = function () { - $('button#save_notebook').button('option', 'label', 'Save'); - $('button#save_notebook').button('enable'); - $('button#publish_notebook').button('enable'); + this.element.find('button#save_notebook').button('option', 'label', 'Save'); + this.element.find('button#save_notebook').button('enable'); + IPython.print_widget.enable(); }; SaveWidget.prototype.status_saving = function () { - $('button#save_notebook').button('option', 'label', 'Saving'); - $('button#save_notebook').button('disable'); - $('button#publish_notebook').button('disable'); + this.element.find('button#save_notebook').button('option', 'label', 'Saving'); + this.element.find('button#save_notebook').button('disable'); + IPython.print_widget.disable(); }; SaveWidget.prototype.status_loading = function () { - $('button#save_notebook').button('option', 'label', 'Loading'); - $('button#save_notebook').button('disable'); - $('button#publish_notebook').button('disable'); + this.element.find('button#save_notebook').button('option', 'label', 'Loading'); + this.element.find('button#save_notebook').button('disable'); + IPython.print_widget.disable(); }; diff --git a/IPython/frontend/html/notebook/templates/notebook.html b/IPython/frontend/html/notebook/templates/notebook.html index da00127..645f637 100644 --- a/IPython/frontend/html/notebook/templates/notebook.html +++ b/IPython/frontend/html/notebook/templates/notebook.html @@ -41,7 +41,6 @@ - Idle @@ -69,6 +68,10 @@ @@ -213,6 +216,7 @@ +