This repository was archived by the owner on Nov 15, 2018. It is now read-only.
forked from sidbhargava1/FOW_EXT
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontent.js
More file actions
58 lines (48 loc) · 1.22 KB
/
Copy pathcontent.js
File metadata and controls
58 lines (48 loc) · 1.22 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
var titles = document.getElementsByClassName('jobtitle');
var job_general = {
"Default":"35.0",
"Representative":"65.0",
"Officer":"1.0",
"Analyst":"11.0",
"Coordinator":"49.0",
"Technician":"36.0",
"Planner":"13.0",
"Accountant":"75.0",
"Specialist":"25.0",
"Developer":"40.0",
"Manager":"24.0",
"Agent":"46.0",
"Designer":"25.0",
"Associate":"33.0",
"Administrator":"48.0",
"Specialist":"37.0",
"Clerk":"86.0"
};
// use regex to make more generalizable
for (var i = 0, l = titles.length; i < l; i++) {
var prob = job_general['Default'];
title = titles[i].innerText;
for(job in job_general){
var re = new RegExp(job);
if(re.test(title) == true){
prob = job_general[job];
}
}
var div = document.createElement("div");
sponsor = titles[i].classList.contains("turnstileLink");
div.className += " sjcl";
sibling = titles[i].nextSibling;
if (sponsor == true) {
sibling = titles[i].parentElement.getElementsByClassName('sjcl')[0];
}
titles[i].parentElement.insertBefore(div,sibling);
div.innerText=prob + "% of this job is automatable.";
div.style.fontWeight = 'bold';
var color = 'black'
if (prob <= 30) {
color = 'limegreen'
} else if (prob > 60) {
color = 'red'
}
div.style.color = color
}