1
0
Code Issues Pull Requests Projects Releases Wiki Activity GitHub Gitee

小细节调整

This commit is contained in:
程序员小墨 2022-07-29 20:33:57 +08:00
parent e8e5f68c5b
commit aeee1b77f3
7 changed files with 66 additions and 3 deletions

View File

@ -16,7 +16,7 @@
微博热搜接口https://weibo.com/ajax/statuses/hot_band
> 该接口来自页面https://weibo.com/newlogin?tabtype=search
> 该接口来自页面https://weibo.com/hot/search
B站热搜接口https://app.bilibili.com/x/v2/search/trending/ranking

View File

@ -22,3 +22,11 @@
font-size: 10px;
display: inline-block;
}
.bottom-placeholder {
height: 60px;
font-size:13px;
color: #999;
display: grid;
place-items: center;
}

View File

@ -0,0 +1,24 @@
function isMobile() {
var userAgentInfo = navigator.userAgent;
var mobileAgents = ["Android", "iPhone", "SymbianOS", "Windows Phone", "iPad", "iPod"];
var mobile_flag = false;
//根据userAgent判断是否是手机
for (var v = 0; v < mobileAgents.length; v++) {
if (userAgentInfo.indexOf(mobileAgents[v]) > 0) {
mobile_flag = true;
break;
}
}
// var screen_width = window.screen.width;
// var screen_height = window.screen.height;
// //根据屏幕分辨率判断是否是手机
// if (screen_width > 325 && screen_height < 750) {
// mobile_flag = true;
// }
return mobile_flag;
}

View File

@ -11,6 +11,12 @@
#list td {
font-size: 14px;
}
#mobile-info {
color: grey;
font-size: 13px;
text-align: center;
}
</style>
</head>
@ -53,6 +59,16 @@
<span id="update-finish-info" style="color: green; font-weight: bold; display: none;">拉取成功,数据已更新</span>
</nobr>
<table id="list"></table>
<p id="mobile-info"></p>
<div class="bottom-placeholder">
<p>— 到底啦 —</p>
</div>
<script src="./assets/js/isMobile.js"></script>
<script>
let mobileFlag = isMobile();
document.getElementById('mobile-info').innerHTML = `手机、电脑端热搜链接不同,当前为您呈现 <span style="font-weight: bold;">${mobileFlag ? '手机端' : '电脑端'}</span> 链接`;
</script>
<script>
let iconMapper = {
"http://i0.hdslb.com/bfs/feed-admin/e9e7a2d8497d4063421b685e72680bf1cfb99a0d.png": ["热", "#FF895C"],
@ -244,6 +260,11 @@
for (var i = 0; i < hotBandList.length; i++) {
const hotBand = hotBandList[i];
let linkUrl = mobileFlag
? `https://m.bilibili.com/search?keyword=${encodeURIComponent(hotBand.keyword)}`
: `https://search.bilibili.com/all?keyword=${encodeURIComponent(hotBand.keyword)}`;
str.push(`<tr>
<!-- 编号 -->
<td>${hotBand.position}</td>
@ -254,7 +275,9 @@
<div style="min-width: 20px; display: inline-block;">
<span class="hotband-label" style="background-color: ${getIconText(hotBand.icon)[1]}; ${hotBand.icon ? "" : "display: none;"}">${getIconText(hotBand.icon)[0]}</span>
</div>
<span>${hotBand.show_name}</span>
<span>
<a href="${linkUrl}" target="_blank">${hotBand.show_name}</a>
</span>
${hotBand.show_live_icon ? `<span class="hotband-label" style="background-color: #f69; padding: 1px 5px;">直播中</span>` : ""}
</nobr>
</td>

View File

@ -83,6 +83,10 @@
<span id="update-finish-info" style="color: green; font-weight: bold; display: none;">拉取成功,数据已更新</span>
</nobr>
<table id="list"></table>
<div class="bottom-placeholder">
<p>— 到底啦 —</p>
</div>
<script>
/**
* 全局变量

View File

@ -64,6 +64,10 @@
<span id="update-finish-info" style="color: green; font-weight: bold; display: none;">拉取成功,数据已更新</span>
</nobr>
<table id="list"></table>
<div class="bottom-placeholder">
<p>— 到底啦 —</p>
</div>
<script>
/**
* 全局变量

View File

@ -98,7 +98,7 @@
title: 'B站排行',
// url: 'html/bilibili_rank.html',
icon: './html/assets/image/icon_rank.png',
icon_scale: 1,
icon_scale: 0.87,
},
};
// 渲染导航栏