-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
281 lines (243 loc) · 6.47 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
269
270
271
272
273
274
275
276
277
278
279
280
281
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Gitketch Convertor</title>
<style>
html, body {
height: 100%;
font-family: "Apple SD Gothic Neo";
color: #fff;
font-weight: 400;
line-height: 1;
letter-spacing: -0.03em;
-webkit-font-smoothing: antialiased;
}
* {
padding: 0;
margin: 0;
box-sizing: border-box;
}
button {
line-height: inherit;
color: inherit;
font-size: 14px;
background: none;
outline: none;
font-weight: inherit;
border: 0;
}
a, button {
cursor: pointer;
}
p {
font-size: 14px;
line-height: 19px;
font-weight: inherit;
margin-bottom: 16px;
}
h4 {
font-size: 16px;
line-height: 22px;
font-weight: inherit;
margin-bottom: 16px;
}
/*컴포넌트*/
.round-box,
.round-btn {
line-height: 1;
padding: 8px 18px;
border: 1px solid #fff;
border-radius: 50px;
height: 34px;
}
.round-btn:hover {
background: rgba(255, 255, 255, 0.2);
}
.help-btn {
display: inline-block;
position: absolute;
right: 0;
bottom: 0;
padding-right: 16px;
padding-bottom: 10px;
}
/*공통 스타일*/
.home,
.overlay,
.watcher {
width: 100%;
height: 100%;
display: table;
text-align: center;
transition: 0.3s;
}
.home__container,
.overlay__container,
.watcher__container {
width: 100%;
height: 100%;
display: table-cell;
vertical-align: middle;
}
/*홈*/
.home {
background-image: linear-gradient(-180deg, #61CFF8 0%, #3777EA 100%);
}
.home__container {
filter: blur(0);
}
/*오버레이*/
.overlay--s2f,
.overlay--f2s,
.loading-overlay {
position: fixed;
left: 0;
top: 0;
width: 100%;
height: 100%;
display: table;
opacity: 0;
text-align: center;
transition: 0.4s opacity;
}
.overlay__container {
background: rgba(0,0,0,0.50);
}
@keyframes watcher__loader-sketch {
0% {
transform: scaleX(0.05);
}
50% {
transform: scaleX(1);
}
100% {
transform: scaleX(0.05);
}
}
</style>
</head>
<body>
<div class="home">
<div class="home__container">
<h4>
Drag and drop <br>
.gitketch folder or sketch file.
</h4>
<img src="images/line-image.svg">
</div>
</div>
<div class="loading-overlay" style="display: none">
<div class="overlay__container">
<img width="33" height="33" src="images/spinner.gif">
<p>In progress...</p>
</div>
</div>
<div class="overlay--s2f" style="display: none">
<div class="overlay__container">
<p>
Done
</p>
<button onclick="closeOverlayS2F()" class="round-btn" type="button">확인</button>
</div>
</div>
<div class="overlay--f2s" style="display: none">
<div class="overlay__container">
<p>
Done
</p>
<button onclick="closeOverlayF2S()" class="round-btn" type="button">확인</button>
</div>
</div>
<!--<a class="help-btn" type="button">-->
<!--<img src="images/help-btn.svg">-->
<!--</a>-->
</body>
<script>
var path = require('path');
var zipToSketch = require('./modules/zipToSketch').zipToSketch;
var unzipAndFormat = require('./modules/unzipAndFormat').unzipAndFormat;
var reformatForGit = require('./modules/reformatForGit').reformatForGit;
var mergeReformattedSketch = require('./modules/mergeReformattedSketch').mergeReformattedSketch;
// 돔 변수
var elmHome = document.getElementsByClassName('home')[0];
var elmHomeContainer = document.getElementsByClassName('home__container')[0];
var loadingOverlay = document.getElementsByClassName('loading-overlay')[0];
var elmOverlayS2F = document.getElementsByClassName('overlay--s2f')[0];
var elmOverlayF2S = document.getElementsByClassName('overlay--f2s')[0];
// 그외
var sketchFolderExtensionName = '.gitketch';
// 뷰 처리 메서드
function openOverlayS2F() {
elmOverlayS2F.style.display = 'table';
setTimeout(function () {
elmOverlayS2F.style.opacity = '1';
}, 1);
elmHomeContainer.style.filter = 'blur(4px)';
loadingStop();
}
function closeOverlayS2F() {
elmOverlayS2F.style.opacity = '0';
elmHomeContainer.style.filter = 'blur(0)';
setTimeout(function () {
elmOverlayS2F.style.display = 'none';
}, 300);
}
function openOverlayF2S() {
elmOverlayF2S.style.display = 'table';
setTimeout(function () {
elmOverlayF2S.style.opacity = '1';
}, 1);
elmHomeContainer.style.filter = 'blur(4px)';
loadingStop();
}
function closeOverlayF2S() {
elmOverlayF2S.style.opacity = '0';
elmHomeContainer.style.filter = 'blur(0)';
setTimeout(function () {
elmOverlayF2S.style.display = 'none';
}, 300);
}
function loadingStart() {
loadingOverlay.style.display = 'table';
setTimeout(function () {
loadingOverlay.style.opacity = '1';
}, 1);
elmHomeContainer.style.filter = 'blur(4px)';
}
function loadingStop() {
loadingOverlay.style.opacity = '0';
setTimeout(function () {
loadingOverlay.style.display = 'none';
}, 300);
}
// 이벤트
elmHome.addEventListener('dragover', function (e) {
e.preventDefault();
});
elmHome.addEventListener('drop', function (e) {
e.preventDefault();
var file = e.dataTransfer.files[0];
var fileExtname = path.extname(file.path);
// 스케치파일이면
if(fileExtname == '.sketch'){
loadingStart();
var sketchFolderPath = path.dirname(file.path)+ '/' + path.basename(file.path, '.sketch') + sketchFolderExtensionName;
// 같은경로에 압축풀고 원래 스케치 삭제
// 삭제후 리포맷팅 진행
unzipAndFormat(file.path, sketchFolderPath, function () {
reformatForGit(sketchFolderPath, openOverlayS2F);
});
// 스케치 폴더면
} else if (fileExtname == sketchFolderExtensionName) {
loadingStart();
// 리포맷팅 되어있는 json을 다시 다 합치는 작업진행
mergeReformattedSketch(file.path, function () {
// 같은경로에 스케치파일 만들고 원래 폴더 삭제
var sketchFileName = file.name.split(sketchFolderExtensionName).join('') + '.sketch';
zipToSketch(file.path, path.dirname(file.path) + '/' + sketchFileName, openOverlayF2S);
});
}
});
</script>
</html>