Skip to content
This repository was archived by the owner on Jan 23, 2026. It is now read-only.

Commit d1989c1

Browse files
committed
update ugly css
1 parent 7fffc7d commit d1989c1

File tree

5 files changed

+257
-255
lines changed

5 files changed

+257
-255
lines changed

content/blaze.css

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
@import url('https://site-assets.fontawesome.com/releases/v6.2.0/css/all.css');
2+
@import url('https://embernetwork.github.io/assets/css/main.css');
3+
4+
* {
5+
scroll-behavior: smooth;
6+
user-select: none;
7+
}
8+
9+
body,
10+
html {
11+
height: auto;
12+
width: auto;
13+
}
14+
15+
.logs {
16+
margin: 15px;
17+
border-radius: 10px;
18+
padding: 20px;
19+
box-shadow: 2px 2px 8px #111;
20+
min-height: 35px;
21+
}
22+
23+
.log {
24+
margin: auto;
25+
color: #000;
26+
}
27+
28+
.error {
29+
margin: auto;
30+
color: #ff6666;
31+
}
32+
33+
.hidden {
34+
display: none;
35+
}
36+
37+
.controls {
38+
position: fixed;
39+
top: 0;
40+
right: 0;
41+
margin: 30px;
42+
background: #111;
43+
padding: 3px 8px 3px 8px;
44+
border-radius: 10px;
45+
}
46+
47+
.controls:not(.hidden) {
48+
display: flex;
49+
}
50+
51+
.controls>.item {
52+
padding: 5px;
53+
cursor: pointer;
54+
}
55+
56+
.controls>.item>i {
57+
font-size: 30px;
58+
color: #fff;
59+
}
60+
61+
.controls>.item>i#stop {
62+
color: #ff6666;
63+
}
64+
65+
.controls>.item>i#done {
66+
color: #aacf72;
67+
}
68+
69+
form {
70+
margin: 20px;
71+
}
72+
73+
.content {
74+
text-align: center;
75+
}
76+
77+
.logo {
78+
width: 20vh;
79+
}

content/blaze.js

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
const form = document.querySelector('form');
2+
const error = document.querySelector('.red');
3+
const logs = document.querySelector('.logs');
4+
const controls = document.querySelector('.controls');
5+
6+
form.addEventListener('submit', (e) => {
7+
e.preventDefault();
8+
9+
fetch('/form', {
10+
method: 'POST',
11+
mode: 'cors',
12+
cache: 'no-cache',
13+
credentials: 'same-origin',
14+
headers: {
15+
'Content-Type': 'application/json',
16+
},
17+
redirect: 'follow',
18+
referrerPolicy: 'no-referrer',
19+
body: JSON.stringify({
20+
url: e.srcElement.children.url.value,
21+
}),
22+
})
23+
.then((res) => res.json())
24+
.then((res) => {
25+
if (!res.error) {
26+
if (res.port) {
27+
error.textContent = '';
28+
form.remove();
29+
logs.classList.remove('hidden');
30+
controls.classList.remove('hidden');
31+
32+
var win = window.open(`http://localhost:${res.port}/${e.srcElement.children.filename.value}`, 'popup', `left=${window.screen.width},top=${window.screen.height},width=600,height=700`);
33+
var done = false;
34+
win.focus();
35+
36+
window.onfocus = () => {
37+
document.documentElement.click();
38+
};
39+
40+
window.onbeforeunload = (e) => {
41+
win.close();
42+
};
43+
44+
const close = setInterval(() => {
45+
if (win.closed && !done) {
46+
clearInterval(close);
47+
48+
ws.send(
49+
JSON.stringify({
50+
action: 'stop',
51+
})
52+
);
53+
54+
location.reload();
55+
}
56+
}, 1);
57+
58+
ws.onmessage = (e) => {
59+
const data = JSON.parse(e.data);
60+
61+
if (data.type == 'log' || data.type == 'error') {
62+
const log = document.createElement('div');
63+
log.textContent = data.msg;
64+
log.classList = data.type;
65+
logs.appendChild(log);
66+
67+
window.scrollTo(0, document.body.offsetHeight);
68+
} else if (data.type == 'action') {
69+
if (data.action === 'closed') {
70+
win.close();
71+
72+
logs.classList.add('hidden');
73+
controls.classList.add('hidden');
74+
}
75+
}
76+
};
77+
78+
document.documentElement.addEventListener('click', (e) => {
79+
win.focus();
80+
});
81+
82+
controls.querySelector('#stop').addEventListener('click', (e) => {
83+
ws.send(
84+
JSON.stringify({
85+
action: 'stop',
86+
})
87+
);
88+
89+
location.reload();
90+
});
91+
92+
controls.querySelector('#done').addEventListener('click', (e) => {
93+
done = true;
94+
95+
ws.send(
96+
JSON.stringify({
97+
action: 'done',
98+
})
99+
);
100+
101+
error.textContent = 'Your website has been downloaded, check the /downloads folder inside the blaze server directory';
102+
});
103+
} else {
104+
error.textContent = 'The server did not provide a port';
105+
}
106+
} else {
107+
error.textContent = res.errorMsg;
108+
}
109+
});
110+
111+
const ws = new WebSocket(window.origin.replace('http', 'ws').replace('https', 'wss'));
112+
113+
ws.onerror = (e) => {
114+
error.textContent = 'Failed to connect to server';
115+
};
116+
});

0 commit comments

Comments
 (0)