-
Notifications
You must be signed in to change notification settings - Fork 0
/
getShotChanges.js.txt
64 lines (58 loc) · 1.66 KB
/
getShotChanges.js.txt
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
try {
var clq = document.location.href
.toString()
.split("=")[1].split(":")[2]
}
catch (e) {
alert(
"You must be in a started, saved Originator task!");
throw new Error
}
var clq_pattern = new RegExp(
'^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$'
, 'i');
if (!clq || !clq_pattern.test(clq)) {
alert(
"You must be in a started, saved Originator task!");
throw new Error
}
if (!clq_pattern.test(clq)) {
alert("The CLQ is invalid: " + clq +
"\n" +
"Please report me to the developer.");
throw new Error
}
var getJSON = function (url, callback) {
var xhr = new XMLHttpRequest();
xhr.open('GET', url, true);
xhr.responseType = 'json';
xhr.onload = function () {
var status = xhr.status;
if (status === 200) {
callback(null, xhr.response);
}
else {
callback(status, xhr.response);
}
};
xhr.send();
};
if (!localStorage.getItem("shotChanges:" + clq)) {
getJSON("https://originator.backlot.netflix.com/api/request/shotchanges/clq:origination:" +
clq
, function (err, data) {
if (err !== null) {
alert('Something went wrong with error status: ' +
err +
'\nIf it\'s 500-something, please reload the page and try again.'
);
}
else {
localStorage.setItem("shotChanges:" + clq, data["frameNumbers"])
alert("Shot changes for " + clq + " set!");
}
})
}
else {
alert("Shot changes for this task already in cache.");
}