forked from madhavpcm/sac-election
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
99 lines (86 loc) · 2.61 KB
/
app.js
File metadata and controls
99 lines (86 loc) · 2.61 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
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
document.addEventListener("DOMContentLoader", event => {
const app = firebase.app();
});
///////////////////////////////////////////////////////////
const firebaseConfig = {
apiKey: "AIzaSyASGk2VsvJY39KxIEk7aaJKtmyNG_fbpuM",
authDomain: "sac-elections-5852c.firebaseapp.com",
projectId: "sac-elections-5852c",
storageBucket: "sac-elections-5852c.appspot.com",
messagingSenderId: "616925625510",
appId: "1:616925625510:web:40fa57e4fee59877b14867",
measurementId: "G-V62HBHM6CG"
};
firebase.initializeApp(firebaseConfig);
let cloudDB = firebase.firestore();
/////////////////////////////////////////////////////////
function googleLogin() {
const provider = new firebase.auth.GoogleAuthProvider();
firebase.auth().signInWithPopup(provider)
.then(result => {
const user = result.user;
location.href = 'voting.html';
console.log(user)
})
.catch(console.log)
}
var gs = 0;
function voteGS(id) {
if(gs==0) {
gs=1;
}
else{
alert("Already voted"); }
}
function update_fields() {
cloudDB.collection('Voters').doc('cand1').update({votes: '100'})
}
var ss = 0;
function voteSS(id) {
if(ss==0) {
ss=1;
}
else {
alert("Already voted"); }
}
var aas = 0;
function voteAAS(id) {
if(aas==0) {
aas=1;
}
else {
alert("Already voted"); }
}
var js = 0;
function voteJS(id) {
if(js==0) {
js=1;
}
else {
alert("Already voted"); }
}
var ras = 0;
function voteRAS(id) {
if(ras==0) {
ras=1;
}
else {
alert("Already voted"); }
}
//let btngs1 = document.querySelector('#gs1');
//btngs1.addEventListener('click', () => btngs1.style.backgroundColor='#4154f1')
//let btngs2 = document.querySelector('#gs2');
//btngs2.addEventListener('click', () => btngs2.style.backgroundColor='#4154f1')
//let btngs3 = document.querySelector('#gs3');
//btngs3.addEventListener('click', () => btngs3.style.backgroundColor='#4154f1')
//let btnss = document.querySelector('#ss');
//btnss.addEventListener('click', () => btnss.style.backgroundColor='#4154f1')
//
//let btnaas = document.querySelector('#aas');
//btnaas.addEventListener('click', () => btnaas.style.backgroundColor='#4154f1')
//
//let btnfs = document.querySelector('#fs');
//btnfs.addEventListener('click', () => btnfs.style.backgroundColor='#4154f1')
//
//let btnras = document.querySelector('#ras');
//btnras.addEventListener('click', () => btnras.style.backgroundColor='#4154f1')