diff --git a/index.html b/index.html index 824f7f7..fa15f96 100644 --- a/index.html +++ b/index.html @@ -167,13 +167,18 @@ document.addEventListener("keydown", function (e) { if (e.key === "ArrowLeft") go(-1); }); function downloadPptx() { - if (typeof PptxGenJS === 'undefined') { - alert('Загрузка библиотеки... Повторите нажатие через 3 секунды'); - var script = document.createElement('script'); - script.src = 'https://cdn.jsdelivr.net/npm/pptxgenjs@3.12.0/dist/pptxgen.min.js'; - document.head.appendChild(script); + if (typeof PptxGenJS !== 'undefined') { + createPptx(); return; } + var script = document.createElement('script'); + script.src = 'https://cdn.jsdelivr.net/npm/pptxgenjs@3.12.0/dist/pptxgen.min.js'; + script.onload = function() { + createPptx(); + }; + document.head.appendChild(script); +} +function createPptx() { var p = new PptxGenJS(); p.defineLayout({ name: "W", width: 13.33, height: 7.5 }); p.layout = "W";