index.ejs
2.11 KB
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
<!DOCTYPE html>
<html>
<head>
<title><%= title %></title>
<link rel='stylesheet' href='/stylesheets/style.css' />
<script src="http://developers.kakao.com/sdk/js/kakao.min.js"></script>
</head>
<h1><%= title %></h1>
<p>웹툰 리스트</p>
<a id="kakao-login-btn"></a>
<a id="kakao-logout-btn" href="javascript:logout();">로그아웃</a>
<table>
<%
var current = "";
for(jsonString in list){
var A=JSON.parse(list[jsonString]);
if(current!=A.week){
if(current!=""){
%>
</tr>
<% } %>
<tr>
<th><%= A.week %></th>
<% } %>
<td>
<a href="<%= A.webtoon_link %>">
<img src="<%= A.thum_link %>"/>
</a>
<%= A.name %>
</td>
<%
if(current!=A.week) {
current = A.week;
%>
<%
}
}
%>
</tr>
</table>
</br>
<script type='text/javascript'>
//<![CDATA[
// 사용할 앱의 JavaScript 키를 설정해 주세요.
Kakao.init('602377cd7aa60a82eeebda466560f3e5');
// 카카오 로그인 버튼을 생성합니다.
Kakao.Auth.getStatus(function(statusObj){
if(statusObj.status=='connected'){
location.href="./mytoons";
document.getElementById('kakao-login-btn').setAttribute('style','display: none;');
}else{
document.getElementById('kakao-logout-btn').setAttribute('style','display: none;');
document.getElementById('save_config').setAttribute('style','display: none;');
}
});
Kakao.Auth.createLoginButton({
container: '#kakao-login-btn',
size:'small',
success: function(authObj) {
//alert(JSON.stringify(authObj));
location.reload();
},
fail: function(err) {
alert("로그인 실패!");
}
});
function logout(){
Kakao.Auth.logout(function () {
location.reload();
});
}
//]]>
</script>
</body>
</html>