-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
83 lines (69 loc) · 2.63 KB
/
index.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
//Display robot imports
const { initRobotIcon, setRobotShowing } = require("./utils/robotIcon");
//Schoology imports
const assignment = require("./Schoology/assignment.js");
const discussion = require("./Schoology/discussion.js");
//Google Docs imports
const fromSelection = require("./GoogleDocs/fromSelection.js");
//CodeHS imports
const quizHints = require("./CodeHS/quizHints.js");
//Exposed functions import
const askAI = require("./AI/askAI.js");
const encryptString = require("./utils/encryptString.js");
//Scrape import
const getGoogleLinks = require("./WebSearch/getGoogleLinks.js");
const handleScrapingInjects = require("./Scraping/handleScrapingInjects.js");
const webArticleFromQuery = require("./WebSearch/webArticleFromQuery.js");
const requestContent = require("./Scraping/requestContent.js");
window.getGoogleLinks = getGoogleLinks;
window.webArticleFromQuery = webArticleFromQuery;
window.requestContent = requestContent;
handleScrapingInjects();
window.addEventListener("load", () => {
if (encryptString(window.HELPER_PASSWORD) != "100 104 115 111 102 104 111") return;
if (window.top != window) return;
let injected = false;
switch (location.origin) {
case "https://example.com":
window.askAI = askAI;
injected = true;
break;
case "https://docs.google.com":
if (fromSelection()) {
injected = true;
}
break;
case "https://ud.schoology.com":
if (location.pathname.includes("/discussion/")) {
if (discussion()) {
injected = true;
}
} else if (location.pathname.includes("/assignment/")) {
if (assignment()) {
injected = true;
}
}
// console.log(1);
break;
case "https://codehs.com":
if (location.pathname.includes("/assignment/")) {
console.log("trying to inject");
if (quizHints()) {
injected = true;
}
}
default:
break;
}
console.log("inected?", injected);
if (injected) {
initRobotIcon();
setRobotShowing(true);
setTimeout(() => {
setRobotShowing(false);
}, 1000);
};
});
// fetch("https://quizlet.com/webapi/3.2/suggestions/word?clientId=-1692779200083616130&limit=3&localTermId=-1&prefix=Consider%20the%20code%20segment&wordLang=en")
//Add little robot emoji popup in corner of screen when we inject something
//add function to handle "contexts": scrape urls and get youtube transcripts