##// END OF EJS Templates
Merge pull request #1072 from takluyver/i89...
Merge pull request #1072 from takluyver/i89 If object has a getdoc() method, use its return value (as long as it's a string) as the object's docstring. Closes gh-89 (duplicate docstrings when objects have getdoc).

File last commit:

r5150:bbc4d01c
r5574:8a4e8d9b merge
Show More
printwidget.js
60 lines | 1.9 KiB | application/javascript | JavascriptLexer
Stefan van der Walt
Refactor static printing.
r4615 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();
MinRK
Add tooltips to the notebook via 'title' attr....
r5097 this.element.find('button#print_notebook').attr('title',
"Open a new window with printer-friendly HTML of the Notebook." +
" Note that this is incomplete, and may not produce perfect" +
MinRK
Add tooltip to Download/Print indicating need to save first...
r5150 " printed output." +
" Make sure to save before printing, to ensure the output is up to date."
);
Stefan van der Walt
Refactor static printing.
r4615 };
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 = '<html><head>' +
$('head').clone().html() +
'<style type="text/css">' +
'@media print { body { overflow: visible !important; } }' +
'.ui-widget-content { border: 0px; }' +
'</style>' +
'</head><body style="overflow: auto;">' +
$('#notebook').clone().html() +
'</body></html>';
w.document.open();
w.document.write(html);
w.document.close();
return false;
};
IPython.PrintWidget = PrintWidget;
return IPython;
Brian E. Granger
Adding page break logic to the print css....
r4625 }(IPython));