-
Notifications
You must be signed in to change notification settings - Fork 10
/
index.html
268 lines (249 loc) · 10 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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="apple-touch-icon" sizes="192x192" href="./img/icon.png" />
<link rel="icon" type="image/png" href="./img/icon.png" />
<link rel="manifest" href="./manifest.json" />
<title>CDEncrypt</title>
<link rel="stylesheet" type="text/css" href="./lib/pell/pell.css">
<link rel="stylesheet" href="./lib/bulma.min.css">
<link rel="stylesheet" href="./img/icon/fontello.css">
<script src="./lib/msgpack.min.js" defer></script>
<script src="./lib/base64js.min.js" defer></script>
<script src="./lib/anchorme.min.js" defer></script>
<style>
/* https://github.com/jgthms/bulma/issues/2259#issuecomment-516137922 */
.navbar>.container {
align-items: stretch;
display: flex;
min-height: 3.25rem;
width: 100%;
}
.navbar-burger {
display: none;
}
.navbar-menu {
background-color: transparent;
box-shadow: none;
padding: 0;
justify-content: flex-end;
flex-grow: 1;
flex-shrink: 0;
}
.navbar, .navbar-end, .navbar-menu, .navbar-start {
display: flex;
align-items: stretch;
}
.navbar-item {
display: flex;
align-items: center;
}
/* https://stackoverflow.com/questions/50400219/bulma-progress-text-in-middle */
.progress-wrapper {
position: relative;
}
.progress-value {
position: absolute;
top: 0;
left: 50%;
transform: translateX(-50%);
font-size: calc(1rem / 1.5);
line-height: 1rem;
font-weight: bold;
}
.progress.is-small+.progress-value {
font-size: calc(0.75rem / 1.5);
line-height: 0.75rem;
}
.progress.is-medium+.progress-value {
font-size: calc(1.25rem / 1.5);
line-height: 1.25rem;
}
.progress.is-large+.progress-value {
font-size: calc(1.5rem / 1.5);
line-height: 1.5rem;
}
</style>
</head>
<body>Loading...</body>
<script type="module">
import { L } from './src/lang/lang.js'
let index_template = () => `
<nav class="navbar is-light" role="navigation" aria-label="main navigation">
<div class="navbar-brand">
<a href="${location.pathname}" class="navbar-item">
<img src="img/icon.png"> <strong>CDEncrypt</strong> <small>v1.20</small>
</a>
</div>
<div class="navbar-menu">
<div class="navbar-end">
<div class="navbar-item">
<div class="buttons">
<button class="button is-small is-primary" onclick="modal_open('modal_passwd_list')">
<i class="fas fa-key"></i> ${L('Passwords')}
</button>
<div class="dropdown is-right is-hoverable">
<div class="dropdown-trigger">
<button class="button is-small" aria-haspopup="true" aria-controls="dropdown-menu3">
<i class="fas fa-bars"></i>
</button>
</div>
<div class="dropdown-menu" id="dropdown-menu3" role="menu">
<div class="dropdown-content">
<a class="dropdown-item">
<input class="file-input" type="file" id="in_add_file">
<i class="fas fa-upload"></i> ${L('Open File')}
</a>
<a class="dropdown-item" id="in_add_text">
<i class="far fa-comment-alt"></i> ${L('Input Text')}
</a>
<a class="dropdown-item" onclick="location.reload()">
<i class="fas fa-sync"></i> ${L('Reload Page')}
</a>
<a class="dropdown-item is-danger" id="clean_all">
<i class="fas fa-sign-out-alt"></i> ${L('Clean All')}
</a>
<hr class="dropdown-divider">
<a href="https://github.com/dukelec/cde" class="dropdown-item">
<i class="fab fa-github"></i> GitHub
</a>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</nav>
<section class="section">
<div class="container">
<h1 class="title">${L('Plaintext')}</h1>
<p>${L('Use password')}: <span id="in_cur_pw">--</span></p>
</div>
<br>
<div class="container">
<h3 class="title is-size-4">${L('Content')}</h3>
<div class="box" id="in_plaintext"></div>
</div>
<br>
<div class="container">
<h3 class="title is-size-4">${L('Files')}</h3>
<div id="in_files"></div>
</div>
<br>
<div class="container">
<button class="button is-small" id="re_edit">
<i class="fas fa-arrow-down"></i> ${L('Edit')}
</button>
<button class="button is-small" id="preview">
<i class="fas fa-arrow-up"></i> ${L('Preview')}
</button>
</div>
</section>
<section class="section">
<div class="container">
<h1 class="title">${L('Edit')} | ${L('Reply')}</h1>
<div id="editor" class="pell"></div>
<section class="modal-card-body" id="out_files">
</section>
<div class="columns">
<div class="column">
<div class="button is-small">
<input class="file-input" type="file" id="out_add_file" multiple>
<i class="fas fa-upload"></i> ${L('Add File')}
</div>
<button class="button is-small" id="to_local">
<i class="fas fa-file-download"></i> ${L('Save Resources Locally')}
</button>
</div>
</div>
<br><br>
<div class="columns">
<div class="column">
<button class="button is-small" onclick="modal_open('modal_passwd_sel')">
<i class="fas fa-key"></i> ${L('Password')} <span id="out_pw">--</span>
</button>
</div>
<div class="column">
<input class="input" type="text" id="out_fname" placeholder="${L('File name, use date if empty')}">
</div>
</div>
<div class="columns">
<div class="column">
<button class="button is-small" id="share_url">
<i class="fas fa-share-alt"></i> ${L('Share URL')}
</button>
<button class="button is-small" id="show_url">
<i class="far fa-clipboard"></i> ${L('Show URL')}
</button>
</div>
<div class="column">
<button class="button is-small" id="share_file">
<i class="fas fa-share-alt"></i> ${L('Share File')}
</button>
<button class="button is-small" id="download_file">
<i class="fas fa-file-download"></i> ${L('Download File')}
</button>
</div>
</div>
<p id="show_out_url" style="word-wrap: break-word;"></p>
</div>
</section>
<div class="modal" id="modal_passwd_list">
<div class="modal-background" onclick="modal_close('modal_passwd_list')"></div>
<div class="modal-card">
<header class="modal-card-head">
<p class="modal-card-title">${L('Password List')}</p>
<button class="delete" aria-label="close" onclick="modal_close('modal_passwd_list')"></button>
</header>
<section class="modal-card-body" id="passwd_list">
<!--p>#1: xxx <button class="btn btn-sm float-right">Remove</button></p-->
</section>
<footer class="modal-card-foot">
<button class="button is-small is-success" onclick="add_passwd()">${L('Add')}</button>
<button class="button is-small" onclick="modal_close('modal_passwd_list')">${L('Cancel')}</button>
</footer>
</div>
</div>
<div class="modal" id="modal_passwd_sel">
<div class="modal-background" onclick="modal_close('modal_passwd_sel')"></div>
<div class="modal-card">
<header class="modal-card-head">
<p class="modal-card-title">${L('Password Select')}</p>
<button class="delete" aria-label="close" onclick="modal_close('modal_passwd_sel')"></button>
</header>
<section class="modal-card-body" id="passwd_sel">
<!--p>#1: xxx <button class="btn btn-sm float-right">Select</button></p-->
</section>
<footer class="modal-card-foot">
<button class="button is-small is-success" onclick="add_passwd()">${L('Add')}</button>
<button class="button is-small" onclick="modal_close('modal_passwd_sel')">${L('Cancel')}</button>
</footer>
</div>
</div>
<div class="modal" id="modal_fetch">
<div class="modal-background"></div>
<div class="modal-card">
<header class="modal-card-head">
<p class="modal-card-title">${L('Download Progress')}</p>
<button class="delete" aria-label="close" name="fetch_cancel"></button>
</header>
<section class="modal-card-body">
<div class="progress-wrapper">
<progress class="progress is-primary" value="0" max="100" id="fetch_progress"></progress>
<p class="progress-value" id="fetch_progress_text">0%</p>
</div>
<p><span id="fetch_size"></span> <span id="fetch_status"></span></p>
</section>
<footer class="modal-card-foot">
<button class="button is-small is-primary" id="fetch_ok">${L('OK')}</button>
<button class="button is-small" name="fetch_cancel">${L('Cancel')}</button>
</footer>
</div>
</div>`;
document.getElementsByTagName("body")[0].innerHTML = index_template();
</script>
<script type="module" src="./src/app.js"></script>
</html>