-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
55 lines (49 loc) · 1.74 KB
/
index.html
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
49
50
51
52
53
54
55
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
</head>
<body>
<div class="content">
<p>
Lorem ipsum dolor sit amet consectetur adipisicing elit. Consectetur
aliquam, dolore quisquam sunt minus totam eaque aut odio voluptatem.
Corporis nemo culpa illum laboriosam aut repellendus sint assumenda
reprehenderit doloribus.
</p>
<button id="toogle">toogle</button>
<button id="enter">enter</button>
<button id="exit">exit</button>
<input id="file" type="file">
</div>
<script type="module">
import FullScreen from "./index.js";
import compressImage from '../compressImage/compressImage.js'
document.querySelector('#file').addEventListener('change', async (e) => {
const file = e.target.files[0]
const blob = await compressImage(file,1080,1080,2,0.92)
console.log(blob,'blob')
console.log('size',blob.size / 1024 / 1024)
const img = document.createElement('img')
img.src = URL.createObjectURL(blob)
document.body.appendChild(img)
})
const content = document.querySelector(".content");
const toogle = document.querySelector("#toogle");
const enter = document.querySelector("#enter");
const exit = document.querySelector("#exit");
const fullScreen = new FullScreen(content);
toogle.addEventListener("click", () => {
fullScreen.toogle();
});
enter.addEventListener("click", () => {
fullScreen.enter();
});
exit.addEventListener("click", () => {
fullScreen.exit();
});
</script>
</body>
</html>