-
Notifications
You must be signed in to change notification settings - Fork 0
/
list-creating.html
117 lines (110 loc) · 5.49 KB
/
list-creating.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
<html>
<head>
<title>Minecraft Lists: Creating</title>
<link rel="icon" type="image/webp" href="icons/enchant_book.webp" />
<script src="https://www.gstatic.com/firebasejs/8.3.2/firebase-app.js"></script>
<script src="https://www.gstatic.com/firebasejs/8.3.2/firebase-database.js"></script>
<link rel="stylesheet" href="geral.css">
<script>
const firebaseConfig = {
apiKey: "AIzaSyCBzaKNN6rGQTeXZU8Cqn3VIpaj2kVqFjE",
authDomain: "listas-230c4.firebaseapp.com",
databaseURL: "https://listas-230c4-default-rtdb.firebaseio.com",
projectId: "listas-230c4",
storageBucket: "listas-230c4.appspot.com",
messagingSenderId: "813366107524",
appId: "1:813366107524:web:020b11ddd988eb0952d1d1"
};
// Initialize Firebase
firebase.initializeApp(firebaseConfig);
</script>
</head>
<body background="Assets/MINECRAFT_img_background.jpg" style="color: aliceblue; background-size: cover;">
<center>
<br>
<h1 style="font-size: 60px; text-shadow: 5px 5px 5px green;">MINECRAFT LISTS</h1>
<div id="Login"
style="border-style: ridge; border-width: 7px; border-color: green; background-image: url(Assets/Wood\ Background.jpg); width: 700px;">
<br><br>
<div style="display: inline;">
<img src="icons/chest.webp" style="width: 50px; height: 50px;">
<img src="icons/feather.png" style="width: 50px; height: 50px;">
<img src="icons/Dropper.png" style="width: 50px; height: 50px;">
<img src="icons/CraftTable.webp" style="width: 50px; height: 50px;">
<img src="icons/CommandBlock.webp" style="width: 50px; height: 50px;">
<img src="icons/Redstone.webp" style="width: 50px; height: 50px;">
</div>
<hr>
<img src="icons/enchant_book.webp" style="width: 50px; height: 50px; float: left;">
<h2>List Creation - Here all starts</h2>
<input id="list-name" placeholder="List-Name" type="text"
style="background-color: black; border: green 5px ridge; color: aliceblue;">
<input id="list-number" placeholder="00" type="number"
style="background-color: black; border: cadetblue 5px ridge; color: aliceblue;width: 50px;">
<button style="background-color: black; border: purple 5px ridge; color: aliceblue;"
onclick="addList()">Create List</button>
<p id="log-list-output">If theres already a list with the name you choose, try changing the ListNumber</p>
<hr>
<img src="icons/End_Portal.webp" style="width: 50px; height: 50px; float: left;">
<h2>Already have a list?</h2>
<button style="background-color: black; border: cyan 5px ridge; color: aliceblue;" onclick="goback()">Return
to Log-in</button>
<br><br>
</div>
</center>
<p style="position:fixed;bottom:0px;left:10px;">Minecraft Lists by CatMeooww10 - Useful to your lists</p>
<script>
function goback() {
window.location = "index.html";
}
function addList() {
listName = document.getElementById("list-name").value;
listNumber = Number(document.getElementById("list-number").value);
if (!listName == "") {
if (listNumber == 0) {
var listref = firebase.database().ref(listName + "/servermessage");
} else {
var listref = firebase.database().ref(listName + "|" + listNumber + "/servermessage");
}
var isListCreated;
var isJoining = false;
listref.on("value", data => {
isListCreated = data.val();
console.log(isListCreated);
if (!isJoining) {
isJoining = true;
if (isListCreated == null) {
sm = "Started a new list: " + listName
if (listNumber == 0) {
firebase.database().ref(listName).update({
servermessage: sm
});
} else {
firebase.database().ref(listName + "|" + listNumber).update({
servermessage: sm
});
}
if (listNumber == 0) {
localStorage.setItem("list", listName);
} else {
localStorage.setItem("list", listName + "|" + listNumber);
}
localStorage.setItem("list_title", listName);
redirect();
} else {
document.getElementById("log-list-output").innerHTML = "List Already exixts";
}
}
});
} else {
document.getElementById("log-list-output").innerHTML = "List name can not be Empty";
}
}
function redirect() {
setTimeout(() => {
window.location = "list.html";
}, 500)
}
</script>
</body>
</html>