This repository has been archived by the owner on Dec 22, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
single-club.html
184 lines (175 loc) · 5.83 KB
/
single-club.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
<html style="overflow-x: hidden;">
<head>
<meta charset="utf-8">
<title>ERROR</title>
<link rel="stylesheet" href="/framework/googlefont/languages.css">
<link rel="stylesheet" href="/framework/sam/single-club.css">
<script src="/framework/js/vue.min.js"></script>
<script src="/framework/js/axios.min.js"></script>
<style>
.post-title {
font-size: 2em;
margin: 20px;
}
.divider {
border: 2px lightgrey solid;
}
</style>
</head>
<body>
<div id="app">
<div id="SITE_HEADER">
<div id="SITE_HEADER_Background"></div>
<div id="SITE_HEADER_Content">
<img id="avatar" src="/framework/sam/SAM_logo.svg"/>
<h1 class="font_0" id="club-title">{{clubname}}</h1>
<h6 class="font_6" id="club-greeting">Welcome.</h6>
</div>
</div>
<div id="banner-coloring"></div>
<div id="new-selector">
<div class="selector-box" onclick="window.location.href='/dashboard.html';">
<div>Dashboard</div>
</div>
<div class="selector-box" onclick="window.location.href='/club.html';">
<div>Club</div>
</div>
<div class="selector-box" onclick="window.location.href='/classes.html';">
<div>Classes</div>
</div>
<div class="selector-box" onclick="window.location.href='/settings.html';">
<div>Settings</div>
</div>
<div class="selector-box" onclick="window.location.href=addPost;">
<div>Add Post</div>
</div>
</div>
<div id="SITE_BACKGROUND"></div>
<div id="SITE_CONTENT" v-if="is_club">
<div style="left: 8px; width: calc(100% - 371px); position: absolute; top: 23px; height: 458px;"
class="s73" id="club-content">
<post v-for="post in posts" :json="post"></post>
</div>
<div style="right: 35px; width: 288px; position: absolute; top: 417px;">
<h5 class="font_5">Members</h5>
</div>
<div style="right: 59px; width: 263px; position: absolute; top: 487px; height: 63px;" class="s78">
<div>
Organizer: {{organizer}}
<hr />
<ol>
<li v-for='member in members'>
{{member}}
<br>
</li>
</ol>
</div>
</div>
<div style="right: 65px; width: 257px; position: absolute; top: 120px;">
<p class="font_8">{{introduction}}</p>
</div>
<div style="right: 64px; width: 257px; position: absolute; top: 48px;">
<h5 class="font_5" id="club-title-about">About {{clubname}}</h5>
</div>
<div style="right: 31px; width: 290px; position: absolute; top: 101px; height: 5px;" class="s25"></div>
<div style="right: 32px; width: 289px; position: absolute; top: 467px; height: 5px;" class="s25"></div>
</div>
<div id="SITE_CONTENT" v-else>
<div class="post-title">{{postname}}</div>
<hr class="divider">
<iframe id='frame_content' style='width: calc(100% - 2em);margin: 1em;' frameborder='0' scrolling='no' :src='"/modules/club/post.html?id=" + pid' scrolling='auto'></iframe>
</div>
</div>
</body>
<script>
function loadSinglePost(post_id){
axios.get('modules/club/loadPost.php', {params:{id:post_id}}).then(function(json){
if (typeof(vm) == "undefined"){
vm = new Vue({
el: "#app",
data: {
is_club: false,
postname: json.data.title,
clubname: json.data.cname,
pid: json.data.id
}
})
} else {
vm.is_club = false;
vm.postname = json.data.title;
vm.clubname = json.data.cname;
vm.pid = json.data.id;
}
document.title = json.data.cname;
addPost = '/club-add.html?id=' + json.data.cid;
}).catch(function(error){
alert("Network Unreachable");
});
}
Vue.component('post', {
props: ['json'],
template: '<div style="position:relative;display:block;flex:1;box-sizing:border-box;margin: 1em;">\
<div class="post-title s12richTextContainer link" :onclick="\'loadSinglePost(\' + json.id + \');\'"><h2 class="font_4" style="line-height:1.2em;">\
{{json.title}}</h2></div>\
<div id="date-author" style="position:relative;flex-direction:row;box-sizing:border-box;">\
<p class="font_9" style="display: inline-flex;">{{json.publish}}</p>\
<p class="font_9" style="display: inline-flex;">|</p>\
<p class="font_9" style="display: inline-flex;">{{json.pname}}</p></div>\
<div style="position:relative;display:block;box-sizing:border-box;height:auto;text-align:left;white-space:normal;overflow:hidden;margin-top:20px;">\
<div class="s12richTextContainer">\
<p class="font_8">\
<iframe style="width: 100%;height: 250px;" frameborder="0" scrolling="no" :src="\'/modules/club/post.html?id=\' + json.id"></iframe></p></div></div>\
<div class="read-more link" :onclick="\'loadSinglePost(\' + json.id + \');\'"> READ MORE</div></div>'
});
function load(id){
axios.get('modules/club/loadClub.php', {params:{id:id}}).then(function(json){
document.title=json.data.name;
vm = new Vue({
el: "#app",
data: {
is_club: true,
clubname: json.data.name,
introduction: json.data.introduction,
members: json.data.members,
organizer: json.data.nameOfOrganizer,
posts: json.data.activities
}
});
}).catch(function(error){
alert("Network Unreachable");
});
}
function request(paras){
var url = location.href;
var paraString = url.substring(url.indexOf("?")+1,url.length).split("&");
var paraObj = {};
for (var i=0, j; j=paraString[i]; i++){
paraObj[j.substring(0,j.indexOf("=")).toLowerCase()] = j.substring(j.indexOf("=")+1,j.length);
}
var returnValue = paraObj[paras.toLowerCase()];
if(typeof(returnValue)=="undefined"){
return "";
}else{
return returnValue;
}
}
var vm;
var id = request("id");
var post = request("post");
var addPost = '';
if(post!==""){
loadSinglePost(post);
}
else{
addPost = '/club-add.html?id=' + id;
load(id);
}
function reinitIframe(){
var iframe = document.getElementById("frame_content");
try{
iframe.height = iframe.contentWindow.document.documentElement.scrollHeight;
}catch (ex){}
}
window.setInterval("reinitIframe()", 200);
</script>
</html>