aboutsummaryrefslogtreecommitdiffstats
path: root/static/js/print_element.js
diff options
context:
space:
mode:
Diffstat (limited to 'static/js/print_element.js')
-rw-r--r--static/js/print_element.js26
1 files changed, 26 insertions, 0 deletions
diff --git a/static/js/print_element.js b/static/js/print_element.js
new file mode 100644
index 00000000..ee0e7212
--- /dev/null
+++ b/static/js/print_element.js
@@ -0,0 +1,26 @@
+function printElement(elem, append, delimiter) {
+ var domClone = elem.cloneNode(true);
+
+ var $printSection = document.getElementById("printSection");
+
+ if (!$printSection) {
+ var $printSection = document.createElement("div");
+ $printSection.id = "printSection";
+ document.body.appendChild($printSection);
+ }
+
+ if (append !== true) {
+ $printSection.innerHTML = "";
+ }
+
+ else if (append === true) {
+ if (typeof (delimiter) === "string") {
+ $printSection.innerHTML += delimiter;
+ }
+ else if (typeof (delimiter) === "object") {
+ $printSection.appendChlid(delimiter);
+ }
+ }
+
+ $printSection.appendChild(domClone);
+}