-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathparselink.js
66 lines (50 loc) · 1.99 KB
/
parselink.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
function parselink(){
var stringtoparse = "";
var facebook = document.getElementById("facebook").value;
var instagram =document.getElementById("instagram").value;
var twitter = document.getElementById("twitter").value;
var linkedin = document.getElementById("linkedin").value;
if(!facebook)
facebook="%23f";
if(!instagram)
instagram = "%23f";
if(!twitter)
twitter= "%23f";
if(!linkedin)
linkedin = "%23f";
stringtoparse += facebook + "/" + instagram + "/" + twitter + "/" + linkedin;
document.getElementById("stringtoparse").innerHTML=stringtoparse;
document.getElementById("QRcode").src= "https://api.qrserver.com/v1/create-qr-code/?data=" + stringtoparse + "&size=220x220&margin=0";
}
function login(){
var userfound = false;
var username = document.getElementById("username").value;
var password = document.getElementById("password").value;
var mySM =["","","",""];
var users = ["MusIsmail", "MarcoLy", "HarryLiu", "BoshenCui"];
var passwords = ["QHacks2016", "QHacks2016", "QHacks2016", "111111"];
var socialmedias =[["mustafa.m.ismail.75", "spooksmus_", "Spooksmus", "mismail27"],
["marco.ly.77", "", "TorontoRobFord", "marco-ly-408688100"],
["harryliu.0", "harry_liu_", "nanolift", "harryliu0"],
["boshenboss", "boshencui", "", "boshencui"]];
for(i=0; i<4; i++){
if(username==users[i] && password== passwords[i]){
for(j=0; j<4; j++){
mySM[j]=socialmedias[i][j];
}
userfound = true;
break;
}
}
if(userfound){
document.getElementById("facebook").value = mySM[0];
document.getElementById("instagram").value= mySM[1];
document.getElementById("twitter").value= mySM[2];
document.getElementById("linkedin").value= mySM[3];
parselink();
}
else{
window.alert("Wrong Username/Password");
document.getElementById("QRcode").src= "https://api.qrserver.com/v1/create-qr-code/?data=error&size=220x220&margin=0";
}
}