-
Notifications
You must be signed in to change notification settings - Fork 1
/
comment.html
259 lines (238 loc) · 8.13 KB
/
comment.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
<!DOCTYPE html>
<html lang="zxx">
<head>
<title>365 Gallery</title>
<meta charset="UTF-8">
<meta name="description" content="Boto Photo Studio HTML Template">
<meta name="keywords" content="photo, html">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- Stylesheets -->
<link rel="stylesheet" href="css/bootstrap.min.css"/>
<link rel="stylesheet" href="css/font-awesome.min.css"/>
<link rel="stylesheet" href="css/slicknav.min.css"/>
<link rel="stylesheet" href="css/fresco.css"/>
<!-- Main Stylesheets -->
<link rel="stylesheet" href="css/style.css"/>
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<!-- Page Preloder -->
<div id="preloder">
<div class="loader"></div>
</div>
<!-- Header Section -->
<header class="header">
<div class="container-fluid">
<div class="row">
<div class="col-sm-4 col-md-3 order-2 order-sm-1">
</div>
<div class="col-sm-4 col-md-6 order-1 order-md-2 text-center">
<a href="./index.html" class="site-logo">
<img src="img/logo.png" alt="">
</a>
</div>
<div class="col-sm-4 col-md-3 order-3 order-sm-3">
</div>
</div>
<nav class="main__menu">
<ul class="nav__menu">
<li><a href="./index.html" class="menu--active">Home</a></li>
<li><a href="#" onclick="setChildValue(0)">Exhibition</a>
<ul class="sub__menu">
<li><a href="#" onclick="setChildValue(0)">Romanticism</a>
<ul class="sub2__menu">
<li><a href="#" onclick="setChildValue(0)">William Turner</a></li>
</ul></li>
<li><a href="#" onclick="setChildValue(2)">Impressionism</a>
<ul class="sub2__menu">
<!--
<li><a href="#" onclick="setChildValue(1)">Van Gogh</a></li>
-->
<li><a href="#" onclick="setChildValue(2)">Seurat</a></li>
<li><a href="#" onclick="setChildValue(3)">Claude Monet</a></li>
<li><a href="#" onclick="setChildValue(4)">Leonid Afremov</a></li>
<li><a href="#" onclick="setChildValue(5)">Katsushika Hokusai</a></li>
</ul></li>
<li><a href="#" onclick="setChildValue(6)">Fauvism</a>
<ul class="sub2__menu">
<li><a href="#" onclick="setChildValue(6)">Henri Matisse</a></li>
<li><a href="#" onclick="setChildValue(7)">Andre Derain</a></li>
</ul></li>
<li><a href="#" onclick="setChildValue(8)">Cubism</a>
<ul class="sub2__menu">
<li><a href="#" onclick="setChildValue(8)">Pablo Picasso</a></li>
<li><a href="#" onclick="setChildValue(9)">Fernand Leger</a></li>
<li><a href="#" onclick="setChildValue(10)">Francis Picabia</a></li>
</ul></li>
<li><a href="#" onclick="setChildValue(11)">Abstractionism</a>
<ul class="sub2__menu">
<li><a href="#" onclick="setChildValue(11)">Robert Delaunay</a></li>
<li><a href="#" onclick="setChildValue(12)">Pieter Mondrian</a></li>
</ul></li>
<li><a href="#" onclick="setChildValue(13)">Expressionism</a>
<ul class="sub2__menu">
<li><a href="#" onclick="setChildValue(13)">Edvard Munch</a></li>
<li><a href="#" onclick="setChildValue(14)">Gustav Klimt</a></li>
</ul></li>
<li><a href="#" onclick="setChildValue(15)">Futurism</a>
<ul class="sub2__menu">
<li><a href="#" onclick="setChildValue(15)">Umberto Boccioni</a></li>
<li><a href="#" onclick="setChildValue(16)">Giacomo Balla</a></li>
</ul></li>
<li><a href="#" onclick="setChildValue(17)">Surrealism</a>
<ul class="sub2__menu">
<li><a href="#" onclick="setChildValue(17)">Joan Miro</a></li>
<li><a href="#" onclick="setChildValue(18)">Marc Chagall</a></li>
</ul></li>
<li><a href="#" onclick="setChildValue(19)">Pop Art</a>
<ul class="sub2__menu">
<li><a href="#" onclick="setChildValue(19)">Roy Lichtenstein</a></li>
<li><a href="#" onclick="setChildValue(20)">Keith Haring</a></li>
</ul></li>
</ul></li>
<li><a href="./mygallery.html">My Gallery</a></li>
</ul>
</nav>
</div>
</header>
<!-- Header Section end -->
<!-- About Page -->
<section class="about__page">
<div class="comment__page">
<div class="image_section">
<img id="comment_img" src="">
</div>
<div class="button_section" >
<button onclick="location.href='mygallery.html'">갤러리로 이동</button>
</div>
<div class="input_writer">
<textarea id="comment_writer" rows=1 placeholder="작성자"></textarea>
</div>
<div class="input_comment">
<textarea id="new_comment" rows=2 placeholder="Comment를 입력하세요"></textarea>
<button type='button' id="commentBtn" onclick="commentPost();">등록</button>
</div>
<div id="comments" class="view_comment">
<div class="comment-row">
<div class="comment-writer"></div>
<div class="comment-content"></div>
</div>
</div>
</div>
</section>
<!-- About Page end -->
<!-- Search Begin -->
<div class="search-model">
<div class="h-100 d-flex align-items-center justify-content-center">
<div class="search-close-switch">+</div>
<form class="search-model-form">
<input type="text" id="search-input" placeholder="Search here.....">
</form>
</div>
</div>
<!-- Search End -->
<!--====== Javascripts & Jquery ======-->
<script src="js/vendor/jquery-3.2.1.min.js"></script>
<script src="js/jquery.slicknav.min.js"></script>
<script src="js/slick.min.js"></script>
<script src="js/fresco.min.js"></script>
<script src="js/main.js"></script>
<!-- Script: Gallery script-->
<script>
// comment: data load
function dataLoad(){
$.getJSON("http://34.64.152.92:8000/api/v1/gallery/", function(result) {
var i = 0;
while (result.data[i]){
if (result.data[i].pk == getPK()){
document.getElementById("comment_img").src = result.data[i].file;
if (result.data[i].tag != null){
$('.image_section').append('<p>#'+ result.data[i].tag.name + '</p>');
}
else {
$('.image_section').append('<p>#Upload by User</p>');
}
if (result.data[i].comments[0]){
var j = 0;
while (result.data[i].comments[j]){
var writer = result.data[i].comments[j].comment.writer;
var text = result.data[i].comments[j].comment.text;
loadComment(writer, text);
j++;
}
}
else {
$('.view_comment').append('<p>등록된 Comment가 없습니다</p>');
}
break;
}
i++;
}
});
}
// comment: load comment
function loadComment(writer, comment) {
var writer_div = document.createElement('div');
writer_div.classList.add('comment-writer');
writer_div.innerText = writer;
var content_div = document.createElement('div');
content_div.classList.add('comment-content');
content_div.innerText = comment;
var comment_div = document.createElement('div');
comment_div.classList.add('comment-row');
comment_div.appendChild(writer_div);
comment_div.appendChild(content_div);
document.getElementById('comments').appendChild(comment_div);
}
// comment: post comment by ajax
function commentPost() {
var writer = $('#comment_writer').val();
var content = $('#new_comment').val();
if (writer == ''){
writer = '익명';
}
if (content == ''){
alert('Comment를 입력하세요');
}
else {
var data = new FormData();
data.append('writer', writer);
data.append('text', content);
data.append('photo_pk', getPK());
var serverURL = "http://34.64.152.92:8000/api/v1/comment/";
$.ajax({
type: "POST",
url: serverURL,
data: data,
dataType: 'json',
processData: false,
contentType: false,
cache: false,
timeout: 10000,
success: function() {
location.reload();
},
error: function() {
alert('Upload failed');
}
});
}
}
// comment: exhibition menu parameter
function setChildValue(index) {
window.location.href = "exhibition_pic.html?index=" + index;
}
// comment: get pk num
function getPK(){
var pk = location.href.substr(location.href.lastIndexOf('=') + 1);
return pk;
}
$(document).ready(function() {
dataLoad();
})
</script>
</body>
</html>