webapp.pdf-exporter.js.side-panel-starter.js Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ch.sbb.polarion.extension.pdf-exporter Show documentation
Show all versions of ch.sbb.polarion.extension.pdf-exporter Show documentation
This Polarion extension provides possibility to convert Polarion Documents to PDF files. This is an alternative to native Polarion's solution.
const PdfExporterSidePanelStarter = {
timestampParam: `?timestamp=${Date.now()}`,
injectAll: function () {
this.injectScript("common-script", `/polarion/pdf-exporter/ui/generic/js/common.js${this.timestampParam}`);
this.injectScript("ExportParams-script", `/polarion/pdf-exporter/ui/js/modules/ExportParams.js${this.timestampParam}`, 'module');
this.injectScript("export-common-script", `/polarion/pdf-exporter/ui/js/export-common.js${this.timestampParam}`);
this.injectScript("export-pdf-script", `/polarion/pdf-exporter/ui/js/export-pdf.js${this.timestampParam}`);
},
injectScript: function (id, componentScriptPath, type = "text/javascript") {
if (top.document.body && !top.document.getElementById(id)) {
const scriptElement = document.createElement("script");
scriptElement.id = id;
scriptElement.setAttribute("src", componentScriptPath);
scriptElement.setAttribute("type", type);
top.document.body.appendChild(scriptElement);
}
},
}
PdfExporterSidePanelStarter.injectAll();