forked from mdn/webextensions-examples
/
mutablefile.html
69 lines (58 loc) · 2.09 KB
/
mutablefile.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
<!DOCTYPE html>
<html>
<head>
<title>Create and save temporary files</title>
<meta charset="utf-8">
<link rel="stylesheet" type="text/css" href="common-tab.css">
</head>
<body>
<main>
<h1>Create and save temporary files</h1>
<p>Create a temporary file, give it some data and a name, then save it using indexedDB.</p>
<details id="step-01">
<summary>1. Create a MutableFile</summary>
<div>
<div>
<input type="button" id="create-file" value="Create a MutableFile" disabled>
<input type="button" id="get-metadata" value="Get Metadata" disabled>
</div>
</div>
</details>
<details id="step-02">
<summary>2. Append data to the MutableFile</summary>
<div>
<div>
<textarea id="file-data" placeholder="data to save into the file..."
style="width: 100%;" disabled></textarea>
<input type="button" id="save-data" value="Append data" disabled>
</div>
</div>
</details>
<details id="step-03">
<summary>3. Save to IndexedDB</summary>
<div>
<input id="filename-to-save" placeholder="filename to save..." disabled>
<input type="button" id="persist-file" value="Save to IndexedDB key" disabled>
</div>
</details>
<details id="step-04">
<summary>4. Retrieve saved files</summary>
<div>
<input type="button" id="list-saved-files" value="List all the saved files" disabled>
<div>
<input id="filename-to-read" placeholder="filename to read..." disabled>
<input type="button" id="read-file" value="Read saved file" disabled>
</div>
</div>
</details>
</main>
<aside>
<div id="logs-panel">
<pre id="indexed-logs" class="overflow-scroll">Logs from the IndexedDB operations...</pre>
<button id="clear-logs">Clear Logs</button>
</div>
</aside>
<script src="common-log-helpers.js"></script>
<script src="mutablefile.js"></script>
</body>
</html>