This repository was archived by the owner on Jun 15, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathresults.js
More file actions
57 lines (49 loc) · 1.82 KB
/
results.js
File metadata and controls
57 lines (49 loc) · 1.82 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
define(function(require, exports, module) {
"use strict";
main.consumes = [
"commands", "Plugin", "notificationBubble"
];
main.provides = ["harvard.cs50.results"];
return main;
function main(options, imports, register) {
const commands = imports.commands;
const bubble = imports.notificationBubble;
const Plugin = imports.Plugin;
const plugin = new Plugin("CS50", main.consumes);
let loaded = false;
plugin.on("load", () => {
if (loaded)
return false;
loaded = true;
commands.addCommand({
name: "renderresults",
hint: "Render check results",
group: "General",
exec: (args) => {
if (args.length !== 3 || typeof args[1] !== "string" || typeof args[2] !== "string")
return false;
bubble.popup(
[
["span", "Click "],
[
"a",
{
href:`javascript:(() => window.open('', '_blank').document.write('${args[2].replace(/'/g, "\\'")}'))()`,
"style": "display: inline"
},
"here"
],
[
"span",
` to view detailed ${args[1]} results!`
]
]
)
}
}, plugin);
});
plugin.on("unload", () => {});
plugin.freezePublicAPI({});
register(null, { "harvard.cs50.results" : plugin });
}
});