##// END OF EJS Templates
Merge branch 'htmlnotebook_publish' of https://github.com/stefanv/ipython into stefanv-htmlnotebook_publish
Brian E. Granger -
r4619:d5b4ff0a merge
parent child Browse files
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
@@ -32,6 +32,7 b' $(document).ready(function () {'
32 IPython.pager = new IPython.Pager('div#pager', 'div#pager_splitter');
32 IPython.pager = new IPython.Pager('div#pager', 'div#pager_splitter');
33 IPython.left_panel = new IPython.LeftPanel('div#left_panel', 'div#left_panel_splitter');
33 IPython.left_panel = new IPython.LeftPanel('div#left_panel', 'div#left_panel_splitter');
34 IPython.save_widget = new IPython.SaveWidget('span#save_widget');
34 IPython.save_widget = new IPython.SaveWidget('span#save_widget');
35 IPython.print_widget = new IPython.PrintWidget('span#print_widget');
35 IPython.notebook = new IPython.Notebook('div#notebook');
36 IPython.notebook = new IPython.Notebook('div#notebook');
36 IPython.kernel_status_widget = new IPython.KernelStatusWidget('#kernel_status');
37 IPython.kernel_status_widget = new IPython.KernelStatusWidget('#kernel_status');
37 IPython.kernel_status_widget.status_idle();
38 IPython.kernel_status_widget.status_idle();
@@ -90,20 +90,23 b' var IPython = (function (IPython) {'
90
90
91
91
92 SaveWidget.prototype.status_save = function () {
92 SaveWidget.prototype.status_save = function () {
93 this.element.find('span.ui-button-text').text('Save');
93 this.element.find('button#save_notebook').button('option', 'label', 'Save');
94 this.element.find('button#save_notebook').button('enable');
94 this.element.find('button#save_notebook').button('enable');
95 };
95 IPython.print_widget.enable();
96 };
96
97
97
98
98 SaveWidget.prototype.status_saving = function () {
99 SaveWidget.prototype.status_saving = function () {
99 this.element.find('span.ui-button-text').text('Saving');
100 this.element.find('button#save_notebook').button('option', 'label', 'Saving');
100 this.element.find('button#save_notebook').button('disable');
101 this.element.find('button#save_notebook').button('disable');
101 };
102 IPython.print_widget.disable();
103 };
102
104
103
105
104 SaveWidget.prototype.status_loading = function () {
106 SaveWidget.prototype.status_loading = function () {
105 this.element.find('span.ui-button-text').text('Loading');
107 this.element.find('button#save_notebook').button('option', 'label', 'Loading');
106 this.element.find('button#save_notebook').button('disable');
108 this.element.find('button#save_notebook').button('disable');
109 IPython.print_widget.disable();
107 };
110 };
108
111
109
112
@@ -68,6 +68,10 b''
68 </select>
68 </select>
69 </span>
69 </span>
70 <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
71 <button id="download_notebook">Export</button>
75 <button id="download_notebook">Export</button>
72 </span>
76 </span>
73 </div>
77 </div>
@@ -212,6 +216,7 b''
212 <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>
213 <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>
214 <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>
215 <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>
216 <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>
217 <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