-
Notifications
You must be signed in to change notification settings - Fork 0
/
music.html
181 lines (148 loc) · 6.55 KB
/
music.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" type="text/css" href="./style.css">
<style>
body {
font-family: "Lato", sans-serif;
}
.sidenav {
height: 100%;
width: 0;
position: fixed;
z-index: 1;
top: 0;
left: 0;
background-color: rgb(141, 128, 128);
overflow-x: hidden;
transition: 0.5s;
padding-top: 60px;
}
.sidenav .closebtn {
position: absolute;
top: 0;
right: 25px;
font-size: 36px;
margin-left: 50px;
}
@media screen and (max-height: 450px) {
.sidenav {padding-top: 15px;}
.sidenav a {font-size: 18px;}
}
</style>
<title>Document</title>
</head>
<body>
<div id="mySidenav" class="sidenav">
<a href="javascript:void(0)" class="closebtn" onclick="closeNav()">×</a>
<img onclick = "window.open('settings.html', '_self')" src="settings.jpg" alt="" class = "settings">
<img onclick = "window.open('boards.html', '_self')" src="home.png" alt="" class = "settings">
<br>
Profile:<img onclick = "window.open('profile.html', '_self')" src="prof.jpg" alt="" class = "settings">
</div>
<span style="font-size:30px;cursor:pointer" onclick="openNav()">☰ open</span>
<script>
function openNav() {
document.getElementById("mySidenav").style.width = "250px";
}
function closeNav() {
document.getElementById("mySidenav").style.width = "0";
}
</script>
<h1 class = "tmb">Welcome to the Codeing board braj</h1>
<button onclick = "signOut()">Sign out</button>
<button onclick = "addmessage()" class ="actionbtn">+</button>
<table id = "table">
<th>No moderation; post at your own risk</tr>
</table>
<script>
function addmessage(){
var message =prompt("Please enter your message");
var user = admin.currentUser.uid;
var uzrref = db.collection('users').doc(user);
uzrref.get().then(function(doc) {
if (doc.exists) {
//gives full object of user
console.log("Document data:", doc.data());
//gives specific field
var name=doc.get('firstName');
console.log(name);
var currentdate = new Date();
let s= new Date().toLocaleString();
s=s.split(',')[1].substring(1);
currentdate = currentdate.toISOString().split('T')[0]+s;
currentdate = currentdate.toString();
if(message != null){
db.collection("music").doc().set({
Message : message,
datetime:firebase.currentdate,
author: name,
})
.then(() => {
alert("Message added");
})
.catch((error) => {
console.error("Error writing document: ", error);
});
}
} else {
// doc.data() will be undefined in this case
console.log("No such document!");
}
}).catch(function(error) {
console.log("Error getting document:", error);
});
}
</script>
<script>
function signOut() {
admin.signOut().then(() => {
console.log('user signed out');
window.open('index.html', '_self');
})
}
</script>
<!-- The core Firebase JS SDK is always required and must be listed first -->
<!-- The core Firebase JS SDK is always required and must be listed first -->
<!-- The core Firebase JS SDK is always required and must be listed first -->
<!-- The core Firebase JS SDK is always required and must be listed first -->
<!-- The core Firebase JS SDK is always required and must be listed first -->
<!-- The core Firebase JS SDK is always required and must be listed first -->
<!-- The core Firebase JS SDK is always required and must be listed first -->
<!-- The core Firebase JS SDK is always required and must be listed first -->
<!-- The core Firebase JS SDK is always required and must be listed first -->
<!-- The core Firebase JS SDK is always required and must be listed first -->
<!-- The core Firebase JS SDK is always required and must be listed first -->
<!-- The core Firebase JS SDK is always required and must be listed first -->
<!-- The core Firebase JS SDK is always required and must be listed first -->
<!-- The core Firebase JS SDK is always required and must be listed first -->
<!-- The core Firebase JS SDK is always required and must be listed first -->
<!-- The core Firebase JS SDK is always required and must be listed first -->
<script src="https://www.gstatic.com/firebasejs/8.6.8/firebase-app.js"></script>
<!-- TODO: Add SDKs for Firebase products that you want to use
https://firebase.google.com/docs/web/setup#available-libraries -->
<script src="https://www.gstatic.com/firebasejs/8.6.8/firebase-analytics.js"></script>
<script src="https://www.gstatic.com/firebasejs/8.6.8/firebase-firestore.js"></script>
<script src="https://www.gstatic.com/firebasejs/8.6.8/firebase-auth.js"></script>
<script>
// Your web app's Firebase configuration
// For Firebase JS SDK v7.20.0 and later, measurementId is optional
var firebaseConfig = {
apiKey: "AIzaSyDvGItZ9Pht2Jh9oWHHcIJVnNrJkjA_1Sk",
authDomain: "mobileapphw1.firebaseapp.com",
projectId: "mobileapphw1",
storageBucket: "mobileapphw1.appspot.com",
messagingSenderId: "29599921082",
appId: "1:29599921082:web:d66e1cedef4d1dcb616383",
measurementId: "G-CWNCR6SRP5"
};
firebase.initializeApp(firebaseConfig);
const admin = firebase.auth();
const db = firebase.firestore();
</script>
<script src="music.js"></script>
</body>
</html>