-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathpopup.js
75 lines (68 loc) · 2.52 KB
/
popup.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
67
68
69
70
71
72
73
74
75
var name_text = document.getElementById('name');
var website_link = document.getElementById('website_link');
// website_link.href='javascript:void(0);';
var linkedin_link = document.getElementById('linkedin_link');
// linkedin_link.href='javascript:void(0);';
var medium_link = document.getElementById('medium_link');
// medium_link.href='javascript:void(0);';
var twitter_link = document.getElementById('twitter_link');
// twitter_link.href='javascript:void(0);';
var github_link = document.getElementById('github_link');
// github_link.href='javascript:void(0);';
var whatsapp_link = document.getElementById('whatsapp_link');
// whatsapp_link.href='javascript:void(0);';
var facebook_link = document.getElementById('facebook_link');
// facebook_link.href='javascript:void(0);';
let array = ["name","website","linkedin","medium","twitter","github","whatsapp","facebook"];
function void_click(){
void(0);
}
chrome.storage.sync.get(array,function(links){
if(!chrome.runtime.error){
console.log(links);
if(links.name)
name_text.innerHTML=links.name+"'s ";
if(links.website)
website_link.href=links.website;
else
website_link.addEventListener('click',function(event){
event.preventDefault();
});
if(links.linkedin)
linkedin_link.href=links.linkedin;
else
linkedin_link.addEventListener('click',function(event){
event.preventDefault();
});
if(links.medium)
medium_link.href=links.medium;
else
medium_link.addEventListener('click',function(event){
event.preventDefault();
});
if(links.twitter)
twitter_link.href=links.twitter;
else
twitter_link.addEventListener('click',function(event){
event.preventDefault();
});
if(links.github)
github_link.href=links.github;
else
github_link.addEventListener('click',function(event){
event.preventDefault();
});
if(links.whatsapp)
whatsapp_link.href=links.whatsapp;
else
whatsapp_link.addEventListener('click',function(event){
event.preventDefault();
});
if(links.facebook)
facebook_link.href=links.facebook;
else
facebook_link.addEventListener('click',function(event){
event.preventDefault();
});
}
});