-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.html
91 lines (79 loc) · 2.29 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="theme-color" content="#000000">
<title>opfs-tools explorer</title>
<style>
body {
min-height: 100vh;
margin: 0;
}
#add-test-file,
#remove-test-file {
width: 280px;
height: 60px;
font-size: 30px;
color: #1976d2;
cursor: pointer;
border: 1px solid #ddd;
border-radius: 10px;
}
#remove-test-file {
color: crimson;
}
#desc {
opacity: 0;
transition: opacity 1s;
}
</style>
<script async src="https://www.googletagmanager.com/gtag/js?id=G-MC335K4KV6"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag() { dataLayer.push(arguments); }
gtag('js', new Date());
gtag('config', 'G-MC335K4KV6');
</script>
</head>
<body>
<div style="text-align: center; margin-top: 20px;">
<button id="add-test-file">Add Test Files</button>
<button id="remove-test-file">Remove Test Files</button>
<p id="desc">then <strong>REFRESH</strong> in explorer</p>
<p>Powered by <a href="https://github.com/hughfenghen/opfs-tools">opfs-tools</a>, <a
href="https://github.com/hughfenghen/opfs-tools-explorer">opfs-tools-explorer</a>
</p>
</div>
<script type="module">
import { write, dir } from 'opfs-tools'
async function initFiles() {
await write('/opfs-tools/dir1/file1', 'file');
await write('/opfs-tools/dir1/file2', 'file');
await write('/opfs-tools/dir2/file1', 'file');
await dir('/.Trash').create();
}
document.getElementById('add-test-file').addEventListener('click', async () => {
await initFiles()
tip()
});
document.getElementById('remove-test-file').addEventListener('click', async () => {
await dir('/opfs-tools/').moveTo(dir('/.Trash'))
tip()
});
const descEl = document.getElementById('desc')
let timer
function tip() {
clearTimeout(timer)
descEl.style.opacity = '1'
timer = setTimeout(() => {
descEl.style.opacity = '0'
}, 2500)
}
</script>
<script type="module">
import { init } from './src/index.tsx'
init({ defaultShow: true })
</script>
</body>
</html>