-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.js
79 lines (72 loc) · 3.16 KB
/
main.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
window.onload = () =>{
//The Imp-ortant Part
setInterval(()=>{
document.querySelector("a").target = "_blank"
},100)
function postMessageToWeb(e){
firebase.database().ref("posts/").push({
text : marked(e.toString()).toString(),
vote : 0,
poster : localStorage.getItem("gunzipserveruserName") || "Anonymous"
})
}
function PostMessage(){
value = document.getElementById("postText").value.toString()
postMessageToWeb(value)
}
var ref = firebase.database().ref("posts/");
ref.on("value", function(snapshot) {
document.getElementById("userPosts").innerHTML = ""
snapshot.forEach((it,id)=>{
document.getElementById("userPosts").innerHTML += `<div style="height:8%;width:100%;position:relative;overflow:hidden;" class="card green"><label class='white'>Posted by :::::`+it.val().poster.toString()+`:</label>`+ marked(it.val().text.toString()) + `</div><hr>`;
})
})
document.getElementById("projectAdvancedSection").style.display = "block";
document.getElementById("projectContainer").style.display = "none";
document.getElementById("postsContainer").style.display = "none"
document.querySelector("#projectmenu").onclick=(e)=>{
e.preventDefault()
document.getElementById("postsContainer").style.display = "none"
document.getElementById("projectAdvancedSection").style.display = "none"
document.getElementById("projectContainer").style.display = "block"
}
document.querySelector("#mainmenu").onclick=(e)=>{
e.preventDefault()
document.getElementById("postsContainer").style.display = "none"
document.getElementById("projectAdvancedSection").style.display = "block"
document.getElementById("projectContainer").style.display = "none"
}
document.querySelector("#posts").onclick = (e)=>{
e.preventDefault()
document.getElementById("postsContainer").style.display = "block"
document.getElementById("projectAdvancedSection").style.display = "none"
document.getElementById("projectContainer").style.display = "none"
}
document.querySelector(".projectmenu").onclick=(e)=>{
e.preventDefault()
document.getElementById("postsContainer").style.display = "none"
document.getElementById("projectAdvancedSection").style.display = "none"
document.getElementById("projectContainer").style.display = "block"
}
document.querySelector(".mainmenu").onclick=(e)=>{
e.preventDefault()
document.getElementById("postsContainer").style.display = "none"
document.getElementById("projectAdvancedSection").style.display = "block"
document.getElementById("projectContainer").style.display = "none"
}
document.querySelector(".posts").onclick = (e)=>{
e.preventDefault()
document.getElementById("postsContainer").style.display = "block"
document.getElementById("projectAdvancedSection").style.display = "none"
document.getElementById("projectContainer").style.display = "none"
}
document.getElementById("uploadPostOfUser").onclick = ()=>{
confirmpost = confirm("Are you Sure You want to upload the post [You Cant delete the Community posts]")
if(confirmpost){
done = prompt("Type 'hot dogs'","hot").toLocaleLowerCase()
if(done == "hot dogs"){
PostMessage()
}
}
}
}