Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
enoyee
Scriptable
提交
26799c50
S
Scriptable
项目概览
enoyee
/
Scriptable
通知
9
Star
0
Fork
3
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
Scriptable
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
26799c50
编写于
12月 13, 2022
作者:
AndroidLeaves
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
up
上级
52556e6d
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
44 addition
and
26 deletion
+44
-26
TopHub榜单.js
TopHub榜单.js
+30
-20
_LSP.js
_LSP.js
+3
-0
今日事项.js
今日事项.js
+11
-6
未找到文件。
TopHub榜单.js
浏览文件 @
26799c50
...
...
@@ -27,7 +27,7 @@ const { BaseWidget } = require(dependencyFileName);
class
Widget
extends
BaseWidget
{
defaultPreference
=
{
version
:
20221213
,
version
:
20221213
_2
,
domain
:
'
https://tophub.today
'
,
hotban
:
[{
title
:
'
微博 · 热搜榜
'
,
link
:
'
https://tophub.today/n/KqndgxeLl9
'
}],
weiboOpenOptions
:
[
...
...
@@ -59,27 +59,35 @@ class Widget extends BaseWidget {
largeItemCount
:
13
};
getCookie
()
{
async
getCookie
()
{
let
cookie
=
''
;
const
{
hotbanCK
}
=
this
.
readWidgetSetting
();
console
.
log
(
`???
${
hotbanCK
}
`
);
if
(
hotbanCK
)
{
let
index
=
hotbanCK
.
lastIndexOf
(
"
;
"
);
let
subStr
=
hotbanCK
.
slice
(
0
,
index
);
let
stamp1
=
hotbanCK
.
slice
(
index
,
hotbanCK
.
length
);
index
=
stamp1
.
lastIndexOf
(
"
=
"
);
stamp1
=
stamp1
.
slice
(
0
,
index
);
stamp1
=
stamp1
+
`=
${
Math
.
round
(
new
Date
()
/
1000
)}
`
index
=
subStr
.
lastIndexOf
(
"
;
"
);
let
preStr
=
subStr
.
slice
(
0
,
index
);
let
stamp2
=
subStr
.
slice
(
index
,
subStr
.
length
);
index
=
stamp2
.
lastIndexOf
(
"
=
"
);
stamp2
=
stamp2
.
slice
(
0
,
index
);
stamp2
=
stamp2
+
`=
${
Math
.
round
(
new
Date
()
/
1000
)
-
86400
*
Math
.
ceil
(
Math
.
random
()
*
10
)}
,
${
Math
.
round
(
new
Date
()
/
1000
)
-
86400
*
Math
.
ceil
(
Math
.
random
()
*
6
)}
,
${
Math
.
round
(
new
Date
()
/
1000
)
-
86400
*
Math
.
ceil
(
Math
.
random
()
*
3
)}
,
${
Math
.
round
(
new
Date
()
/
1000
)}
`
cookie
=
(
preStr
+
stamp2
+
stamp1
).
replace
(
'
\n
'
,
''
);
const
hotbanCKArr
=
hotbanCK
.
split
(
"
;
"
);
if
(
hotbanCKArr
.
length
!==
3
)
{
await
this
.
generateAlert
(
'
TopHub添加cookie
'
,
`添加的cookie不符合要求,需要登录后的cookie`
,
[
'
确定
'
]);
}
else
{
let
itc_center_user
;
let
Hm_lvt
;
let
Hm_lpvt
;
//
hotbanCKArr
.
forEach
(
element
=>
{
if
(
element
.
startsWith
(
'
Hm_lvt
'
))
{
let
index
=
element
.
lastIndexOf
(
"
=
"
);
Hm_lvt
=
element
.
slice
(
0
,
index
)
Hm_lvt
+=
`=
${
Math
.
round
(
new
Date
()
/
1000
)}
`
}
else
if
(
element
.
startsWith
(
'
Hm_lpvt
'
))
{
let
index
=
element
.
lastIndexOf
(
"
=
"
);
Hm_lpvt
=
element
.
slice
(
0
,
index
)
Hm_lpvt
+=
`=
${
Math
.
round
(
new
Date
()
/
1000
)
-
86400
*
Math
.
ceil
(
Math
.
random
()
*
6
)}
,
${
Math
.
round
(
new
Date
()
/
1000
)
-
86400
*
Math
.
ceil
(
Math
.
random
()
*
3
)}
`
}
else
{
itc_center_user
=
element
;
}
});
//
}
cookie
=
(
itc_center_user
+
Hm_lvt
+
Hm_lpvt
).
replace
(
'
\n
'
,
''
);
console
.
log
(
`cookie=>
${
cookie
}
`
);
}
return
cookie
;
...
...
@@ -627,8 +635,10 @@ class Widget extends BaseWidget {
async
provideWidget
(
itemCount
,
small
=
false
)
{
const
defaultHotArr
=
this
.
defaultPreference
.
hotban
;
const
cacheHotStr
=
this
.
useFileManager
().
readStringCache
(
'
hotban
'
);
const
hotbanArr
=
cacheHotStr
?
JSON
.
parse
(
cacheHotStr
)
:
defaultHotArr
;
let
hotbanArr
=
cacheHotStr
?
JSON
.
parse
(
cacheHotStr
)
:
defaultHotArr
;
hotbanArr
=
hotbanArr
.
length
===
0
?
defaultHotArr
:
hotbanArr
;
const
index
=
this
.
carouselIndex
(
`HotbanRandom
${
this
.
defaultPreference
.
version
}
`
,
hotbanArr
.
length
);
console
.
log
(
`????>>>index=
${
index
}
, hotbanArr=
${
JSON
.
stringify
(
hotbanArr
)}
`
);
const
response
=
await
this
.
loadHotBanRES
(
hotbanArr
[
index
].
link
);
// 数据
const
{
hotTitle
=
''
,
logoUrl
=
''
,
linkArr
=
[],
titleArr
=
[]
}
=
response
;
...
...
_LSP.js
浏览文件 @
26799c50
...
...
@@ -1055,6 +1055,9 @@ class BaseWidget {
}
carouselIndex
=
(
cacheKey
,
size
)
=>
{
if
(
size
<=
0
)
{
return
0
;
}
let
index
=
-
1
;
if
(
Keychain
.
contains
(
cacheKey
))
{
let
cacheString
=
this
.
keyGet
(
cacheKey
);
...
...
今日事项.js
浏览文件 @
26799c50
...
...
@@ -131,7 +131,7 @@ class Widget extends BaseWidget {
textSpan
.
lineLimit
=
1
;
// ------------
leftStack
.
addSpacer
(
4
);
textSpan
=
leftStack
.
addText
(
`完成率:
${
Math
.
floor
((
finishedCount
/
totalCount
)
*
100
)
}
%`
);
textSpan
=
leftStack
.
addText
(
`完成率:
${
totalCount
>
0
?
Math
.
floor
((
finishedCount
/
totalCount
)
*
100
)
:
0
}
%`
);
textSpan
.
textColor
=
leftTextColor
;
textSpan
.
font
=
leftTextFont
;
textSpan
.
lineLimit
=
1
;
...
...
@@ -171,11 +171,11 @@ class Widget extends BaseWidget {
}
rdStack
.
backgroundColor
=
new
Color
(
`
${
rd
.
color
}
`
,
alpha
);
rdStack
.
cornerRadius
=
4
;
textSpan
=
rdStack
.
addText
(
`@
${
rd
.
title
}
`
)
textSpan
=
rdStack
.
addText
(
`@
${
rd
.
title
}
`
)
textSpan
.
textColor
=
new
Color
(
`
${
rd
.
color
}
`
,
0.8
);
let
fontSize
=
13
;
if
(
rd
.
title
.
length
>=
1
4
)
{
fontSize
=
1
1
;
if
(
rd
.
title
.
length
>=
1
3
)
{
fontSize
=
1
2
;
}
textSpan
.
font
=
Font
.
semiboldSystemFont
(
fontSize
);
textSpan
.
lineLimit
=
1
;
...
...
@@ -200,7 +200,12 @@ class Widget extends BaseWidget {
// calendar.color.hex
const
calendar
=
await
Calendar
.
forReminders
();
const
originalRdList
=
await
Reminder
.
all
(
calendar
);
const
filterList
=
originalRdList
.
filter
(
item
=>
(
item
.
dueDate
?
this
.
getDateStr
(
item
.
dueDate
,
'
yyyy-MM-dd
'
)
:
''
)
==
this
.
getDateStr
(
new
Date
(),
'
yyyy-MM-dd
'
));
const
filterList
=
originalRdList
.
filter
(
item
=>
{
const
{
isCompleted
,
dueDate
}
=
item
;
const
date
=
item
.
dueDate
?
this
.
getDateStr
(
item
.
dueDate
,
'
yyyy-MM-dd
'
)
:
''
;
const
currDate
=
this
.
getDateStr
(
new
Date
(),
'
yyyy-MM-dd
'
)
return
date
==
currDate
||
(
!
isCompleted
&&
date
<
currDate
);
});
const
reminderList
=
filterList
.
map
(
item
=>
({
title
:
item
.
title
,
notes
:
item
.
notes
,
...
...
@@ -211,7 +216,7 @@ class Widget extends BaseWidget {
calendar
:
item
.
calendar
}));
const
unfinishedList
=
reminderList
.
filter
(
reminder
=>
!
reminder
.
isCompleted
);
unfinishedList
.
sort
(
function
(
a
,
b
)
{
return
a
.
priority
-
b
.
priority
});
unfinishedList
.
sort
(
function
(
a
,
b
)
{
return
(
a
.
isOverdue
||
b
.
isOverdue
)
?
1
:
(
a
.
priority
-
b
.
priority
)
});
const
finishedList
=
reminderList
.
filter
(
reminder
=>
reminder
.
isCompleted
);
return
{
finishedList
,
unfinishedList
};
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录