-
Notifications
You must be signed in to change notification settings - Fork 0
/
club.js
83 lines (77 loc) · 2.5 KB
/
club.js
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
var registerAboutUs = function() {
};
var registerClubEvents = function() {
$("input.rsvpBut").click(function() {
var index = $(this).data("index");
$.ajax({
url: "./scripts/event_handler.php",
type: "GET",
data: "action=rsvpEvent&eventId=" + index,
});
});
};
var registerClubFeed = function() {
};
$(document).ready(function() {
$(".nav a").click(function() {
if($(this).hasClass("login_nav_bar")) {return;}
radioify();
$(this).children().first().addClass("active");
});
$(".login_menu_hoverable li:first").click(function() { //My Clubs Button
$(".login_menu_hoverable").hide();
window.location = "index.php?action=myclubs"; //Redirect to index
});
$(".nav ul a:eq(1)").click(function() { //About Us
$.ajax({
url: "./club_aboutus.php",
type: "GET",
data: "clubId=" + clubId,
}).done(function(html) {
$(".content").html(html);
registerAboutUs();
});
});
$(".nav ul a:eq(2)").click(function() { //Club Events
$.ajax({
url: "./club_events.php",
type: "GET",
data: "clubId=" + clubId,
}).done(function(html) {
$(".content").html(html);
registerClubEvents();
});
});
$(".nav ul a:eq(3)").click(function() { //Club Feed
$.ajax({
url: "./club_feed.php",
type: "GET",
data: "clubId=" + clubId,
}).done(function(html) {
$(".content").html(html);
registerClubFeed();
});
});
$("#club_join_button").click(function() {
var value = $(this).children("li").first().html();
if(value.trim() === "Join Club") { //Join the club
$.ajax({
url: "./scripts/club_query.php",
type: "GET",
data: "action=joinClub&value=" + clubId,
}).done(function() {
window.location = "club.php?clubId=" + clubId;
});
} else if(value.trim() == "Leave Club"){ //Leave the Club
$.ajax({
url: "./scripts/club_query.php",
type: "GET",
data: "action=leaveClub&value=" + clubId,
}).done(function() {
window.location = "club.php?clubId=" + clubId;
});
} else { //Edit the Club
window.location = "club_edit.php?clubId=" + clubId;
}
});
});