-
Notifications
You must be signed in to change notification settings - Fork 0
/
content.js
66 lines (66 loc) · 1.85 KB
/
content.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
//Detecting the click of java,nullpointerexception
links = document.getElementsByClassName("post-tag");
for (i = 0; i < links.length; i++)
{
links[i].addEventListener("click", function(e)
{
chrome.runtime.sendMessage({
method: 'POST',
action: 'xhttp',
url: 'http://127.0.0.1:5000/logactions',
data: {content:e.target.href,action:"tag interaction"}
});
});
}
//Detecting the search tab
var inputs = document.getElementsByName('q');
for (i = 0; i < inputs.length; i++)
{
inputs[i].addEventListener('input', function(e)
{
chrome.runtime.sendMessage({
method: 'POST',
action: 'xhttp',
url: 'http://127.0.0.1:5000/logactions',
data: {content:"search tab interaction",action:"search tab interaction"}
});
});
}
//Job Search interaction
var someButton=document.getElementById("nav-jobs");
someButton.addEventListener("click",function(button){
chrome.runtime.sendMessage({
method: 'POST',
action: 'xhttp',
url: 'http://127.0.0.1:5000/logactions',
data: {content:button.target.href,action:"Job search interaction"}
});
})
//Detecting Asking a question interaction
data = document.getElementsByClassName("btn-outlined");
for (i = 0; i < data.length; i++)
{
data[i].addEventListener("click", function(e)
{
chrome.runtime.sendMessage({
method: 'POST',
action: 'xhttp',
url: 'http://127.0.0.1:5000/logactions',
data: {content:e.target.href,action:"Ask question interaction"}
});
});
}
//Detecting question click
questionlinks = document.getElementsByClassName("question-hyperlink");
for (i = 0; i < questionlinks.length; i++)
{
questionlinks[i].addEventListener("click", function(e)
{
chrome.runtime.sendMessage({
method: 'POST',
action: 'xhttp',
url: 'http://127.0.0.1:5000/logactions',
data: {content:e.target.href,action:"view question interaction"}
});
});
}