fix: только печать PDF

This commit is contained in:
Anar 2026-08-19 14:25:35 +00:00
parent fba7822f2b
commit 1a89e0e062

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.min.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; }
@ -30,7 +29,7 @@
<div class="nav"> <div class="nav">
<button class="prev-next" onclick="go(-1)">← Назад</button> <button class="prev-next" onclick="go(-1)">← Назад</button>
<button class="prev-next" onclick="go(1)">Вперёд →</button> <button class="prev-next" onclick="go(1)">Вперёд →</button>
<button class="pptx" onclick="downloadPptx()" id="dlbtn">📥 Скачать .pptx</button> <button class="pptx" onclick="window.print()">🖨 Печать / PDF</button>
</div> </div>
<div class="num" id="num"></div> <div class="num" id="num"></div>
<script> <script>
@ -167,29 +166,6 @@ document.addEventListener("keydown", function (e) {
if (e.key === "ArrowRight" || e.key === " ") go(1); if (e.key === "ArrowRight" || e.key === " ") go(1);
if (e.key === "ArrowLeft") go(-1); if (e.key === "ArrowLeft") go(-1);
}); });
function downloadPptx() {
var btn = document.getElementById('dlbtn');
try {
var p = new PptxGenJS();
btn.textContent = '⏳ Загрузка...';
p.defineLayout({ name: "W", width: 13.33, height: 7.5 });
p.layout = "W";
SLIDES.forEach(function (s) {
var sl = p.addSlide();
sl.background = { color: "0F1218" };
sl.addText(s.title, { x: 0.7, y: 0.5, w: 12, h: 1.2, fontSize: 32, bold: true, color: "F4F4F5" });
sl.addText(s.bullets.map(function (b) { return { text: b, options: { bullet: true, breakLine: true } }; }),
{ 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" });
btn.textContent = '✅ Готово!';
setTimeout(function() { btn.textContent = '📥 Скачать .pptx'; }, 3000);
} catch(e) {
btn.textContent = '❌ Ошибка';
alert('Не удалось скачать: ' + e.message + '\\n\\nПопробуй Ctrl+P → Сохранить как PDF');
setTimeout(function() { btn.textContent = '📥 Скачать .pptx'; }, 3000);
}
}
render(); render();
</script> </script>
</body> </body>