-
Notifications
You must be signed in to change notification settings - Fork 2
/
dhx.ui.viewer.js
executable file
·60 lines (56 loc) · 2.27 KB
/
dhx.ui.viewer.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/*global $dhx, dhtmlx */
$dhx.ui.viewer = {
pdf : function( path ){
var y = document.createElement("div");
y.style.height = "100%";
y.style.width = "100%";
y.id = new Date().getTime();
var dhx_pdf_window = new $dhx.ui.window({
id: new Date().getTime() - 1000,
left: 100,
top: 100,
width: 800,
height: 500
});
dhx_pdf_window.button('park').hide();
//dhx_pdf_window.button('minmax').hide();
dhx_pdf_window.button('stick').hide();
dhx_pdf_window.setText("PDF preview - " + path);
var dhx_pdf_status_bar = dhx_pdf_window.attachStatusBar();
dhx_pdf_status_bar.setText('Press ctrl+p (cmd+p Mac) to print it');
//y.style.display = "none";
document.body.appendChild(y);
var m = "form_" + y.id;
y.innerHTML = '<iframe name="pdfFrame" width="100%" height="100%" frameborder="0"></iframe><form style="display:none;" id="' + m +
'" method="post" action="' + $dhx.ui.cdn_address + 'dhx/ui/pdfjs/web/viewer.php?pdf_name=' + path + '" accept-charset="utf-8" enctype="application/x-www-form-urlencoded" target="pdfFrame"></form>';
dhx_pdf_window.attachObject(y.id);
//document.getElementById(m).firstChild.value = encodeURIComponent(A(r).replace("\u2013", "-") + g() + s());
document.getElementById(m).submit();
},
image : function( path ){
var y = document.createElement("div");
y.style.height = "100%";
y.style.width = "100%";
y.id = new Date().getTime();
var dhx_pdf_window = new $dhx.ui.window({
id: new Date().getTime() - 1000,
left: 100,
top: 100,
width: 800,
height: 500
});
dhx_pdf_window.button('park').hide();
//dhx_pdf_window.button('minmax').hide();
dhx_pdf_window.button('stick').hide();
dhx_pdf_window.setText("Image preview - " + path);
var dhx_pdf_status_bar = dhx_pdf_window.attachStatusBar();
dhx_pdf_status_bar.setText('Press ctrl+p (cmd+p Mac) to print it');
//y.style.display = "none";
document.body.appendChild(y);
var m = "form_" + y.id;
y.innerHTML = '<iframe src="' + path + '" name="imageFrame' + path + '" width="100%" height="100%" frameborder="0"></iframe>';
dhx_pdf_window.attachObject(y.id);
//document.getElementById(m).firstChild.value = encodeURIComponent(A(r).replace("\u2013", "-") + g() + s());
//document.getElementById(m).submit();
}
};