-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbase64.html
150 lines (131 loc) · 4.04 KB
/
base64.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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>base64加密新源代</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
body {
background-color: #f2f2f2;
font-family: Arial, sans-serif;
font-size: 16px;
line-height: 1.5;
padding: 20px;
}
h1 {
display: flex;
align-items: center;
justify-content: center;
background: linear-gradient(to right, #007AFF, #007AFF) no-repeat center center;
background-size: 100% 50px;
padding-bottom: 5px;
margin-bottom: 30px;
color: #fff;
text-align: center;
}
.form-group {
margin-bottom: 20px;
}
.input-label,
.result-label {
display: none;
}
.input-field {
display: block;
width: 100%;
padding: 18px;
border-radius: 5px;
border: none;
font-size: 18px;
line-height: 1.5;
box-shadow: 0 0 5px rgba(0, 0, 0, 0.1);
background-color: #fff;
color: #555;
}
.submit-btn {
display: inline-block;
padding: 10px 20px;
margin-left: 10px;
background-color: #007AFF;
color: #fff;
border-radius: 5px;
border: none;
font-size: 16px;
line-height: 1.5;
cursor: pointer;
transition: all 0.2s ease-in-out;
margin-top: 20px;
}
.submit-btn:hover {
background-color: #1A5DE6;
}
.result-field {
display: block;
width: 100%;
padding: 18px;
margin-top: 10px;
border-radius: 5px;
border: 1px solid #ccc;
font-family: Arial, sans-serif;
font-size: 18px;
line-height: 1.5;
box-shadow: 0 0 5px rgba(0, 0, 0, 0.1);
background-color: #fff;
color: #555;
}
.result-image {
max-width: 100%;
height: auto;
display: block;
margin: 20px auto;
text-align: center;
pointer-events: none;
}
.result-image img {
max-width: 100%;
pointer-events: none;
}
</style>
</head>
<body>
<h1>加密和解密</h1>
<div class="form-group">
<input type="text" id="text-input" placeholder="输入要加密或解密的内容" class="input-field">
<button onclick="encrypt()" class="submit-btn">加密</button>
<button onclick="decrypt()" class="submit-btn">解密</button>
<button onclick="clearInput()" class="submit-btn">清除</button>
<button onclick="copyResult()" class="submit-btn">复制</button>
</div>
<div class="form-group">
<textarea id="result" rows="10" cols="50" class="result-field"></textarea>
<div class="result-image">
</div>
</div>
<script>
function encrypt() {
var input = document.getElementById("text-input").value;
var result = document.getElementById("result");
result.value = btoa(input);
}
function decrypt() {
var input = document.getElementById("text-input").value;
var result = document.getElementById("result");
result.value = atob(input);
}
function clearInput() {
document.getElementById("text-input").value = "";
}
function copyResult() {
var result = document.getElementById("result");
result.select();
document.execCommand("copy");
}
document.addEventListener('contextmenu', event => event.preventDefault());
</script>
</body>
</html>