-
Notifications
You must be signed in to change notification settings - Fork 165
/
auto_code_printer.html
77 lines (69 loc) · 1.96 KB
/
auto_code_printer.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
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>鱼皮-自动敲网页</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.18.1/styles/default.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.18.1/highlight.min.js"></script>
<script src="https://cdn.bootcss.com/jquery/3.5.0/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/typeit.min.js"></script>
<style type="text/css">
#inputUrl {
margin-bottom: 20px;
}
#runBtn {
font-size: 16px;
}
.box {
width: 48%;
box-sizing: border-box;
padding: 10px;
margin-right: 1%;
border: 1px solid #aaa;
float: left;
min-height: 600px;
}
xmp {
white-space: normal;
word-break: break-word;
margin: 0;
}
</style>
</head>
<body>
<h1>鱼皮-自动敲网页</h1>
<div>
输入网址(添加http/https前缀):<input type="text" id="inputUrl">
<input type="button" id="runBtn" value="喝杯☕️ 看你敲">
</div>
<div class="box"><pre><code id="preHtml">请先输入网址</code></pre></div>
<iframe id="show" class="box">请先输入网址</iframe>
<script type="text/javascript">
hljs.initHighlightingOnLoad();
$(function() {
// 预拦截器
$.ajaxPrefilter(function (options) {
if (options.crossDomain && jQuery.support.cors) {
var http = (window.location.protocol === 'http:' ? 'http:' : 'https:');
options.url = http + '//cors-anywhere.herokuapp.com/' + options.url;
}
});
$('#runBtn').click(() => {
$('#preHtml').html('加载中。。。');
const url = $('#inputUrl').val();
// 请求网页
$.get(url, res => {
$('#preHtml').html('<xmp>' + res + '</xmp>');
$('#show')[0].src = url;
new TypeIt("#preHtml", {
strings: res,
speed: 20,
loop: true
}).go();
}
);
})
});
</script>
</body>
</html>