File size: 1,350 Bytes
19eb269 a0d29ff 19eb269 a0d29ff 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 |
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('');
// Объединение всего в один HTML-файл
const fullHtml = `
<!DOCTYPE html>
<html>
<head>
<style>${cssCode}</style>
</head>
<body>
${htmlCode}
<script>${jsCode}<\/script>
${additionalScripts}
</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();
} |