-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
35 lines (28 loc) · 993 Bytes
/
script.js
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
var d = new Date();
var y = d.getFullYear();
document.getElementById("year").innerHTML = y;
var html = document.getElementById('html-code');
var css = document.getElementById('css-code');
var js = document.getElementById('js-code');
function run() {
var output = document.getElementById('output');
output.contentWindow.document.body.innerHTML = `${html.value} <style> ${css.value} </style> `;
// output.contentWindow.document.body.innerHTML += '<style>'+css+'</style>';
output.contentWindow.eval(js.value);
};
function download() {
var zip = new JSZip();
zip.file("index.html", html.value);
zip.file("style.css", css.value);
zip.file("script.js", js.value);
zip.generateAsync({ type: "blob" })
.then(function (content) {
// see FileSaver.js
saveAs(content, "projects.zip");
});
};
// Syntax Highlighters
// ace.edit('html-code', {
// mode: 'ace/mode/html',
// theme: 'ace/theme/monokai',
// });