This repository has been archived by the owner on Oct 13, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
executable file
·283 lines (264 loc) · 11.5 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
282
283
<!--
*
* Desinged by [email protected]
*
* Google Material Deisigning
* 본 스킨의 저작권은 [email protected]에게 있습니다. 무단 복제, 배포 및 사용을 금합니다.
*
-->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="mobile-web-app-capable" content="yes">
<meta name="theme-color" content="#FFFFFF">
<title>예매하기</title>
<link rel="stylesheet" href="./css/xml.css">
<link rel="stylesheet" href="./css/layout.css">
<link rel="stylesheet" href="./css/color.css">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
</head>
<body onresize="ScrResize()">
<button id="test" class="Debugger" onclick="onclickBtn()">debug</button>
<div class="page">
<loader></loader>
<!-- Login -->
<div class="form-wrap">
<div class="form">
<div class="form__logo">
</div>
<div class="form__login">
<br>
<input class="js-login-id" type="number" name="id" pattern="[1-30-10-90-40-9]{5}" placeholder="학번" required>
<br>
<br>
<br>
<input class="js-login-name" type="text" name="name" placeholder="이름" required>
<br>
<button onclick="login()">로그인</button>
</div>
</div>
</div>
<!-- Header -->
<header>
<div class="header__title">좌석선택</div>
<ul class="js-part-select part-container">
</ul>
</header>
<!-- Seat Table -->
<content>
<button class="js-save-btn save_seat" onclick="SaveSeat()"><icon>save</icon></button>
<div class="seat_table-wrap">
<div class="caption">Screen</div>
<div class="table">
</div>
</div>
</content>
<!-- Bottom/Side Bar -->
<aside>
<div class="bottom_bar">
<div class="js-selected_seat bottom_bar__selected_seat">선택하신 좌석이 없습니다.</div>
</div>
<ul class="js-part-select part-container">
</ul>
<div class="aside__content">
<div class="js-selected_seat aside__selected_seat">선택하신 좌석이 없습니다.</div>
</div>
</aside>
<!-- Hidden Form -->
<hidden>
<span id="seat" class="js-form-seat"></span>
<span id="part" class="js-form-part"></span>
<span id="id" class="js-form-id"></span>
<span id="name" class="js-form-name"></span>
</hidden>
</div>
<script type="text/javascript" role="login and user detection">
var id = document.querySelector('.js-form-id').innerHTML;
var name = document.querySelector('.js-form-name').innerHTML;
if (id != '' || name != '')
document.querySelector('.form-wrap').style.visibility = 'hidden';
function login () {
var id_login = document.querySelector('.js-login-id').value;
var name_login = document.querySelector('.js-login-name').value;
if (name_login == 'admin' || name_login == '관리자') {
location.assign('./admin?key='+prompt('암호를 대라!'));
return false;
}
// Fail
if (id_login.length != 5 || name_login == '') {
alert('학번과 이름 모두 정확하게 입력해주세요.');
return false;
}
if (name_login.length != 3) {
if (!confirm('정말 이 이름이 확실합니까?\n(제작자: 저희 수능이 얼마 남지 않아 세부적인 부분을 신경쓰지 못하였습니다. 장난 치지 마시고 개인정보는 정확하게 입력해주세요.)')) {
return false;
}
}
grade_num = id_login[0];
class_num = id_login[1]+id_login[2];
number = id_login[3]+id_login[4];
// Success
if(grade_num >= 1 && grade_num <= 3 && class_num >= 1 && class_num <= 14 && number >= 1 && number <= 45) {
if (!confirm(id_login+' '+name_login+' 본인이 맞으십니까?\n(한번 생성된 프로필을 수정이 불가하고, 잘못된 정보 입력시 예매관련 불이익을 받으실 수도 있습니다.)'))
return false;
console.log('attempt to login...');
var xhttp = new XMLHttpRequest();
xhttp.open('GET', './_login.php?id='+id_login+'&name='+name_login, false);
xhttp.send();
if (xhttp.responseText != 'true'){
alert('학번과 이름 모두 정확하게 입력해주세요.');
return false;
}
console.log('attempt to overwrite hidden forms : '+id_login+';'+name_login);
document.querySelector('.js-form-id').innerHTML = id_login;
document.querySelector('.js-form-name').innerHTML = name_login;
document.querySelector('.form-wrap').style.visibility = 'hidden';
}
// Fail
else {
alert('유효한 학번을 입력해주세요');
return false;
}
}
</script>
<script type="text/javascript" role="Seat Selector">
function SelectSeat (selected_seat) {
var seats = document.getElementsByClassName('col');
var seat_panel = document.getElementsByClassName('js-selected_seat');
for (var i = 0; i < seats.length; i++) {
if (seats[i].getAttribute('seat') == selected_seat) {
// 좌석 선택 취소 모드
if (seats[i].classList[1] == 'selected') {
seats[i].classList.remove('selected');
for (var j = 0; j < seat_panel.length; j++) {
seat_panel[j].innerHTML = '선택하신 좌석이 없습니다.';
}
document.querySelector('.js-form-seat').innerHTML = 'cancel';
document.querySelector('.js-save-btn').classList.add('activated');
console.log('cancel sequence on : '+selected_seat);
continue;
}
seats[i].classList.add('selected');
for (var j = 0; j < seat_panel.length; j++) {
seat_panel[j].innerHTML = '선택하신 좌석은 '+selected_seat+'입니다.';
}
// fill hidden Form
document.querySelector('.js-form-seat').innerHTML = selected_seat;
document.querySelector('.js-save-btn').classList.add('activated');
console.log('seat selected : '+selected_seat);
continue;
}
seats[i].classList.remove('selected');
}
}
</script>
<script type="text/javascript" role="[AJAX] Read Table Data and Fill">
class SeatTable {
constructor () {
this.container = document.querySelector('div.table');
this.xhttp = new XMLHttpRequest();
this.xhttp_target = './_table_drawer.php';
this.writeTable = this.writeTable.bind(this);
}
writeTable (n) {
document.querySelector('loader').style.visibility = 'visible';
this.xhttp.open('GET', this.xhttp_target+'?part='+n+'&id='+document.querySelector('.js-form-id').innerHTML, false);
this.xhttp.send();
this.container.innerHTML = this.xhttp.responseText;
document.querySelector('loader').style.visibility = 'hidden';
var saved_seat = document.querySelector('.js-saved-seat').innerHTML;
if (saved_seat != '')
SelectSeat(saved_seat);
}
}
new SeatTable();
</script>
<script type="text/javascript" role="Part Selector">
class PartSelect {
constructor () {
this.container = document.getElementsByClassName('js-part-select');
this.xhttp = new XMLHttpRequest();
this.xhttp_target = './_part_selector.php';
document.querySelector('loader').style.visibility = 'visible';
this.xhttp.open('GET', this.xhttp_target, false);
this.xhttp.send();
for (var i = 0; i < this.container.length; i++) {
this.container[i].innerHTML = this.xhttp.responseText;
}
document.querySelector('loader').style.visibility = 'hidden';
}
}
new PartSelect();
function header_item_select (n) {
var itm = document.getElementsByClassName('part-container__item');
for (var i = 0; i < itm.length; i++) {
itm[i].classList.remove('selected');
}
itm[n - 1].classList.add('selected');
itm[n - 1 + (itm.length)/2].classList.add('selected');
var seat_panel = document.getElementsByClassName('js-selected_seat');
for (var i = 0; i < seat_panel.length; i++) {
seat_panel[i].innerHTML = '선택하신 좌석이 없습니다.';
}
// fill hidden Form
document.querySelector('.js-form-part').innerHTML = n;
document.querySelector('.js-form-seat').innerHTML = '';
document.querySelector('.js-save-btn').classList.remove('activated');
new SeatTable().writeTable(n);
}
</script>
<script type="text/javascript" role="Debugging Tool">
var t = 0;
function onclickBtn() {
if (t % 2 == 0) {
document.querySelector('header').classList.add('wide_screen');
document.querySelector('content').classList.add('wide_screen');
document.querySelector('aside').classList.add('wide_screen');
document.querySelector('.js-save-btn').classList.add('wide_screen');
}
else {
document.querySelector('header').classList.remove('wide_screen');
document.querySelector('content').classList.remove('wide_screen');
document.querySelector('aside').classList.remove('wide_screen');
document.querySelector('.js-save-btn').classList.remove('wide_screen');
}
t++;
}
</script>
<script type="text/javascript" role="Responsible Design">
function ScrResize () {
if (window.innerWidth > 920) {
document.querySelector('header').classList.add('wide_screen');
document.querySelector('content').classList.add('wide_screen');
document.querySelector('aside').classList.add('wide_screen');
document.querySelector('.js-save-btn').classList.add('wide_screen');
}
else {
document.querySelector('header').classList.remove('wide_screen');
document.querySelector('content').classList.remove('wide_screen');
document.querySelector('aside').classList.remove('wide_screen');
document.querySelector('.js-save-btn').classList.remove('wide_screen');
}
}
ScrResize();
</script>
<script type="text/javascript" role="Save Seat">
function SaveSeat () {
if (document.querySelector('.js-save-btn.activated') == undefined) {
return false;
}
var seat = document.querySelector('.js-form-seat').innerHTML;
var part = document.querySelector('.js-form-part').innerHTML;
var id = document.querySelector('.js-form-id').innerHTML;
var name = document.querySelector('.js-form-name').innerHTML;
var xhttp = new XMLHttpRequest();
xhttp.open('GET', './_save.php?id='+id+'&part='+part+'&seat='+seat+'&name='+name, false);
xhttp.send();
alert(xhttp.responseText);
}
</script>
</body>
</html>