File size: 1,505 Bytes
19eb269 c250c33 19eb269 c250c33 19eb269 c250c33 19eb269 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
function exportHtml() {
const htmlCode = editor.getHtml();
const cssCode = editor.getCss();
const jsCode = editor.getJs();
// Собираем выбранные скрипты по галочкам
const selectedScripts = [];
if (document.getElementById('script1-checkbox').checked) {
selectedScripts.push(document.getElementById('script1-checkbox').value);
}
if (document.getElementById('script2-checkbox').checked) {
selectedScripts.push(document.getElementById('script2-checkbox').value);
}
if (document.getElementById('script3-checkbox').checked) {
selectedScripts.push(document.getElementById('script3-checkbox').value);
}
// Собираем дополнительные скрипты
const additionalScripts = selectedScripts.map(script => `<script src="${script}"><\/script>`).join('');
// Собираем собственные скрипты, которые вы написали
const customScripts = `
${jsCode}
`;
// Объединение всего в один HTML-файл
const fullHtml = `
<!DOCTYPE html>
<html>
<head>
<style>${cssCode}</style>
</head>
<body>
${htmlCode}
${additionalScripts}
${customScripts}
</body>
</html>
`;
// Сохранение HTML-файла
const blob = new Blob([fullHtml], { type: 'text/html' });
const url = URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url;
a.download = 'page.html';
a.click();
} |