fix: скачивание pptx с проверкой загрузки библиотеки
This commit is contained in:
parent
7e545793f4
commit
ce8553c819
@ -167,10 +167,13 @@ document.addEventListener("keydown", function (e) {
|
|||||||
if (e.key === "ArrowLeft") go(-1);
|
if (e.key === "ArrowLeft") go(-1);
|
||||||
});
|
});
|
||||||
function downloadPptx() {
|
function downloadPptx() {
|
||||||
// Динамически загружаем библиотеку
|
if (typeof PptxGenJS === 'undefined') {
|
||||||
|
alert('Загрузка библиотеки... Повторите нажатие через 3 секунды');
|
||||||
var script = document.createElement('script');
|
var script = document.createElement('script');
|
||||||
script.src = 'https://cdn.jsdelivr.net/npm/pptxgenjs@3.12.0/dist/pptxgen.min.js';
|
script.src = 'https://cdn.jsdelivr.net/npm/pptxgenjs@3.12.0/dist/pptxgen.min.js';
|
||||||
script.onload = function() {
|
document.head.appendChild(script);
|
||||||
|
return;
|
||||||
|
}
|
||||||
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";
|
||||||
@ -182,8 +185,6 @@ 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>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user