-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.php
executable file
·281 lines (257 loc) · 8.21 KB
/
index.php
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
<?php
include 'header.php';
?>
<div id="imagemodal">
<span class="close_imagemodal">x</span>
<div class="modal-content" id="imagepreview"></div>
</div>
<div class="header">
<div class="header_top">
<div class="main_logo"></div>
<div class="banner"></div>
</div>
<nav class="navbar">
<ul>
<a href="index.php"><li class="active">Home</li></a>
<a href="about.php"><li>About Us</li></a>
<a href="people.php"><li>Members</li></a>
<a href="activities.php"><li>Activities</li></a>
<a href="loopback.php"><li>Loopback</li></a>
<a href="gallery.php"><li>Gallery</li></a>
<a href="contact.php"><li>Contact Us</li></a>
</ul>
</nav>
</div>
<div class=" image_slider " >
<div class="flexslider" id="main_flexslider" >
<ul class="slides" id="fireslides">
<li>
<div style="background-image: url(img/rm.png);"></div>
</li>
</ul>
</div>
<div class="slider_scoop"></div>
</div>
<div class="main_content">
<div class="left">
<div class="left_right_header">Upcoming Events</div>
<div class="left_slider">
<ul class="slides" >
<li id="upcoming_dynamic">
</li>
</ul>
</div>
</div>
<div class="middle">
<div class="middle_slider">
<div class="flexslider" id="middle_flexslider">
<ul class="slides" >
<li>
</li>
</ul>
</div>
</div>
</div>
<div class="right">
</div>
</div>
<?php
include 'footer.php'
?>
</body>
<script>
var el = document.getElementById('site_credits');
el.onclick = showcredits;
function showcredits() {
$("#slide_up").removeClass("fadeout").addClass("fadein");
return false;
}
var elc = document.getElementById('close_slide');
elc.onclick = closecredits;
function closecredits() {
$("#slide_up").removeClass("fadein").addClass("fadeout");
return false;
}
$(window).load(function() {
setTimeout(function() {
waiting();
}, 15000);
$('.picbox').on('click', function() {
//console.log("hello checking");
$('#imagepreview').css("background-image", "url("+ $(this).attr('src') +")");
$('#imagemodal').css("display","block");
});
$('.close_imagemodal').on('click', function() {
$('#imagemodal').css("display","none");
});
$(document).on('click','.picbox',function(e){
$('#imagepreview').css("background-image", "url("+ $(e.target).attr('src') +")");
$('#imagemodal').css("display","block");
});
$('#main_flexslider').flexslider({
animation: "slide",
slideshowSpeed: 10000
});
$('#middle_flexslider').flexslider({
animation: "slide",
animationLoop: true,
minItems: 2,
maxItems: 2,
itemWidth: 200,
itemMargin: 10,
});
$('#right_flexslider').flexslider({
animation: "slide",
animationLoop: true,
minItems: 1,
maxItems: 1,
itemMargin: 10,
itemWidth: 300,
});
});
function waiting(){
$('#main_flexslider').data('flexslider').removeSlide(0);
}
function compare_ind_dates(a,b){
if(Number(a.year)>Number(b.year))
return -1;
else if(Number(a.year)<Number(b.year))
return 1;
else{
if(Number(a.month)>Number(b.month))
return -1;
else if(Number(a.month)<Number(b.month))
return 1;
else{
if(Number(a.day)>Number(b.day))
return -1;
else {
return 1;
}
}
}
}
function comparedates(a,b){
if(Number(a.date.year)>Number(b.date.year))
return -1;
else if(Number(a.date.year)<Number(b.date.year))
return 1;
else{
if(Number(a.date.month)>Number(b.date.month))
return -1;
else if(Number(a.date.month)<Number(b.date.month))
return 1;
else{
if(Number(a.date.day)>Number(b.date.day))
return -1;
else {
return 1;
}
}
}
}
var slides=myFireBase.child('home').child("slider");
slides.once("value").then(function(snapshot){
var slidesval=snapshot.val();
for(var iter in slidesval){
(function(cntr){
var urljson=slidesval[cntr];
storageRef.child(urljson).getDownloadURL().then(function(url) {
var xhr = new XMLHttpRequest();
xhr.responseType = 'blob';
xhr.onload = function(event) {
var blob = xhr.response;
};
xhr.open('GET', url);
xhr.send();
var imgurl=url;
div = '<li><div style="background-image: url('+imgurl+');"></div></li>';
$('#main_flexslider').data('flexslider').addSlide($(div));
}).catch(function(error) {
console.log("image not loaded");
div = '<li><div style="background-image: url(failed.png);"></div></li>';
$('#main_flexslider').data('flexslider').addSlide($(div));
});
})(iter);
}
});
var middle=myFireBase.child('home').child("center_pane");
middle.once("value").then(function(snapshot){
var middleval=snapshot.val();
$(".middle").prepend(middleval);
});
var right=myFireBase.child('home').child("right_pane");
right.once("value").then(function(snapshot){
var rightval=snapshot.val();
$(".right").append(rightval);
});
var notice=myFireBase.child("notice_box");
notice.once("value").then(function(snapshot){
var noticeval=snapshot.val();
$(".right").prepend(noticeval);
});
var actdb=myFireBase.child("activities");
actdb.orderByKey().limitToLast(1).on("child_added",function(snapshot){
var actval=snapshot.val();
// var noofyears=Object.keys(actval).length;
var obj;
var year=snapshot.key;
obj = Object.values(actval);
obj.sort(comparedates);
for(var iter in obj){
(function(cntr){
var imgd=obj[iter].img;
var short=obj[iter].short_desc;
var title=obj[iter].title;
if(cntr<6){
storageRef.child(imgd).getDownloadURL().then(function(url) {
var xhr = new XMLHttpRequest();
xhr.responseType = 'blob';
xhr.onload = function(event) {
var blob = xhr.response;
};
xhr.open('GET', url);
xhr.send();
var imgurl=url;
var div='<li><img class="picbox" src="'+imgurl+'" /><p class="flex-caption"><span style="font-weight:bold;font-size:18px;padding-bottom:3px;">'+title+'</span><br><span style="font-weight:300"> '+short+'</span></p></li>'
$('#middle_flexslider').data('flexslider').addSlide($(div));
}).catch(function(error) {
console.log("image not fetched");
div = '<li><div class="picbox" style="background-image: url(failed.png);"></div></li>';
$('#middle_flexslider').data('flexslider').addSlide($(div));
});
}
})(iter);
}
});
var updb=myFireBase.child("home").child('upcoming');
updb.orderByKey().limitToLast(1).on("child_added",function(snapshot){
var upval=snapshot.val();
// var noofyears=Object.keys(actval).length;
var obj;
var year=snapshot.key;
obj = Object.values(upval);
obj.sort(comparedates);
for(var iter in obj){
(function(cntr){
var date=obj[iter].date;
var short=obj[iter].short_desc;
//console.log("date");
//console.log(date);
var title=obj[iter].title;
var monthnames = ["Jan", "Feb", "Mar", "Apr", "May", "Jun","Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
var pdate=new Date();
//console.log("date "+pdate.getDate());
var curdate={
day: pdate.getDate(),
month:pdate.getMonth()+1,
year:pdate.getFullYear()
};
if(compare_ind_dates(date,curdate)==-1&&cntr<5){
$('#upcoming_dynamic').prepend('<div class="event_holder"><div class="date">'+date.day+' '+monthnames[Number(date.month)-1]+'</div><div class="event_side_header"><h4 style="margin-top:10px;margin-bottom:5px;">'+title+'</h4>'+short+'</div></div>');
}
})(iter);
}
});
</script>
</html>