-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
216 lines (213 loc) · 10.8 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
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>image compressor</title>
<link rel="icon" href="images/icon/Compress_Jpeg.ico">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"
integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<link href="https://cdn.jsdelivr.net/gh/gitbrent/bootstrap4-toggle@3.6.1/css/bootstrap4-toggle.min.css"
rel="stylesheet">
<link rel="stylesheet" href="scss/style.css">
</head>
<body>
<header>
<h1>JPEG圧縮</h1>
</header>
<main>
<div id="main-content">
<div id="drag-drop-area">
<div class="drag-drop-inside">
<p class="drag-drop-info">ここに画像ファイルをドロップ</p>
<p>または</p>
<p class="drag-drop-buttons"><input id="file-input" type="file" name="image" accept="image/*" multiple></p>
</div>
</div>
<div id="information-entry-area">
<div class="form-group">
<label for="quality">品質:{{ parameters.quality }}</label>
<input oninput="sideContent.executeCompressImage();" type="range" id="quality" class="custom-range" min="0"
max="1" step="0.1" value="0.8">
</div>
<div class="form-group">
<label for="max-width">最大横幅</label>
<input oninput="sideContent.executeCompressImage();" class="form-control" id="max-width" type="number" min="0"
placeholder="Infinity">
</div>
<div class="form-group">
<label for="max-height">最大縦幅</label>
<input oninput="sideContent.executeCompressImage();" class="form-control" id="max-height" type="number"
min="0" placeholder="Infinity">
</div>
<div class="checkbox">
<label><input type="checkbox" id="only-jpeg"> JPEG形式のみ処理を行う</label>
</div>
<div class="checkbox">
<label><input type="checkbox" id="convert-all-to-jpeg"> すべてJPEG形式に変換<sup
style="color: red;">(注意)</sup></label>
</div>
<div id="attention">
<p class="attention">※<strong>JPEG形式以外</strong>は品質による圧縮が出来ません</p>
<p class="attention">※JPEG形式に変換すると透過度が保てません</p>
</div>
</div>
<div id="config">
<!-- Button trigger modal -->
<button id="modal-link-btn" type="button" class="btn btn-link btn-sm" data-toggle="modal"
data-target="#exampleModalCenter" onclick="config.openModal()">
詳細設定
</button>
<!-- Modal -->
<div class="modal fade" id="exampleModalCenter" tabindex="-1" role="dialog"
aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalCenterTitle">詳細設定</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<table class="config-list">
<tr>
<td class="config-text">
ファイル選択時に処理する
</td>
<td class="config-switch">
<input type="checkbox" id="processing-file-input" checked data-toggle="toggle" data-size="sm">
</td>
</tr>
<tr>
<td class="config-text">
ファイルリストを非表示にする
</td>
<td class="config-switch">
<input type="checkbox" id="hide-file-list" data-toggle="toggle" data-size="sm">
</td>
</tr>
<tr>
<td class="config-text">
起動時に設定履歴を呼び出す
</td>
<td class="config-switch">
<input type="checkbox" id="apply-history" checked data-toggle="toggle" data-size="sm">
</td>
</tr>
</table>
</div>
<div class="modal-footer">
<button id="close-modal-btn" type="button" class="btn btn-secondary" data-dismiss="modal">閉じる</button>
<button id="apply-config-btn" type="button" class="btn btn-primary"
onclick="config.applyConfig()">適用</button>
</div>
</div>
</div>
</div>
</div>
<div class="button-area">
<button id="execute-btn" type="button" class="btn btn-info btn-block">再圧縮処理</button>
<button id="download-btn" type="button" class="btn btn-primary btn-block">画像ファイルをダウンロード</button>
</div>
<div id="result" class="result-area">
<p class="result-text" v-if="seen">合計で <span class="result-number">{{ totalSize.renamed }}
({{ differencePercent }}%)</span> 圧縮しました<sup>({{ quantity.finished }} / {{ quantity.total }})</sup></p>
</div>
<div id="file-information" class="file-information-area">
<table class="file-information-table" v-if="seen">
<tbody>
<tr v-for="file in fileList" v-bind:id="'tr_'+file.id">
<td id="file-name" v-bind:title="file.name">{{ file.name }}</td>
<td id="file-size">{{ file.size }}</td>
<td id="compressed-size">{{ file.compressedSize }}</td>
<td class="progress-bar-area">
<div class="progress">
<div v-bind:id="'progress_'+file.id"
class="progress-bar bg-info progress-bar-striped progress-bar-animated" role="progressbar"
aria-valuenow="100" aria-valuemin="0" aria-valuemax="100" style="width: 100%">Processing</div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div id="side-content">
<div class="sample-images-area">
<div class="sample-data-wrapper" id="originai-sample-image-wrapper">
<h3 class="sample-image-label">元画像</h3>
<div class="sample-image-wrapper">
<img class="sample-image" id="original-sample-image" alt="圧縮前のイメージ画像" v-bind:src="imgSrc.original">
</div>
</div>
<div class="sample-data-wrapper" id="compressed-sample-image-wrapper">
<h3 class="sample-image-label">圧縮後画像</h3>
<div class="sample-image-wrapper">
<img class="sample-image" id="compressed-sample-image" alt="圧縮後のイメージ画像" v-bind:src="imgSrc.compressed">
</div>
</div>
</div>
<div class="parameter-adjustment-area">
<div class="btn-group d-flex" role="group" aria-label="シャッフル&ソート開始">
<button v-on:click="preImage" id="pre-image-btn" type="button" class="btn btn-secondary btn-sm">pre</button>
<button disabled id="sample-image-pages" type="button" class="btn btn-secondary btn-sm">{{
dropped.indexToDisplay }} / {{ dropped.length }}</button>
<button v-on:click="nextImage" id="next-image-btn" type="button"
class="btn btn-secondary btn-sm">next</button>
</div>
<div class="form-group">
<label for="display-scale" class="sample-input-label">表示画像の拡大(テスト用):{{ parameters.displayScale }}</label>
<input oninput="sideContent.reflectDisplayScale();" type="range" id="display-scale" class="custom-range"
min="1" max="10" step="0.2" value="1.0">
</div>
<p class="parameters-text">・品質:{{ parameters.quality }}</p>
<p class="parameters-text">・最大横幅:{{ parameters.maxWidth }}</p>
<p class="parameters-text">・最大縦幅:{{ parameters.maxHeight }}</p>
<div id="side-content-attention">
<p class="attention">※上記の画像は,<strong>JPEG形式に変換</strong>されたものです</p>
<p class="attention">※JPEG形式に変換すると透過度が保てません</p>
</div>
<div class="result-of-sample-compression-area" v-if="image.resultSize.seen">
<table class="sample-result-table">
<tr>
<th>元のサイズ</th>
<th>圧縮後のサイズ</th>
<th>圧縮割合</th>
</tr>
<tr>
<td>{{ image.resultSize.originalStr }}</td>
<td id="compressed-sample-size">{{ image.resultSize.compressedStr }}</td>
<td id="sample-compression-ratio">{{ image.resultSize.compressionRatio }}</td>
</tr>
</table>
<p class="result-of-sample-compression">
</p>
</div>
</div>
</div>
<div id="load-image"></div>
</main>
<!-- Bootstrap -->
<script src="https://code.jquery.com/jquery-3.4.1.slim.min.js"
integrity="sha384-J6qa4849blE2+poT4WnyKhv5vZF5SrPo0iEjwBvKU7imGFAV0wwj1yYfoRSJoZ+n"
crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js"
integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo"
crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js"
integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6"
crossorigin="anonymous"></script>
<!-- Bootstrap -->
<script src="https://cdn.jsdelivr.net/gh/gitbrent/bootstrap4-toggle@3.6.1/js/bootstrap4-toggle.min.js"></script>
<script src="https://code.jquery.com/jquery-3.4.1.min.js"></script>
<script src="https://cdn.jsdelivr.net/gh/fengyuanchen/compressorjs/dist/compressor.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.2.2/jszip.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/file-saver@2.0.2/dist/FileSaver.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/vue@2.6.14"></script>
<script src="js/config.js"></script>
<script src="js/vueInstance.js"></script>
<script src="js/compress.js"></script>
<script src="js/button.js"></script>
</body>
</html>