-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.js
More file actions
38 lines (35 loc) · 1.18 KB
/
main.js
File metadata and controls
38 lines (35 loc) · 1.18 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
const x = document.getElementById("box").offsetWidth;
const y = document.getElementById("box").offsetHeight;
const height = window.innerHeight - y;
const width = window.innerWidth - x;
function getRandomInt(min, max) {
min = Math.ceil(min);
max = Math.floor(max);
return Math.floor(Math.random() * (max - min) + min);
}
function changeBtn() {
let valueHeight = getRandomInt(0, height);
let valueWidth = getRandomInt(0, width);
document.getElementById("box").style.marginTop = valueHeight + "px";
document.getElementById("box").style.marginLeft = valueWidth + "px";
}
function process() {
// Get the current date and time
let currentTime = new Date().toISOString();
// Upsert a row in the 'timeline' table
window.supabase
.from('timeline')
.upsert([
{ sprint: 'acceptedGirlFriend', time: currentTime, updated_at: currentTime}
], { returning: 'minimal' }) // Don't return the inserted row
.then(response => {
if (response.error) {
console.error(response.error.message);
} else {
console.log('Your girlfriend has been accepted, congratulations!');
}
});
setTimeout(() => {
location.href = "/valentine/";
}, 2000);
}