-
Notifications
You must be signed in to change notification settings - Fork 2
/
app.js
69 lines (60 loc) · 1.69 KB
/
app.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
const YouTubeApp = document.getElementById("app");
function PressApp(code) {
YouTubeApp.sendInputEvent({type: 'keyDown', keyCode: code})
YouTubeApp.sendInputEvent({type: 'char', keyCode: code})
YouTubeApp.sendInputEvent({type: 'keyUp', keyCode: code})
}
let img;
YouTubeApp.addEventListener("dom-ready", function(){
setTimeout(function () {
PressApp("Left");
PressApp("Down");
PressApp("Down");
PressApp("Down");
PressApp("Down");
PressApp("Down");
PressApp("Down");
PressApp("Down");
PressApp("Return");
setTimeout(function () {
PressApp("Down");
PressApp("Down");
PressApp("Down");
setTimeout(function () {
GetCode();
}, 2000)
}, 1000)
}, 2000)
});
async function GetCode() {
let rect = {
x: 469,
y: 441,
width: 314,
height: 49
};
var Cap = await YouTubeApp.capturePage(rect);
var dataURLFinal = Cap.toDataURL();
$("#phoneCode").attr("src", dataURLFinal);
setTimeout(function () {
$("#bn").css("background-color", "#0088ff");
$("#bn").css("opacity", "100%");
$("#bn").attr("onclick", "dismissModal()");
}, 200)
}
function dismissModal() {
PressApp("Left");
PressApp("Up");
PressApp("Up");
PressApp("Up");
PressApp("Up");
PressApp("Up");
PressApp("Up");
PressApp("Up");
PressApp("Right");
setTimeout(function () {
$("#OverCode").css("display", "none");
YouTubeApp.classList.add("opened");
YouTubeApp.focus();
}, 300)
}