fix: загрузка pptxgenjs только при скачивании

This commit is contained in:
Anar 2026-08-19 14:06:17 +00:00
parent 755b9fc478
commit 64aa96775a

View File

@ -4,7 +4,6 @@
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<title>Routing Engine Juniper — Полное руководство</title> <title>Routing Engine Juniper — Полное руководство</title>
<script src="https://cdn.jsdelivr.net/npm/pptxgenjs@3.12.0/dist/pptxgen.bundle.js"></script>
<style> <style>
* { margin: 0; box-sizing: border-box; } * { margin: 0; box-sizing: border-box; }
body { font-family: -apple-system, "Segoe UI", Roboto, sans-serif; background: #0f1218; color: #f4f4f5; } body { font-family: -apple-system, "Segoe UI", Roboto, sans-serif; background: #0f1218; color: #f4f4f5; }
@ -168,6 +167,10 @@ document.addEventListener("keydown", function (e) {
if (e.key === "ArrowLeft") go(-1); if (e.key === "ArrowLeft") go(-1);
}); });
function downloadPptx() { function downloadPptx() {
// Динамически загружаем библиотеку
var script = document.createElement('script');
script.src = 'https://cdn.jsdelivr.net/npm/pptxgenjs@3.12.0/dist/pptxgen.min.js';
script.onload = function() {
var p = new PptxGenJS(); var p = new PptxGenJS();
p.defineLayout({ name: "W", width: 13.33, height: 7.5 }); p.defineLayout({ name: "W", width: 13.33, height: 7.5 });
p.layout = "W"; p.layout = "W";
@ -179,6 +182,8 @@ function downloadPptx() {
{ x: 0.9, y: 1.8, w: 11.5, h: 5.2, fontSize: 16, color: "E4E4E7", lineSpacingMultiple: 1.3 }); { x: 0.9, y: 1.8, w: 11.5, h: 5.2, fontSize: 16, color: "E4E4E7", lineSpacingMultiple: 1.3 });
}); });
p.writeFile({ fileName: "Juniper_RE_Complete_Guide.pptx" }); p.writeFile({ fileName: "Juniper_RE_Complete_Guide.pptx" });
};
document.head.appendChild(script);
} }
render(); render();
</script> </script>