-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcustom.js
85 lines (71 loc) · 2.5 KB
/
custom.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
84
85
/*
//dither
const checkbox = document.getElementById("creativeModeCheckbox");
const scriptEditor = document.getElementById("scriptEditor");
const editableScript = document.getElementById("editableScript");
const ogScript = document.getElementById("ogScript");
scriptEditor.value = editableScript.textContent;
checkbox.addEventListener("change", function () {
if (this.checked) {
editableScript.type = "text/javascript";
ogScript.type = "application/json";
scriptEditor.style.display = "block";
editableScript.style.display = "none";
video.pause();
printLog("Video paused");
} else {
scriptEditor.style.display = "none";
editableScript.type = "application/json";
ogScript.type = "text/javascript";
video.pause();
printLog("Video paused");
}
});
function applyJsCode() {
var text = document.getElementById("scriptEditor").value;
document.getElementById("editableScript").innerHTML = text;
}
function runCreativeScript() {
if (checkbox.checked) {
const scriptContent = scriptEditor.value;
eval(scriptContent); // Be cautious with eval
}
}
*/
//custom media recorder
const mediaRecorderCkbx = document.getElementById("mediaRecorderCkbx");
const mediaRecorderScriptEditor = document.getElementById(
"mediaRecorderScriptEditor"
);
const editableMediaRecorderScript = document.getElementById(
"editableMediaRecorderScript"
);
const ogMediaRecorderScript = document.getElementById(
"ogMediaRecorderScript"
);
mediaRecorderScriptEditor.value = editableMediaRecorderScript.textContent;
mediaRecorderCkbx.addEventListener("change", function () {
if (this.checked) {
editableMediaRecorderScript.type = "text/javascript";
ogMediaRecorderScript.type = "application/json";
mediaRecorderScriptEditor.style.display = "block";
editableMediaRecorderScript.style.display = "none";
video.pause();
printLog("Video paused");
} else {
mediaRecorderScriptEditor.style.display = "none";
editableMediaRecorderScript.type = "application/json";
ogMediaRecorderScript.type = "text/javascript";
video.pause();
}
});
function applyMRCode() {
var text = document.getElementById("mediaRecorderScriptEditor").value;
document.getElementById("editableMediaRecorderScript").innerHTML = text;
}
function runCreativeScript() {
if (mediaRecorderCkbx.checked) {
const scriptContent = mediaRecorderScriptEditor.value;
eval(scriptContent); // Be cautious with eval
}
}