-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
93 lines (93 loc) · 5.5 KB
/
index.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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1">
<script src="base64.js" charset="utf-8"/></script>
<script src="https://cdn.bootcss.com/jquery/3.4.1/jquery.min.js"></script>
<link href="https://cdn.bootcss.com/twitter-bootstrap/3.4.1/css/bootstrap.min.css" rel="stylesheet">
<script src="https://cdn.bootcss.com/clipboard.js/2.0.4/clipboard.min.js"></script>
<title>文档转换</title>
<style>
pre{
white-space: pre-wrap;
white-space: -moz-pre-wrap;
white-space: -pre-wrap;
white-space: -o-pre-wrap;
word-wrap: break-word;
}
</style>
</head>
<body style="margin: 3%; font-size: 18px;">
<div id="info" class="text-muted">
<p>提示:<a href="javascript:window.location.reload()">刷新本页面</a>可以进行新的编码解码操作。</p>
<p>字体调节 <input class="btn btn-default" id="increase" type="button" value="大"> <input class="btn btn-default" id="decrease" type="button" value="小"></p>
<p>主题调节 <span style="font-size: 25px;">
<span id="white" style="color:#fff">▄</span>
<span id="brown" style="color:rgb(255, 244, 186)">▄</span>
<span id="green" style="color:#b8dfa3">▄</span>
<span id="black" style="color:#101110">▄</span>
</span>
</p>
<p class="text-success">下面是正文部分。</p>
<small class="text-muted">以下内容为用户输入部分,与本站无关。</small>
<hr/>
</div>
<div id="read" style="line-height:35px">
<textarea id="text" rows="10" class="form-control" autofocus></textarea><br/>
<input class="btn btn-default" id="decode" type="submit" value="解码""/>
<input class="btn btn-default" id="encode" type="submit" value="编码"/>
<br/><br/>
<p class="text-info"><b>您若继续使用本页面,则意味着您默许及知晓以下内容。</b></p>
<small class="text-muted">
<p>您不得将本页面用于任何违背中华人民共和国法律、美国加利福尼亚洛杉矶地区法律的行为。</p>
<p class="text-danger">本页面不保证您所输入信息的安全性,仅提供编码解码服务。</p>
<p>请注意,算法透明公开,任何人都可以通过任意支持 <a href="https://baike.baidu.com/item/base64/8545775" target="_blank">Base64</a> 算法的编码程序解码出您所加密的字符。</p>
<br/>
<p>本页面所用到的开源项目:<a href="https://jquery.com/" target="_blank">jQuery</a> 、<a href="https://github.com/dankogai/js-base64" target="_blank">js-base64</a> 、 <a href="https://getbootstrap.com/" target="_blank">Twittr Bootstarp</a> 和 <a href="https://clipboardjs.com/" target="_blank">clipboard.js</a> 。使用了 <a href="https://www.bootcdn.cn/" target="_blank">BootCDN</a> 加速。</p>
</small>
</div>
<script charset="utf-8">
$(document).ready(function(){
new ClipboardJS('.btn');
$("#info").hide();
$("#encode").click(function(){
$("#read").fadeOut();
$("#read").fadeIn();
var text = $("#text").val();
text = escape(text);
text = Base64.encode(text);
document.getElementById("read").innerHTML = "<input type=\"button\" class=\"btn btn-default\" data-clipboard-target=\"#foo\" value=\"复制\"><br/><pre id=\"foo\">"+text+"</pre>";
$("#info").show();
});
$("#decode").click(function(){
$("#read").fadeOut();
$("#read").fadeIn();
var text = $("#text").val();
text = Base64.decode(text);
//text = text.replace(/\\/g, "%");
text = unescape(text.replace(/%0A/g,"<br>"));
document.getElementById("read").innerHTML = text;
$("#info").show();
});
//字号调节
var size;
size = Number($("body").css("font-size").slice(0,-2));
$("#increase").click(function(){
size += 2;
$("body").css({"font-size":size});
});
$("#decrease").click(function(){
size -= 2;
$("body").css({"font-size":size});
});
//颜色调节
var bgcolor,textc;
$("#white").click(function(){bgcolor="#fff";textc="#333";$("body").css({"background-color":bgcolor,"color":textc});});
$("#black").click(function(){bgcolor="#101110";textc="#eceeec";$("body").css({"background-color":bgcolor,"color":textc});});
$("#brown").click(function(){bgcolor="rgb(255, 244, 186)";textc="#512606";$("body").css({"background-color":bgcolor,"color":textc});});
$("#green").click(function(){bgcolor="#b8dfa3";textc="#22441b";$("body").css({"background-color":bgcolor,"color":textc});});
});
</script>
</body>
</html>