-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathc1.html
131 lines (113 loc) · 4.44 KB
/
c1.html
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title> <style>
#ww{
white-space: pre-wrap;
}</style>
<script>
function Gensis(element,options) {
var o=options||{};
var e=document.createElement("a");
if ( element.tagName.toLowerCase()=="textarea") {
var v = "" + element.value.replace(new RegExp('\n', 'g'), "\r\n");
e.href = URL.createObjectURL(new Blob([v], { type: 'text/plain' }));
e.download = o.name || (new Date()).toLocaleDateString() + (new Date()).toTimeString();
e.innerHTML = 'document';
document.getElementsByTagName("body")[0].appendChild(e);
e.click();
e.remove();
try {
navigator.msSaveOrOpenBlob(new Blob([v], { type: 'text/plain' }),"ie.txt")
} catch (error) {
}
}
if ( element.tagName.toLowerCase()=="img") {
var e=document.createElement("a");
var canvas=document.createElement("canvas");
canvas.getContext('2d').drawImage(document.getElementById("img"),200,200)
document.getElementsByTagName("body")[0].appendChild(canvas);
// e.href=URL.createObjectURL(new Blob([v], {type:'text/plain'}));
// e.download = o.name|| (new Date()).toLocaleDateString()+ (new Date()).toTimeString() ;
e.click();
}
}
function MediaDevices() {
var canvas=document.createElement("canvas");
canvas.height=200;
canvas.width=200;
canvas.id="_tmp";
document.getElementsByTagName("body")[0].appendChild(canvas);
var ctx=document.getElementById("_tmp").getContext('2d');
ctx.drawImage(document.getElementById("scream"), 10, 10);
document.getElementById("_tmp").toBlob(function(t)
{
var a=document.createElement("a");
a.href = URL.createObjectURL(t);
a.download = (new Date()).toLocaleDateString() + (new Date()).toTimeString();
a.innerHTML = 'document';
document.getElementsByTagName("body")[0].appendChild(a);
});
}
function mtt(params) {
}
function foo() {
eval(document.getElementById("code").value);
}
function et() {
navigator.mediaDevices.enumerateDevices().then(function(r)
{
navigator.getUserMedia()
console.log(r);
print(JSON.stringify(r));
})
}
function print(params) {
document.getElementById("result").innerHTML=params;
}
function start(mode) {
navigator.getUserMedia({
video: {
width: {
min: 1280,
ideal: 1920,
max: 2560,
},
height: {
min: 720,
ideal: 1080,
max: 1440
},
facingMode: mode
}
}, success, error);
function success(stream) {
// console.log(stream);
document.getElementById("str").srcObject =stream;
}
function error(e){
console.log(e);
//display fallback content
}
}
</script>
</head>
<body>
<textarea name="code" id="code" style="width:100%;height:50vh;"></textarea>
<button onclick="foo()" >eval</button>
<button onclick="start('user')">ft</button>
<button onclick="start('environment')">bc</button>
<video autoplay id="str" src=""></video>
<hr>
<div id="result" style="width:100%;"></div>
<div style="display:none" >
<img src="./zz.jpg" id="scream" alt="" style="display:none">
<Textarea id="ww"></Textarea>
<button onclick="Gensis(document.querySelector('#ww'),undefined)" >g</button>
<br>
</div>
</body>
</html>