-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaccount.js
More file actions
50 lines (45 loc) · 1.82 KB
/
account.js
File metadata and controls
50 lines (45 loc) · 1.82 KB
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
var accountMenu = false
var colourPopUp = false
function account(){
if(accountMenu){
accountMenu = false
document.getElementById('accountInfo').style.animation = "pop-out .5s forwards"
} else {
accountMenu = true
document.getElementById('accountInfo').style.animation = "pop-in .5s forwards"
}
}
document.addEventListener('mousedown',function(e){
if(accountMenu == true && (e.clientX > 200 || (e.clientX > 50 && e.clientY < 50))){
account()
}
})
async function userColour(){
colour = document.getElementById('accountColourInput').value
var { data, error } = await supabaseClient
.from('users')
.update({colour:colour})
.eq('id',JSON.parse(localStorage.getItem("sb-hxfnilmbkorrzhhnohzp-auth-token"))["user"]["id"])
document.getElementById('username').style.color = colour
}
function showColourPopUp(){
if(correct >= 1000 && !colourPopUp){
document.getElementById('accountColour').hidden = false
colourPopUp = true
} else if(correct < 1000 && !colourPopUp){
document.getElementById('accountColour').innerHTML = `
<img src="close.svg" id="accountColourImage" onclick="showColourPopUp()">
<p>Insufficient correct to change your name colour<br>You must have at least 1000 correct</p>
`
document.getElementById('accountColour').hidden = false
colourPopUp = true
} else {
document.getElementById('accountColour').hidden = true
document.getElementById('accountColour').innerHTML = `
<img src="close.svg" id="accountColourImage" onclick="showColourPopUp()">
<input type="color" name="colour" id="accountColourInput" value="#ffffff">
<button id="accountColourButton" onclick="userColour()">Set Colour</button>
`
colourPopUp = false
}
}