forked from garimasingh128/profext
-
Notifications
You must be signed in to change notification settings - Fork 0
/
edit.js
68 lines (64 loc) Β· 2.38 KB
/
edit.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
var name_text = document.getElementById('name');
var website_link = document.getElementById('website');
var linkedin_link = document.getElementById('linkedin');
var medium_link = document.getElementById('medium');
var twitter_link = document.getElementById('twitter');
var github_link = document.getElementById('github');
var quora_link = document.getElementById('quora');
var gitlab_link = document.getElementById('gitlab');
var stackoverflow_link = document.getElementById('stackoverflow');
var facebook_link = document.getElementById('facebook');
var instagram_link = document.getElementById('instagram');
var save_button = document.getElementById('save');
var array = ["name","website","linkedin","medium","twitter","github", "quora", "stackoverflow", "gitlab", "facebook", "instagram"];
chrome.storage.sync.get(array,function(links){
if(!chrome.runtime.error){
console.log(links);
if(links.name)
name_text.value=links.name+" ";
if(links.website)
website_link.value=links.website;
if(links.linkedin)
linkedin_link.value=links.linkedin;
if(links.medium)
medium_link.value=links.medium;
if(links.twitter)
twitter_link.value=links.twitter;
if(links.github)
github_link.value=links.github;
if(links.quora)
quora_link.value=links.quora;
if(links.gitlab)
gitlab_link.value=links.gitlab;
if(links.stackoverflow)
stackoverflow_link.value=links.stackoverflow;
if(links.facebook)
facebook.value=links.facebook;
if(links.instagram)
instagram.value=links.instagram;
}
});
save_button.addEventListener('click',function(){
UpdateLinks();
});
function UpdateLinks(){
var dict = {
"name":name_text.value,
"website":website_link.value,
"linkedin":linkedin_link.value,
"medium":medium_link.value,
"twitter":twitter_link.value,
"github":github_link.value,
"stackoverflow":stackoverflow_link.value,
"quora":quora_link.value,
"gitlab":gitlab_link.value,
"facebook":facebook_link.value,
"instagram":instagram_link.value,
};
chrome.storage.sync.set(dict,function(){
if(!chrome.runtime.error){
console.log("Links Updated");
window.location.pathname='popup.html';
}
});
}