提交 52556e6d 编写于 作者: AndroidLeaves's avatar AndroidLeaves

update

上级 f4858a78
......@@ -479,7 +479,7 @@ class Widget extends BaseWidget {
// 描述
tipArr = []
nodeSize = 0
totalCount = 10
totalCount = 20
// 图片封面
let allItemNodeList = document.getElementsByClassName('weui-media-box__thumb radius');
for(let node of allItemNodeList) {
......@@ -534,15 +534,20 @@ class Widget extends BaseWidget {
await this.generateAlert('热榜搜索', '搜索结果为空', ['确定']);
} else {
await this.renderSearchResultView(response, async (event) => {
const { title, link } = event;
let { title, link } = event;
const hotbanArr = this.getHotban('[]');
const findItem = hotbanArr.find(hotban => hotban.title == title);
if (findItem == undefined) {
hotbanArr.push({ title, link: `${this.defaultPreference.domain}${link}` });
this.useFileManager().writeStringCache('hotban', JSON.stringify(hotbanArr));
try {
link = `${this.defaultPreference.domain}${link}`;
hotbanArr.push({ title, link });
this.useFileManager().writeStringCache('hotban', JSON.stringify(hotbanArr));
await this.generateAlert(`热榜内容`, `已成功添加«${title}»\n关闭窗口重新运行`, ['确定']);
this.rerunWidget();
} catch (error) {
console.error(error);
}
}
await this.generateAlert(`热榜内容`, `已成功添加«${title}»\n关闭窗口重新运行`, ['确定']);
this.rerunWidget();
});
}
//////
......@@ -681,7 +686,10 @@ class Widget extends BaseWidget {
textSpan.font = Font.systemFont(contentSize);
textSpan.lineLimit = 1;
//
let linkElement = `https://tophub.today${link}`;
let linkElement = link;
if (!link.startsWith('http')) {
linkElement = `https://tophub.today${link}`;
}
if (hotTitle.search("微博") != -1) {
const weiboOpenType = this.getWeiboOpenType();
if (weiboOpenType == '国内版') {
......@@ -722,8 +730,8 @@ class Widget extends BaseWidget {
logoUrl = branLogo.style['background-image'].slice(5).slice(0, -2)
//
mainTitle = branLogo.innerText
subTitle = document.getElementsByClassName('tab-nav-item active')[0].innerText
hotTitle = mainTitle + subTitle
subTitle = document.getElementsByClassName('tab-nav-item active')[0]?.innerText ?? ''
hotTitle = mainTitle + (subTitle.length > 0 ? ' · ' : '') + subTitle
}
// 链接
linkArr = []
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册