forked from SanguisFulgur/reflex-smp.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathreflex.js
85 lines (77 loc) · 2.92 KB
/
reflex.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
84
85
var mictwitter = "";
var micyoutube = "";
$.ajax({
dataType: "json",
url: "members.json"
}).done(function (data) {
var output = "";
for ( var i in data ) {
output += "\
<div class='member'>\
<img src='http://minecraft-skin-viewer.com/face.php?u="+ data[i].ign +"&s=400'>\
<span class='name'>"+ i +"</span><br>\
<span>"+ data[i].ign +"</span>\
<span class='info'>"+ data[i].info +"</span>\
<span class='twitter'>"+data[i].twitter+"</span>\
<span class='youtube'>"+data[i].youtube+"</span>\
</div>\
";
}
if ( output == "" ) {
output = "Error whilst loading JSON";
}
$("#members").append(output);
setTimeout(function(){
$(".member").click(function(){
$("#memberinfo").removeClass("hidden");
$("#memberinfo").css("display","block");
$("#memberinfo").css("transition","all 0s");
$("#memberinfo").find("*").css("transition","all 0s");
$("#memberinfo").css("opacity","0");
$("#memberinfo").css("top", $(this).offset().top - $(window).scrollTop() + ( $(this).height() / 2 ) );
$("#memberinfo").css("left", $(this).offset().left - $(window).scrollLeft() + ( $(this).width() / 2 ) );
$("#memberinfo").css("height", $(this).height());
$("#memberinfo").css("width", $(this).width());
$("#memberinfo").find("#name").text( $(this).find(".name").text() );
$("#memberinfo").find("#face").attr("src", $(this).find("img").attr("src") );
$("#memberinfo").find("#info").html( $(this).find(".info").html() );
$("#memberinfo #info").find("*").css("opacity", "0");
//$("#memberinfo").find("img").css("height","0");
if ( $(this).find(".twitter").text() != "" ) {
$("#memberinfo #twlink").css("display","block");
$("#memberinfo #twlink").attr("title","@" + $(this).find(".twitter").text() );
mictwitter = "http://twitter.com/" + $(this).find(".twitter").text();
} else {
$("#memberinfo #twlink").css("display","none");
}
if ( $(this).find(".youtube").text() != "" ) {
$("#memberinfo #ytlink").css("display","block");
$("#memberinfo #ytlink").attr("title", $(this).find(".youtube").text() );
micyoutube = "http://youtube.com/" + $(this).find(".youtube").text();
} else {
$("#memberinfo #ytlink").css("display","none");
}
setTimeout(function(){
$("#memberinfo").css("transition","all 0.5s");
$("#memberinfo").find("*").css("transition","");
$("#memberinfo #info").find("*").css("transition","all 1s");
$("#memberinfo").css("top","");
$("#memberinfo").css("left","");
$("#memberinfo").css("height","");
$("#memberinfo").css("width","");
$("#memberinfo").css("opacity","");
$("#memberinfo #info").find("*").css("opacity", "1");
//$("#memberinfo").find("*").css("height","");
},1);
});
},1);
});
$("#memberinfo #close").click(function(){
$("#memberinfo").addClass("hidden");
});
$("#memberinfo #twlink").click(function(){
window.location = mictwitter;
});
$("#memberinfo #ytlink").click(function(){
window.location = micyoutube;
});