fix: кнопки с обработкой ошибок
This commit is contained in:
parent
316894059c
commit
fba7822f2b
12
index.html
12
index.html
@ -30,7 +30,7 @@
|
||||
<div class="nav">
|
||||
<button class="prev-next" onclick="go(-1)">← Назад</button>
|
||||
<button class="prev-next" onclick="go(1)">Вперёд →</button>
|
||||
<button class="pptx" onclick="downloadPptx()">📥 Скачать .pptx</button>
|
||||
<button class="pptx" onclick="downloadPptx()" id="dlbtn">📥 Скачать .pptx</button>
|
||||
</div>
|
||||
<div class="num" id="num"></div>
|
||||
<script>
|
||||
@ -168,7 +168,10 @@ document.addEventListener("keydown", function (e) {
|
||||
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) {
|
||||
@ -179,6 +182,13 @@ function downloadPptx() {
|
||||
{ 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();
|
||||
</script>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user