-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbackground.js
161 lines (155 loc) · 4.64 KB
/
background.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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
chrome.runtime.onInstalled.addListener(function() {
const defaultProfile = {
"First Name": {
value: "Bill",
autofill: "given-name"
},
"Last Name": {
value: "Gates",
autofill: "family-name"
},
"Full Name": {
value: "Bill Gates",
autofill: "custom-name"
},
Email: {
value: "[email protected]",
autofill: "email"
},
Phone: {
value: "555-555-5555",
autofill: "tel"
},
Location: {
value: "Seattle, Washington, United States",
autofill: "location"
},
Zip: {
value: "11581",
autofill: "postal-code"
},
LinkedIn: {
value: "https://www.linkedin.com/in/williamhgates/",
autofill: "custom-question-linkedin-profile"
},
Website: {
value: "https://www.gatesnotes.com/",
autofill: "custom-question-website"
},
Facebook: {
value: "https://www.facebook.com/BillGates/",
autofill: "custom-question-facebook-profile"
},
Instagram: {
value: "https://www.instagram.com/thisisbillgates/",
autofill: "custom-question-instagram-profile"
},
Twitter: {
value: "@BillGates",
autofill: "custom-question-twitter-username"
},
Youtube: {
value: "https://www.youtube.com/channel/UCnEiGCE13SUI7ZvojTAVBKw",
autofill: "custom-question-youtube-channel"
},
"Education School Name": {
value: "Harvard University",
autofill: "custom-education-school-name"
},
"Education Degree": {
value: "Mathematics",
autofill: "custom-education-degree"
},
"Education Start Month": {
value: "11",
autofill: "custom-education-startdate-month"
},
"Education Start Year": {
value: "1976",
autofill: "custom-education-startdate-year"
},
"Education End Month": {
value: "05",
autofill: "custom-education-enddate-month"
},
"Education End Year": {
value: "1980",
autofill: "custom-education-enddate-year"
},
"How did you hear about this job?": {
value: "Through rigious job hunting.",
autofill: "custom-question-how-did-you-hear-about-this-job"
},
"Certification 1": {
value: "Microsoft Certified: Azure Administrator Associate",
autofill: "custom-certification-1"
},
"Certification 2": {
value: "Microsoft 365 Certified: Enterprise Administrator Expert",
autofill: "custom-certification-2"
},
"What email program do you use?": {
value: "Microsoft Outlook",
autofill: "custom-email-program"
},
"What instant messaging do you use?": {
value: "WhatsApp",
autofill: "custom-instant-messenger"
},
"What browser do you use?": {
value: "Chrome Version 80",
autofill: "custom-browser"
}
};
const supportedSites = {
"boards.greenhouse.io": {
location: "input[name='job_application[location]']",
"custom-education-startdate-month": "input[name='job_application[educations][][start_date][month]']",
"custom-education-startdate-year": "input[name='job_application[educations][][start_date][year]']",
"custom-education-enddate-month": "input[name='job_application[educations][][end_date][month]']",
"custom-education-enddate-year": "input[name='job_application[educations][][end_date][year]']",
"input[name='job_application[educations][][school_name_id]']": "custom-education-school-name"
},
"www.liveworld.com": {
"given-name": "#first_name",
"family-name": "#last_name",
email: "#email_address",
tel: "#phone",
"custom-question-facebook-profile": "[name='facebook']",
"custom-question-instagram-profile": "[name='instagram']",
"custom-question-instagram-profile": "[name='twitter']",
"custom-education-degree": "[name='education_diploma_obtained']",
"custom-certification-1": "[name='certification_1",
"custom-certification-2": "[name='certification_2",
"custom-email-program": "#skillset_email_program_used",
"custom-instant-messenger": "#skillset_IM_used",
"custom-browser": "#skillset_browser_used",
"custom-education-school-name": "input[name='education_school_attended']"
}
};
console.log("Background script has been installed successfully.");
chrome.storage.sync.clear();
chrome.storage.sync.set({ formData: { defaultProfile }, supportedSites }, () => {
console.log("Form has been saved to storage");
});
chrome.runtime.onMessage.addListener((request, sender, sendResponse) => {
// Gets the keys to the data stored by the extension
if (request.message === "execAutofill") {
chrome.tabs.executeScript({
file: "contentScript.js"
});
sendResponse({ farewell: "goodbye!" });
}
});
renderContextMenus();
});
const renderContextMenus = () => {
chrome.contextMenus.create({
title: "Stronghire",
id: "Stronghire",
contexts: ["editable"]
});
chrome.contextMenus.onClicked.addListener(() => {
console.log("The context menu has been pressed!");
});
};