Add a qr code to the link of an item or attachment

This commit is contained in:
eikek
2021-08-17 02:15:14 +02:00
parent 2d2f9e3e87
commit 8f23b68587
14 changed files with 307 additions and 41 deletions

View File

@ -105,3 +105,31 @@ elmApp.ports.checkSearchQueryString.subscribe(function(args) {
elmApp.ports.receiveCheckQueryResult.send(answer);
}
});
elmApp.ports.printElement.subscribe(function(id) {
if (id) {
var el = document.getElementById(id);
var head = document.getElementsByTagName('head');
if (head && head.length > 0) {
head = head[0];
}
if (el) {
var w = window.open();
w.document.write('<html>');
if (head) {
w.document.write('<head>');
['title', 'meta'].forEach(function(el) {
var headEls = head.getElementsByTagName(el);
for (var i=0; i<headEls.length; i++) {
w.document.write(headEls.item(i).outerHTML);
}
});
w.document.write('</head>');
}
w.document.write('<body>');
w.document.write(el.outerHTML);
w.document.write('<script type="application/javascript">window.print(); window.close();</script>');
w.document.write('</body></html>');
}
}
});