forked from phuslu/readme
-
Notifications
You must be signed in to change notification settings - Fork 0
/
wallpaper.html
122 lines (103 loc) · 3.33 KB
/
wallpaper.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
<!DOCTYPE html>
<link rel="dns-prefetch" href="//jsonp.afeld.me/" />
<link rel="dns-prefetch" href="//www.bing.com/" />
<meta name="robots" content="noindex">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>首页 - 今日壁纸</title>
<style>
body {
margin: 0;
background: #515151;
font-family: "Helvetica Neue", "Luxi Sans", "DejaVu Sans", Tahoma, "Hiragino Sans GB", "Microsoft Yahei", sans-serif;
}
.container {
position: relative;
margin: 0 auto;
}
.container img {
vertical-align: middle;
resize: both;
width: 100%;
}
.container .banner {
position: absolute;
top: 0;
background: rgba(0, 0, 0, 0.5);
color: #f1f1f1;
width: 100%;
padding: 0px;
}
</style>
<div class="container">
<div class="banner"><p>【加载中】</p></div>
</div>
<script type="text/javascript">
function pixiv(data) {
var imgs = []
works = data.response.works
for (var i = 0; i < works.length; i++) {
work = works[i].work
if (work.width < 1280 || work.width < work.height)
continue
imgs.push({title: work.title, url: work.image_urls.large, created_time: work.created_time.replace(' ', 'T')})
}
imgs.sort(function (img1, img2) { return Date.parse(img2.created_time) - Date.parse(img1.created_time) })
//console.log(imgs)
img = document.createElement("img")
img.src = imgs[0].url
document.getElementsByClassName('container')[0].appendChild(img)
document.getElementsByTagName('p')[0].innerHTML = '【pixiv 动漫美图】' + imgs[0].title
}
function bing(data) {
copyright = data.images[0].copyright
title = (/今日/.test(copyright) ? '' : '【今日壁纸】') + copyright.replace(/\s*\(.+?\)$/, '')
img = document.createElement("img")
img.src = 'https://www.bing.com' + data.images[0].url
document.getElementsByClassName('container')[0].appendChild(img)
document.getElementsByTagName('p')[0].innerHTML = title
}
function w360(data) {
var imgs = []
data = data.data
for (var i = 0; i < data.length; i++) {
if (!/^(美女|4K|动漫|游戏|风景)/.test(data[i].utag))
continue
imgs.push({title: data[i].utag, url: data[i].url})
}
i = Math.floor(imgs.length * Math.random());
img = document.createElement("img")
img.src = imgs[i].url
document.getElementsByClassName('container')[0].appendChild(img)
document.getElementsByTagName('p')[0].innerHTML = '【360 精选壁纸】' + imgs[i].title
}
!function() {
callback = location.search ? location.search.substring(1) : "bing"
switch (callback) {
case "bing":
url = 'https://www.bing.com/HPImageArchive.aspx?format=js&idx=0&n=1&mkt=zh-CN'
break
case "pixiv":
url = 'https://api.pixiv.moe/v1/ranking'
break
case "360":
callback = "w360"
case "w360":
url = 'http://wallpaper.apc.360.cn/index.php?c=WallPaper&a=getAppsByOrder&order=create_time&start=0&count=100&from=360chrome'
break
case "moe":
url = 'https://raw.githubusercontent.com/yql/yql-tables/master/data/htmlstring.xml'
break
default:
document.getElementsByTagName('p')[0].innerHTML = '【加载失败】'
return
}
script = document.createElement("script")
script.src = "https://jsonp.afeld.me/?url=" + encodeURIComponent(url) + "&callback=" + callback
document.body.appendChild(script)
setTimeout(function () {
if (document.getElementsByTagName('img').length > 0) return
document.getElementsByTagName('p')[0].innerHTML += '.'
setTimeout(arguments.callee, 500)
}, 500)
}()
</script>