-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathjs.js
71 lines (68 loc) · 2.09 KB
/
js.js
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
var uid;
setWidth();
document.getElementById('button').onclick = function(){
var uid = document.getElementById('uid').value;
if (uid=='') {
alert('请填写UP主的UID');
return false;
}
document.getElementById('get_uid').style.opacity = '0';
document.getElementById('get_uid').style.zIndex = '-1';
document.getElementById('get_uid').style.display = 'none';
document.getElementById('fans').style.display = 'block';
setInterval(function(){getfans(uid)},1000);
getinfo(uid);
}
function getfans(uid){
$.ajax({
type:"GET",
url:"./getfans.php",
data:"uid="+uid,
success:function(data){
var obj = JSON.parse(data);
$("#fans_count").html(obj['data']['follower']);
}
});
}
function getinfo(uid){
$.ajax({
type:"GET",
url:"./getfans.php",
data:"info_uid="+uid,
success:function(data){
var obj = JSON.parse(data);
$("#img").attr('src',obj['data']['face']);
$("#name").html(obj['data']['name']);
$("#lv").html("LV"+obj['data']['level']);
$("#des").html(obj['data']['sign']);
$("#b_link").attr('href',"https://space.bilibili.com/"+uid);
if (obj['data']['vip']['status']!='1') {
$("#vip").remove();
}else{
if (obj['data']['vip']['type']=='1') {
$("#vip").html("大会员");
}else{
$("#vip").html("年度大会员");
}
}
}
});
}
function setWidth(){
console.log('Copyright©2019 术与道 All Rights Reserved. MIT License');
var width = document.body.offsetWidth;
if (width < 530) {
document.getElementById('info_name').style.width = (width-54-width*0.04-1-20)+'px';
}
}
//解决移动端点击输入UID时的布局问题
var winHeight = $(window).height();
$(window).resize(function() {
//当窗体大小变化时
var thisHeight = $(this).height();
if (winHeight - thisHeight > 50) {
$('footer').css('display', 'none');
} else {
$('footer').css('display', 'block');
}
});