-
Notifications
You must be signed in to change notification settings - Fork 7
/
Picture_bed.html
367 lines (331 loc) · 11.7 KB
/
Picture_bed.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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
<!--
/***
* @Description: Gavin在线图床
* @Param:
* @Return:
* @Auther: Gavincoder
* @Date: 2018/12/15
*/
四合一图床上传,支持百度(2M)、搜狗(2M)、360(2M)、新浪(10M)图片上传
声明:前端无版权,调用YoungxjApis接口
-->
<!DOCTYPE html>
<html lang='zh-cn'>
<head>
<meta charset='UTF-8'>
<meta name="viewport"
content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0">
<title>Gavin - Cdn图床,百度图床,新浪图床,360图床,搜狗图床</title>
<link rel='stylesheet' href='https://cdn.bootcss.com/normalize/5.0.0/normalize.min.css'>
<script src="https://cdn.bootcss.com/jquery/3.3.0/jquery.min.js"></script>
<style>
html, body {
height: 100%;
margin: 0;
padding: 0;
}
body {
font-family: 'lucida grande', 'lucida sans unicode', lucida, helvetica, 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', sans-serif;
align-items: center;
display: flex;
}
a {
text-decoration: none;
}
#container {
max-width: 400px;
flex-basis: 100%;
margin: 0 auto;
background: #FFF;
border-radius: 10px;
box-shadow: 0 0 30px rgba(0, 0, 0, 0.3);
-webkit-box-shadow: 0 0 30px rgba(0, 0, 0, 0.3);
overflow: hidden;
}
#container #hero-img {
width: 100%;
height: 200px;
background: #007bff;
}
#container #profile-img {
width: 160px;
height: 160px;
margin: -80px auto 0 auto;
}
#container #profile-img img {
width: 100%;
background: #FFF;
border-radius: 50%;
}
#container #content {
text-align: center;
width: 320px;
margin: 0 auto;
padding: 0 0 50px 0;
}
#container #content h1 {
font-size: 29px;
font-weight: 500;
margin: 30px 0 0 0;
}
#container #content p {
font-size: 18px;
font-weight: 400;
line-height: 1.4;
color: #666;
margin: 15px 0 40px 0;
}
#container #content a {
color: #CCC;
font-size: 14px;
margin: 0 10px;
transition: color .3s ease-in-out;
-webkit-transition: color .3s ease-in-out;
line-height: 40px;
}
#container #content a:hover {
color: #007bff;
}
.btn {
background: none repeat scroll 0 0 #1BA1E2;
border: 0 none;
border-radius: 2px;
color: #FFFFFF !important;
cursor: pointer;
font-family: "Open Sans", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", Arial, Verdana, Tahoma, sans-serif;
font-size: 14px;
padding: 6px 10%;
}
.btn:hover, .yanshibtn:hover {
background: none repeat scroll 0 0 #9B59B6;
border: 0 none;
border-radius: 2px;
color: #FFFFFF !important;
cursor: pointer;
font-family: "Open Sans", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", Arial, Verdana, Tahoma, sans-serif;
font-size: 14px;
padding: 8px 10%;
}
.imgType {
display: none;
}
#images img {
width: 100%
}
#imgurl input {
width: 100%
}
#imgurl, #progress {
display: none;
}
@-webkit-keyframes rotation {
from {
-webkit-transform: rotate(0deg);
}
to {
-webkit-transform: rotate(360deg);
}
}
.Rotation {
-webkit-transform: rotate(360deg);
animation: rotation 3s linear infinite;
-moz-animation: rotation 3s linear infinite;
-webkit-animation: rotation 3s linear infinite;
-o-animation: rotation 3s linear infinite;
}
.img {
border-radius: 250px;
}
</style>
</head>
<body>
<div id='container'>
<div id='hero-img'>
</div>
<div id='profile-img'>
<img src='https://ww2.sinaimg.cn/large/005BYqpggy1fxbboztih4j305k05kwef.jpg' id="imgLoading"
class="Rotation img" title="显示与隐藏"/>
</div>
<div id='content'>
<h2>Gavin在线图床</h2>
<h5>
百度(2M)-新浪(10M)-搜狗(2M)-360图床(2M)
</h5>
<div id="progress">
<progress max="100" value="0" id="pg"></progress>
</div>
<p class="imgType" id="imgType"></p>
<form id="form1">
<a href='javascript:void(0)' id="baiduImg" onclick="update('baidu')" class="btn btn-default" rel='nofollow'>百度图床</a><a
href='javascript:void(0)' id="SinaImg" onclick="update('sina')" class="btn btn-default" rel='nofollow'>新浪图床</a>
<a href='javascript:void(0)' id="sougouImg" onclick="update('sougou')" class="btn btn-default"
rel='nofollow'>搜狗图床</a><a href='javascript:void(0)' id="soImg" onclick="update('so')"
class="btn btn-default" rel='nofollow'>360 图床</a>
<input type="file" id="file" name="file" onchange="sc($('#imgType').attr('imgType'));" style="display:none"
accept="image/*">
</form>
<div class="imgContent" id="imgContent">
<div id="images"></div>
<div id="imgurl">
<code>ImgUrl:</code>
<input onclick="oCopy(this)" value="" id="Imgs_url">
<code>HtmlUrl:</code>
<input onclick="oCopy(this)" value="" id="Imgs_html">
<code>Ubb:</code>
<input onclick="oCopy(this)" value="" id="Imgs_Ubb">
<code>Markdown:</code>
<input onclick="oCopy(this)" value="" id="Imgs_markdown">
</div>
</div>
</div>
</div>
</body>
<script type="text/javascript">
/***
* @Description:
* @Param:
* @Return:
* @Auther: Gavincoder
* @Date: 2018/12/15
*/
function update(type) {
$('#file').val('');
$('#imgType').attr({
imgType: type,
});
file.click();
}
function sc(type) {
if (!type) {
return false;
}
var animateimg = $("#file").val();
$('#pg').val('0');
var imgarr = animateimg.split('\\');
var myimg = imgarr[imgarr.length - 1];
var houzui = myimg.lastIndexOf('.');
var ext = myimg.substring(houzui, myimg.length).toUpperCase();
var file = $('#file').get(0).files[0];
if (!file) {
return false;
}
var fileSize = file.size;
switch (type) {
case 'sougou':
var maxSize = 2097152;
break;
case 'baidu':
var maxSize = 2097152;
break;
case 'so':
var maxSize = 2097152;
break;
case 'sina':
var maxSize = 10485760;
break;
default:
var maxSize = 10485760;
}
if (ext != '.PNG' && ext != '.GIF' && ext != '.JPG' && ext != '.JPEG' && ext != '.BMP') {
parent.alert('文件类型错误,请上传图片类型');
return false;
} else if (parseInt(fileSize) >= parseInt(maxSize)) {
parent.alert('上传的文件不能超过' + maxSize / 1024 / 1024 + 'MB');
return false;
} else {
$('#imgLoading').attr('src', 'https://ww2.sinaimg.cn/large/005BYqpgly1fxbbemsqxaj305k05k3yg.jpg');
var data = new FormData($('#form1')[0]);
var YoungxjApisToken = 'f07b711396f9a05bc7129c4507fb65c5';
switch (type) {
case 'sougou':
var apiUrl = 'https://apis.yum6.cn/api/5bd7f16aa33d7';
break;
case 'baidu':
var apiUrl = 'https://apis.yum6.cn/api/5bd828881f92b';
break;
case 'so':
var apiUrl = 'https://apis.yum6.cn/api/5bd90750c3f77';
break;
case 'sina':
var apiUrl = 'https://apis.yum6.cn/api/5bd44dc94bcfc';
break;
default:
return false;
}
;
$('#progress').show();
$.ajax({
url: apiUrl + '?token=' + YoungxjApisToken,
type: 'POST',
data: data,
dataType: 'JSON',
processData: false,
contentType: false,
xhr: function () {
var xhr = $.ajaxSettings.xhr();
if (onprogress && xhr.upload) {
xhr.upload.addEventListener("progress", onprogress, false);
return xhr;
}
}
}).done(function (ret) {
if (ret['code'] == '1') {
var img = '';
var imgurl = '';
if (type != 'sina') {
var imgSrc = ret['data'];
} else {
var imgSrc = ret['data']['url'];
}
img += '<img src="' + imgSrc + '" name="sinaimg" id="sinaimg">';
$('#Imgs_url').val(imgSrc);
$('#Imgs_html').val('<img src="' + imgSrc + '"/>');
$('#Imgs_Ubb').val('[img]' + imgSrc + '[/img]');
$('#Imgs_markdown').val('![](' + imgSrc + ')');
$('#images').html(img);
$('#imgLoading').attr('src', 'https://ww2.sinaimg.cn/large/005BYqpggy1fxbbgt35opj305k05k3yh.jpg');
$('#imgurl').show();
$('#progress').hide();
} else {
$('#progress').hide();
$('#imgLoading').attr('src', 'https://ww2.sinaimg.cn/large/005BYqpggy1fxbbey7nfuj305k05k3yg.jpg');
parent.alert(ret['msg']);
}
});
return false;
}
}
function onprogress(evt) {
var loaded = evt.loaded;
var tot = evt.total;
var per = Math.floor(100 * loaded / tot);
$('#pg').val(per);
}
function oCopy(obj) {
obj.select();
document.execCommand("Copy");
if (browserRedirect()) {
alert('设备类型为手机,有一定几率复制失败!请查看剪切板是否成功复制');
}
}
function browserRedirect() {
var sUserAgent = navigator.userAgent.toLowerCase();
var bIsIpad = sUserAgent.match(/ipad/i) == 'ipad';
var bIsIphone = sUserAgent.match(/iphone os/i) == 'iphone os';
var bIsMidp = sUserAgent.match(/midp/i) == 'midp';
var bIsUc7 = sUserAgent.match(/rv:1.2.3.4/i) == 'rv:1.2.3.4';
var bIsUc = sUserAgent.match(/ucweb/i) == 'web';
var bIsCE = sUserAgent.match(/windows ce/i) == 'windows ce';
var bIsWM = sUserAgent.match(/windows mobile/i) == 'windows mobile';
var bIsAndroid = sUserAgent.match(/android/i) == 'android';
if (bIsIpad || bIsIphone || bIsMidp || bIsUc7 || bIsUc || bIsCE || bIsWM || bIsAndroid) {
return 1;
}
};
$(document).ready(function () {
$('#imgLoading').click(function () {
$("#imgContent").toggle();
});
});
</script>
</html>