-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathcontent.js
27 lines (23 loc) · 847 Bytes
/
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
function runSearch(){
let questions = document.getElementsByClassName('freebirdFormviewerComponentsQuestionBaseTitle exportItemTitle freebirdCustomFont');
var qs = [];
for (question of questions){
q = question.textContent;
qs.push(q);
NewSearch(q)
}
}
function mark_tick(data){
options = document.getElementsByClassName("docssharedWizToggleLabeledLabelText exportLabel freebirdFormviewerComponentsQuestionRadioLabel")
for (option of options){
if (option.textContent == data){
option.textContent = option.textContent + '✅'
}
}
}
function NewSearch(q) {
let data = fetch('https://<YOUR_API_URL>/?question='+q)
.then(res => res.json())
.then(data => mark_tick(data['answer']))
}
chrome.runtime.onMessage.addListener(runSearch);