瀏覽代碼

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

version-14
Anand Doshi 12 年之前
父節點
當前提交
4f17c8d1ef
共有 1 個文件被更改,包括 14 次插入7 次删除
  1. +14
    -7
      public/js/legacy/widgets/form/print_format.js

+ 14
- 7
public/js/legacy/widgets/form/print_format.js 查看文件

@@ -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);
}




Loading…
取消
儲存