-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprojectDetails.js
48 lines (34 loc) · 1.23 KB
/
projectDetails.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
$(function() {
var firebaseDb = firebase.database();
$.urlParam = function(name){
var results = new RegExp('[\?&]' + name + '=([^&#]*)').exec(window.location.href);
return results[1] || 0;
}
var projectId=$.urlParam('projectId');
var projectsRef = firebaseDb.ref('/projects/'+projectId);
var type;
projectsRef.once('value').then(function(snapshot) {
$('#name').text(snapshot.val().name);
$('#git').html('<h1><a style="margin-bottom" id="github" href="'+snapshot.val().github+'" target="_blank"><i class="fa fa-github w3-xxxlarge w3-text-white w3-hover-opacity w3-margin-right"></i></a></h1>')
$('#desc').text(snapshot.val().desc);
type=snapshot.val().type;
var imgUrl=snapshot.val().logo
if(imgUrl!=undefined){
$('#logo').attr("src", imgUrl);
$('#logo').show();
}
var snapRef = firebaseDb.ref('/projects/'+projectId+'/snaps');
snapRef.on('child_added', function(data) {
if(type=="mob")
{
$('#web').append('<img src="'+data.val()+'" style="width: 275px; padding:10px;">')
$('#web').css( { marginLeft : "175px" } )
}
else
{
$('#web').append('<img src="'+data.val()+'" style="width: 100%; padding:10px;">')
}
$('#mob').append('<img src="'+data.val()+'" style="width: 100%; padding:10px;">')
});
});
});