Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
erp5-bin
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Hamza
erp5-bin
Commits
bfa143c0
Commit
bfa143c0
authored
Aug 06, 2019
by
Hamza Chahed
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a first download as pdf Option without Header/Footer or Table of content
parent
de8a0635
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
1 deletion
+41
-1
bt5/erp5_notebook/SkinTemplateItem/portal_skins/erp5_notebook/gadget_jsmd_eval.js.js
...ateItem/portal_skins/erp5_notebook/gadget_jsmd_eval.js.js
+40
-0
bt5/erp5_notebook/SkinTemplateItem/portal_skins/erp5_notebook/gadget_jsmd_viewer.js.js
...eItem/portal_skins/erp5_notebook/gadget_jsmd_viewer.js.js
+1
-1
No files found.
bt5/erp5_notebook/SkinTemplateItem/portal_skins/erp5_notebook/gadget_jsmd_eval.js.js
View file @
bfa143c0
...
...
@@ -512,6 +512,30 @@
};
}
///P
function
download
()
{
//remove the default margin
var
style
=
document
.
createElement
(
'
style
'
);
style
.
setAttribute
(
"
type
"
,
"
text/css
"
);
style
.
setAttribute
(
"
media
"
,
"
print
"
);
var
multiStr
=
[
"
@page{
"
,
"
size: auto;
"
,
"
margin: 0mm;
"
,
"
margin-right: 3%;
"
,
"
margin-left:3%;}
"
].
join
(
"
\n
"
);
style
.
innerHTML
=
multiStr
;
document
.
head
.
appendChild
(
style
);
// remove-insert download-button
var
button
=
document
.
createElement
(
'
botton
'
);
button
=
document
.
body
.
firstChild
;
document
.
body
.
removeChild
(
button
);
window
.
print
();
document
.
body
.
insertBefore
(
button
,
document
.
body
.
firstChild
);
}
///P
document
.
addEventListener
(
'
DOMContentLoaded
'
,
function
()
{
...
...
@@ -525,6 +549,22 @@
queue
.
push
(
deferCellExecution
(
cell_list
[
i
]));
}
return
queue
///P
.
push
(
function
()
{
var
button
=
document
.
createElement
(
'
botton
'
);
button
.
innerHTML
=
"
Download As PDF
"
;
button
.
setAttribute
(
"
type
"
,
"
button
"
);
document
.
body
.
insertBefore
(
button
,
document
.
body
.
firstChild
);
document
.
querySelector
(
'
[type="button"]
'
).
addEventListener
(
"
click
"
,
download
);
//
var
script
=
document
.
createElement
(
'
script
'
);
script
.
setAttribute
(
"
src
"
,
"
https://cdnjs.cloudflare.com/ajax/libs/jspdf/1.3.2/jspdf.min.js
"
);
document
.
head
.
appendChild
(
script
);
script
.
setAttribute
(
"
src
"
,
"
https://html2canvas.hertzen.com/dist/html2canvas.min.js
"
);
document
.
head
.
appendChild
(
script
);
//
})
///P
.
push
(
function
()
{
console
.
info
(
'
JSMD executed.
'
);
},
function
(
error
)
{
...
...
bt5/erp5_notebook/SkinTemplateItem/portal_skins/erp5_notebook/gadget_jsmd_viewer.js.js
View file @
bfa143c0
...
...
@@ -62,7 +62,7 @@
.push(function (evt) {
*/
// XXX Insecure
iframe
.
setAttribute
(
"
sandbox
"
,
"
allow-scripts allow-same-origin
"
);
iframe
.
setAttribute
(
"
sandbox
"
,
"
allow-scripts allow-same-origin
allow-modals
"
);
///P
// iframe.setAttribute("csp", "default-src *; script-src * 'unsafe-inline';");
// iframe.setAttribute("src", evt.target.result);
iframe
.
setAttribute
(
"
srcdoc
"
,
doc
.
documentElement
.
outerHTML
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment