Show More
@@ -0,0 +1,54 b'' | |||||
|
1 | var IPython = (function (IPython) { | |||
|
2 | ||||
|
3 | var PrintWidget = function (selector) { | |||
|
4 | this.selector = selector; | |||
|
5 | if (this.selector !== undefined) { | |||
|
6 | this.element = $(selector); | |||
|
7 | this.style(); | |||
|
8 | this.bind_events(); | |||
|
9 | } | |||
|
10 | }; | |||
|
11 | ||||
|
12 | PrintWidget.prototype.style = function () { | |||
|
13 | this.element.find('button#print_notebook').button(); | |||
|
14 | }; | |||
|
15 | ||||
|
16 | PrintWidget.prototype.bind_events = function () { | |||
|
17 | var that = this; | |||
|
18 | this.element.find('button#print_notebook').click(function () { | |||
|
19 | that.print_notebook(); | |||
|
20 | }); | |||
|
21 | }; | |||
|
22 | ||||
|
23 | PrintWidget.prototype.enable = function () { | |||
|
24 | this.element.find('button#print_notebook').button('enable'); | |||
|
25 | }; | |||
|
26 | ||||
|
27 | PrintWidget.prototype.disable = function () { | |||
|
28 | this.element.find('button#print_notebook').button('disable'); | |||
|
29 | }; | |||
|
30 | ||||
|
31 | PrintWidget.prototype.print_notebook = function () { | |||
|
32 | var w = window.open('', '_blank', 'scrollbars=1,menubar=1'); | |||
|
33 | var html = '<html><head>' + | |||
|
34 | $('head').clone().html() + | |||
|
35 | '<style type="text/css">' + | |||
|
36 | '@media print { body { overflow: visible !important; } }' + | |||
|
37 | '.ui-widget-content { border: 0px; }' + | |||
|
38 | '</style>' + | |||
|
39 | '</head><body style="overflow: auto;">' + | |||
|
40 | $('#notebook').clone().html() + | |||
|
41 | '</body></html>'; | |||
|
42 | ||||
|
43 | w.document.open(); | |||
|
44 | w.document.write(html); | |||
|
45 | w.document.close(); | |||
|
46 | ||||
|
47 | return false; | |||
|
48 | }; | |||
|
49 | ||||
|
50 | IPython.PrintWidget = PrintWidget; | |||
|
51 | ||||
|
52 | return IPython; | |||
|
53 | ||||
|
54 | }(IPython)); No newline at end of file |
@@ -762,24 +762,6 b' var IPython = (function (IPython) {' | |||||
762 | }; |
|
762 | }; | |
763 | }; |
|
763 | }; | |
764 |
|
764 | |||
765 | Notebook.prototype.publish_notebook = function () { |
|
|||
766 | var w = window.open('', '_blank', 'scrollbars=1,menubar=1'); |
|
|||
767 | var html = '<html><head>' + |
|
|||
768 | $('head').clone().html() + |
|
|||
769 | '<style type="text/css">' + |
|
|||
770 | '@media print { body { overflow: visible !important; } }' + |
|
|||
771 | '.ui-widget-content { border: 0px; }' + |
|
|||
772 | '</style>' + |
|
|||
773 | '</head><body style="overflow: auto;">' + |
|
|||
774 | $('#notebook').clone().html() + |
|
|||
775 | '</body></html>'; |
|
|||
776 |
|
||||
777 | w.document.open(); |
|
|||
778 | w.document.write(html); |
|
|||
779 | w.document.close(); |
|
|||
780 |
|
||||
781 | return false; |
|
|||
782 | }; |
|
|||
783 |
|
765 | |||
784 | Notebook.prototype.notebook_saved = function (data, status, xhr) { |
|
766 | Notebook.prototype.notebook_saved = function (data, status, xhr) { | |
785 | this.dirty = false; |
|
767 | this.dirty = false; |
@@ -26,6 +26,7 b' $(document).ready(function () {' | |||||
26 | IPython.pager = new IPython.Pager('div#pager', 'div#pager_splitter'); |
|
26 | IPython.pager = new IPython.Pager('div#pager', 'div#pager_splitter'); | |
27 | IPython.left_panel = new IPython.LeftPanel('div#left_panel', 'div#left_panel_splitter'); |
|
27 | IPython.left_panel = new IPython.LeftPanel('div#left_panel', 'div#left_panel_splitter'); | |
28 | IPython.save_widget = new IPython.SaveWidget('span#save_widget'); |
|
28 | IPython.save_widget = new IPython.SaveWidget('span#save_widget'); | |
|
29 | IPython.print_widget = new IPython.PrintWidget('span#print_widget'); | |||
29 | IPython.notebook = new IPython.Notebook('div#notebook'); |
|
30 | IPython.notebook = new IPython.Notebook('div#notebook'); | |
30 | IPython.kernel_status_widget = new IPython.KernelStatusWidget('#kernel_status'); |
|
31 | IPython.kernel_status_widget = new IPython.KernelStatusWidget('#kernel_status'); | |
31 | IPython.kernel_status_widget.status_idle(); |
|
32 | IPython.kernel_status_widget.status_idle(); |
@@ -21,7 +21,6 b' var IPython = (function (IPython) {' | |||||
21 | SaveWidget.prototype.style = function () { |
|
21 | SaveWidget.prototype.style = function () { | |
22 | this.element.find('input#notebook_name').addClass('ui-widget ui-widget-content'); |
|
22 | this.element.find('input#notebook_name').addClass('ui-widget ui-widget-content'); | |
23 | this.element.find('button#save_notebook').button(); |
|
23 | this.element.find('button#save_notebook').button(); | |
24 | this.element.find('button#publish_notebook').button(); |
|
|||
25 | var left_panel_width = $('div#left_panel').outerWidth(); |
|
24 | var left_panel_width = $('div#left_panel').outerWidth(); | |
26 | var left_panel_splitter_width = $('div#left_panel_splitter').outerWidth(); |
|
25 | var left_panel_splitter_width = $('div#left_panel_splitter').outerWidth(); | |
27 | $('span#save_widget').css({marginLeft:left_panel_width+left_panel_splitter_width}); |
|
26 | $('span#save_widget').css({marginLeft:left_panel_width+left_panel_splitter_width}); | |
@@ -34,10 +33,6 b' var IPython = (function (IPython) {' | |||||
34 | IPython.notebook.save_notebook(); |
|
33 | IPython.notebook.save_notebook(); | |
35 | that.set_document_title(); |
|
34 | that.set_document_title(); | |
36 | }); |
|
35 | }); | |
37 |
|
||||
38 | this.element.find('button#publish_notebook').click(function () { |
|
|||
39 | IPython.notebook.publish_notebook(); |
|
|||
40 | }); |
|
|||
41 | }; |
|
36 | }; | |
42 |
|
37 | |||
43 |
|
38 | |||
@@ -89,23 +84,23 b' var IPython = (function (IPython) {' | |||||
89 |
|
84 | |||
90 |
|
85 | |||
91 | SaveWidget.prototype.status_save = function () { |
|
86 | SaveWidget.prototype.status_save = function () { | |
92 |
|
|
87 | this.element.find('button#save_notebook').button('option', 'label', 'Save'); | |
93 |
|
|
88 | this.element.find('button#save_notebook').button('enable'); | |
94 | $('button#publish_notebook').button('enable'); |
|
89 | IPython.print_widget.enable(); | |
95 | }; |
|
90 | }; | |
96 |
|
91 | |||
97 |
|
92 | |||
98 | SaveWidget.prototype.status_saving = function () { |
|
93 | SaveWidget.prototype.status_saving = function () { | |
99 |
|
|
94 | this.element.find('button#save_notebook').button('option', 'label', 'Saving'); | |
100 |
|
|
95 | this.element.find('button#save_notebook').button('disable'); | |
101 | $('button#publish_notebook').button('disable'); |
|
96 | IPython.print_widget.disable(); | |
102 | }; |
|
97 | }; | |
103 |
|
98 | |||
104 |
|
99 | |||
105 | SaveWidget.prototype.status_loading = function () { |
|
100 | SaveWidget.prototype.status_loading = function () { | |
106 |
|
|
101 | this.element.find('button#save_notebook').button('option', 'label', 'Loading'); | |
107 |
|
|
102 | this.element.find('button#save_notebook').button('disable'); | |
108 | $('button#publish_notebook').button('disable'); |
|
103 | IPython.print_widget.disable(); | |
109 | }; |
|
104 | }; | |
110 |
|
105 | |||
111 |
|
106 |
@@ -41,7 +41,6 b'' | |||||
41 | <input type="text" id="notebook_name" size="20"></textarea> |
|
41 | <input type="text" id="notebook_name" size="20"></textarea> | |
42 | <span id="notebook_id" style="display:none">{{notebook_id}}</span> |
|
42 | <span id="notebook_id" style="display:none">{{notebook_id}}</span> | |
43 | <button id="save_notebook">Save</button> |
|
43 | <button id="save_notebook">Save</button> | |
44 | <button id="publish_notebook">Publish</button> |
|
|||
45 | </span> |
|
44 | </span> | |
46 | <span id="kernel_status">Idle</span> |
|
45 | <span id="kernel_status">Idle</span> | |
47 | </div> |
|
46 | </div> | |
@@ -69,6 +68,10 b'' | |||||
69 | </select> |
|
68 | </select> | |
70 | </span> |
|
69 | </span> | |
71 | <span class="section_row_buttons"> |
|
70 | <span class="section_row_buttons"> | |
|
71 | <span id="print_widget"> | |||
|
72 | <button id="print_notebook">Print/HTML</button> | |||
|
73 | </span> | |||
|
74 | ||||
72 | <button id="download_notebook">Export</button> |
|
75 | <button id="download_notebook">Export</button> | |
73 | </span> |
|
76 | </span> | |
74 | </div> |
|
77 | </div> | |
@@ -213,6 +216,7 b'' | |||||
213 | <script src="static/js/savewidget.js" type="text/javascript" charset="utf-8"></script> |
|
216 | <script src="static/js/savewidget.js" type="text/javascript" charset="utf-8"></script> | |
214 | <script src="static/js/pager.js" type="text/javascript" charset="utf-8"></script> |
|
217 | <script src="static/js/pager.js" type="text/javascript" charset="utf-8"></script> | |
215 | <script src="static/js/panelsection.js" type="text/javascript" charset="utf-8"></script> |
|
218 | <script src="static/js/panelsection.js" type="text/javascript" charset="utf-8"></script> | |
|
219 | <script src="static/js/printwidget.js" type="text/javascript" charset="utf-8"></script> | |||
216 | <script src="static/js/leftpanel.js" type="text/javascript" charset="utf-8"></script> |
|
220 | <script src="static/js/leftpanel.js" type="text/javascript" charset="utf-8"></script> | |
217 | <script src="static/js/notebook.js" type="text/javascript" charset="utf-8"></script> |
|
221 | <script src="static/js/notebook.js" type="text/javascript" charset="utf-8"></script> | |
218 | <script src="static/js/notebook_main.js" type="text/javascript" charset="utf-8"></script> |
|
222 | <script src="static/js/notebook_main.js" type="text/javascript" charset="utf-8"></script> |
General Comments 0
You need to be logged in to leave comments.
Login now