-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcontent.js
43 lines (39 loc) · 1.42 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
/*
WORKFLOW:
1. User clicks the extension icon to activate the listeners
2. User enters Ctrl-Q, then types in the class name
3. User clicks to a frame, hits tilde to download, continues on until entire pass is done
4. Repeat steps 2-3
*/
var sharedData = {
videoElem: document.querySelector('video'),
framesPerJump: 1,
secondsPerFrame: null,
intervals: [] // a list of objects in the form {startTime: int, endTime: int}
}
chrome.runtime.onMessage.addListener(
function(request, sender, sendResponse) {
if (request.action == "start") {
console.log("start me up");
// enableFrameJumping(sharedData);
enableClassTracking(sharedData, function(responseFromClassChange) {
console.log(responseFromClassChange.intervals);
sharedData.intervals = responseFromClassChange.intervals;
newIntervalClass(sharedData);
});
enableIntervalSelection(sharedData, Colors);
enableDownloadHotkey(sharedData, function() {
if (sharedData.intervals.length > 0)
sharedData.intervals[sharedData.intervals.length - 1].active = false;
});
} else if (request.action == "stop") {
}
}
);
class Interval {
constructor(startTime, endTime, active = false) {
this.startTime = startTime;
this.endTime = endTime;
this.active = active;
}
}