[minor] [print] create print html in a new window, so as to avoid style creep

This commit is contained in:
Anand Doshi 2013-07-18 18:37:57 +05:30
parent 7bf744bd44
commit 4f17c8d1ef

View file

@ -45,16 +45,23 @@ _p.def_print_style_other = "\n.simpletable, .noborder { \
}";
_p.go = function(html) {
var d = document.createElement('div')
d.innerHTML = html
$(d).printElement();
var w = window.open();
if(!w) {
msgprint(_("Please enable pop-ups"));
return;
}
w.document.write(html);
w.print();
w.close();
}
_p.preview = function(html) {
var w = window.open('');
if(!w) return;
w.document.write(html)
w.document.close();
var w = window.open();
if(!w) {
msgprint(_("Please enable pop-ups"));
return;
}
w.document.write(html);
}