diff options
| author | 2019-05-30 12:38:19 +0200 | |
|---|---|---|
| committer | 2019-05-30 12:38:19 +0200 | |
| commit | 2882752117c31762c88e2aa6cf345c7096f812c8 (patch) | |
| tree | 3b893739529a054b0fdcb5c08d8559ca5d8e6346 | |
| parent | 9f1eb482d142c39c80f304d6d0bd7a0c66d50c9b (diff) | |
| parent | d5ea3e96ef67e091d55354f6c5342801a9e8b48e (diff) | |
Merge pull request #2374 from aledeg/feature/print-css
Add theme to print page
| -rw-r--r-- | p/scripts/main.js | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/p/scripts/main.js b/p/scripts/main.js index d85a3ae15..4fd91235e 100644 --- a/p/scripts/main.js +++ b/p/scripts/main.js @@ -859,15 +859,11 @@ function init_stream(stream) { el = ev.target.closest('.item.share > a[href="#"]'); if (el) { //Print - const content = '<html><head><style>' + - 'body { font-family: Serif; text-align: justify; }' + - 'a { color: #000; text-decoration: none; }' + - 'a:after { content: " [" attr(href) "]"}' + - '</style></head><body>' + - el.closest('.flux_content').querySelector('.content').innerHTML + - '</body></html>'; const tmp_window = window.open(); - tmp_window.document.writeln(content); + for (var i = 0; i < document.styleSheets.length; i++) { + tmp_window.document.writeln('<link href="' + document.styleSheets[i].href + '" rel="stylesheet" type="text/css" />'); + } + tmp_window.document.writeln(el.closest('.flux_content').querySelector('.content').innerHTML); tmp_window.document.close(); tmp_window.focus(); tmp_window.print(); |
