Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
enoyee
Scriptable
提交
384fc168
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,发现更多精彩内容 >>
提交
384fc168
编写于
12月 15, 2022
作者:
AndroidLeaves
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update
上级
240bbe1e
变更
5
展开全部
隐藏空白更改
内联
并排
Showing
5 changed file
with
795 addition
and
192 deletion
+795
-192
TopHub榜单.js
TopHub榜单.js
+44
-35
_LSP.js
_LSP.js
+2
-2
test.js
test.js
+740
-146
今日事项.js
今日事项.js
+1
-1
桌面启动.js
桌面启动.js
+8
-8
未找到文件。
TopHub榜单.js
浏览文件 @
384fc168
...
...
@@ -3,11 +3,11 @@
// icon-color: red; icon-glyph: user-astronaut;
/**
* Author:LSP
* Date:2022-12-1
3
* Date:2022-12-1
5
*/
// -------------------------------------------------------
// 是否是开发环境,配合手机端调试使用,正式发布设置为false
const
isDev
=
fals
e
;
const
isDev
=
tru
e
;
console
.
log
(
`开发环境 👉👉👉👉👉
${
isDev
?
'
DEV
'
:
'
RELEASE
'
}
`
);
console
.
log
(
`----------------------------------------`
);
const
remoteRoot
=
'
https://gitcode.net/enoyee/scriptable/-/raw/master/
'
;
...
...
@@ -27,7 +27,7 @@ const { BaseWidget } = require(dependencyFileName);
class
Widget
extends
BaseWidget
{
defaultPreference
=
{
version
:
2022121
3
_3
,
version
:
2022121
5
,
domain
:
'
https://tophub.today
'
,
hotban
:
[{
title
:
'
微博 · 热搜榜
'
,
link
:
'
https://tophub.today/n/KqndgxeLl9
'
}],
weiboOpenOptions
:
[
...
...
@@ -50,35 +50,32 @@ class Widget extends BaseWidget {
largeItemCount
:
13
};
async
getCookie
()
{
getCookie
()
{
let
cookie
=
''
;
const
{
hotbanCK
}
=
this
.
readWidgetSetting
();
if
(
hotbanCK
?.
length
>
0
)
{
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
.
indexOf
(
'
Hm_lvt
'
)
!=
-
1
)
{
let
index
=
element
.
lastIndexOf
(
"
=
"
);
Hm_lvt
=
element
.
slice
(
0
,
index
-
1
)
Hm_lvt
+=
`=
${
Math
.
round
(
new
Date
()
/
1000
)}
`
}
else
if
(
element
.
indexOf
(
'
Hm_lpvt
'
)
!=
-
1
)
{
let
index
=
element
.
lastIndexOf
(
"
=
"
);
Hm_lpvt
=
element
.
slice
(
0
,
index
-
1
)
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
if
(
element
.
startsWith
(
'
itc_center_user
'
))
{
itc_center_user
=
element
;
}
});
//
cookie
=
(
itc_center_user
+
"
;
"
+
Hm_lvt
+
"
;
"
+
Hm_lpvt
);
}
let
itc_center_user
;
let
Hm_lvt
;
let
Hm_lpvt
;
//
hotbanCKArr
.
forEach
(
element
=>
{
if
(
element
.
indexOf
(
'
Hm_lvt
'
)
!=
-
1
)
{
let
index
=
element
.
lastIndexOf
(
"
=
"
);
Hm_lvt
=
element
.
slice
(
0
,
index
-
1
)
Hm_lvt
+=
`=
${
Math
.
round
(
new
Date
()
/
1000
)}
`
}
else
if
(
element
.
indexOf
(
'
Hm_lpvt
'
)
!=
-
1
)
{
let
index
=
element
.
lastIndexOf
(
"
=
"
);
Hm_lpvt
=
element
.
slice
(
0
,
index
-
1
)
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
if
(
element
.
startsWith
(
'
itc_center_user
'
))
{
itc_center_user
=
element
;
}
});
//
cookie
=
(
itc_center_user
+
"
;
"
+
Hm_lvt
+
"
;
"
+
Hm_lpvt
);
}
console
.
log
(
`cookie-->
${
cookie
}
`
);
return
cookie
;
}
...
...
@@ -91,6 +88,10 @@ class Widget extends BaseWidget {
getContentLineSpacing
=
()
=>
Number
(
this
.
getSettingValueByKey
(
'
contentLineSpacing
'
,
`
${
this
.
defaultPreference
.
contentLineSpacing
}
`
));
getNormalItemCount
=
()
=>
Number
(
this
.
getSettingValueByKey
(
'
normalItemCount
'
,
`
${
this
.
defaultPreference
.
normalItemCount
}
`
));
getLargeItemCount
=
()
=>
Number
(
this
.
getSettingValueByKey
(
'
largeItemCount
'
,
`
${
this
.
defaultPreference
.
largeItemCount
}
`
));
getCKDesc
=
()
=>
{
let
hasCK
=
this
.
getCookie
()?.
length
>
0
;
return
hasCK
?
'
已设置
'
:
'
未设置
'
};
constructor
(
scriptName
)
{
super
(
scriptName
);
...
...
@@ -317,7 +318,7 @@ class Widget extends BaseWidget {
name
:
'
weiboOpenType
'
,
label
:
'
微博打开方式
'
,
type
:
'
cell
'
,
icon
:
'
https://
s3.uuu.ovh/imgs/2022/12/10/b868456095655916
.png
'
,
icon
:
'
https://
gitcode.net/enoyee/scriptable/-/raw/master/img/ic_weibo
.png
'
,
needLoading
:
false
,
default
:
this
.
getWeiboOpenType
(),
},
...
...
@@ -343,7 +344,7 @@ class Widget extends BaseWidget {
}
]
},
showDesc
:
false
,
desc
:
this
.
getCKDesc
()
},
{
name
:
'
titleFontSize
'
,
...
...
@@ -706,6 +707,16 @@ class Widget extends BaseWidget {
}
// --------------------------NET START--------------------------
async
loadHTML
(
url
)
{
let
req
=
new
Request
(
url
);
req
.
headers
=
{
"
cookie
"
:
this
.
getCookie
(),
"
user-agent
"
:
"
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36
"
,
};
let
html
=
await
req
.
loadString
();
return
html
.
replace
(
/
(\r\n
|
\n
|
\r)
/gm
,
""
);
}
async
loadHotBanRES
(
link
)
{
// 热榜数据
let
response
=
undefined
;
...
...
@@ -723,12 +734,11 @@ class Widget extends BaseWidget {
const
shouldLoadCache
=
timeInterval
<=
Number
(
refreshInterval
)
&&
canUseCache
;
let
html
=
ufm
.
readStringCache
(
cacheFileName
);
if
(
!
shouldLoadCache
)
{
console
.
log
(
`-->>在线加载网页数据`
);
await
webview
.
loadURL
(
link
);
html
=
await
webview
.
getHTML
();
console
.
log
(
`-->>在线加载网页数据:
${
link
}
`
);
html
=
await
this
.
loadHTML
(
link
);
ufm
.
writeStringCache
(
cacheFileName
,
html
);
}
else
{
console
.
log
(
`-->>加载缓存网页数据`
);
console
.
log
(
`-->>加载缓存网页数据
:
${
link
}
`
);
}
await
webview
.
loadHTML
(
html
);
// 通过dom操作把HTML里面的热榜内容提取出来
...
...
@@ -901,4 +911,4 @@ async function downloadFile2Scriptable(moduleName, url) {
};
// =================================================================================
// =================================================================================
\ No newline at end of file
// =================================================================================
_LSP.js
浏览文件 @
384fc168
...
...
@@ -8,7 +8,7 @@
*/
// 当前环境版本号
const
VERSION
=
2022121
2
const
VERSION
=
2022121
4
// 组件配置文件名
const
settingConfigName
=
'
settings.json
'
;
// 组件默认配置
...
...
@@ -2132,7 +2132,7 @@ class BaseWidget {
const formData = {};
const fragment = document.createDocumentFragment()
for (const item of settingItems) {
const value = settings[item.name] ?? item.default ?? null
const value =
item.desc ??
settings[item.name] ?? item.default ?? null
if(value && item.type != 'cell') {
formData[item.name] = value;
}
...
...
test.js
浏览文件 @
384fc168
此差异已折叠。
点击以展开。
今日事项.js
浏览文件 @
384fc168
...
...
@@ -214,7 +214,7 @@ class Widget extends BaseWidget {
const
calendar
=
await
Calendar
.
forReminders
();
const
originalRdList
=
await
Reminder
.
all
(
calendar
);
const
filterList
=
originalRdList
.
filter
(
item
=>
{
const
{
isCompleted
,
dueDate
}
=
item
;
const
{
isCompleted
}
=
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
);
...
...
桌面启动.js
浏览文件 @
384fc168
...
...
@@ -3,7 +3,7 @@
// icon-color: red; icon-glyph: user-astronaut;
/**
* Author:LSP
* Date:2022-12-1
0
* Date:2022-12-1
5
*/
// -------------------------------------------------------
// 是否是开发环境,配合手机端调试使用,正式发布设置为false
...
...
@@ -97,7 +97,7 @@ class Widget extends BaseWidget {
name
:
'
caiyun
'
,
label
:
'
彩云key
'
,
type
:
'
cell
'
,
icon
:
'
https://
s3.uuu.ovh/imgs/2022/12/05/a95f9edce36891d9
.gif
'
,
icon
:
'
https://
gitcode.net/enoyee/scriptable/-/raw/master/img/ic_weather_loop
.gif
'
,
alert
:
{
title
:
'
彩云key
'
,
message
:
"
外部已使用默认key
\\
n如果不可用了需要自己去申请填入替换
"
,
...
...
@@ -206,7 +206,7 @@ class Widget extends BaseWidget {
name
:
'
dateFontSize
'
,
label
:
'
日期文字大小
'
,
type
:
'
cell
'
,
icon
:
'
https://
s3.uuu.ovh/imgs/2022/12/05/ac2c5b8843ff2719
.gif
'
,
icon
:
'
https://
gitcode.net/enoyee/scriptable/-/raw/master/img/ic_calendar
.gif
'
,
needLoading
:
false
,
alert
:
{
title
:
'
日期文字大小
'
,
...
...
@@ -223,7 +223,7 @@ class Widget extends BaseWidget {
name
:
'
dateFontColor
'
,
label
:
'
日期文字颜色
'
,
type
:
'
color
'
,
icon
:
'
https://
s3.uuu.ovh/imgs/2022/12/05/ac2c5b8843ff2719
.gif
'
,
icon
:
'
https://
gitcode.net/enoyee/scriptable/-/raw/master/img/ic_calendar
.gif
'
,
needLoading
:
false
,
default
:
this
.
dateFontColor
(),
},
...
...
@@ -231,7 +231,7 @@ class Widget extends BaseWidget {
name
:
'
weatherFontSize
'
,
label
:
'
天气文字大小
'
,
type
:
'
cell
'
,
icon
:
'
https://
s3.uuu.ovh/imgs/2022/12/05/a95f9edce36891d9
.gif
'
,
icon
:
'
https://
gitcode.net/enoyee/scriptable/-/raw/master/img/ic_weather_loop
.gif
'
,
needLoading
:
false
,
alert
:
{
title
:
'
天气文字大小
'
,
...
...
@@ -248,7 +248,7 @@ class Widget extends BaseWidget {
name
:
'
weatherFontColor
'
,
label
:
'
天气文字颜色
'
,
type
:
'
color
'
,
icon
:
'
https://
s3.uuu.ovh/imgs/2022/12/05/a95f9edce36891d9
.gif
'
,
icon
:
'
https://
gitcode.net/enoyee/scriptable/-/raw/master/img/ic_weather_loop
.gif
'
,
needLoading
:
false
,
default
:
this
.
weatherFontColor
(),
},
...
...
@@ -256,7 +256,7 @@ class Widget extends BaseWidget {
name
:
'
covFontSize
'
,
label
:
'
疫情文字大小
'
,
type
:
'
cell
'
,
icon
:
'
https://
s3.uuu.ovh/imgs/2022/12/05/2cd3dee47cd0824f
.png
'
,
icon
:
'
https://
gitcode.net/enoyee/scriptable/-/raw/master/img/ic_corona_virus
.png
'
,
needLoading
:
false
,
alert
:
{
title
:
'
疫情文字大小
'
,
...
...
@@ -273,7 +273,7 @@ class Widget extends BaseWidget {
name
:
'
covFontColor
'
,
label
:
'
疫情文字颜色
'
,
type
:
'
color
'
,
icon
:
'
https://
s3.uuu.ovh/imgs/2022/12/05/2cd3dee47cd0824f
.png
'
,
icon
:
'
https://
gitcode.net/enoyee/scriptable/-/raw/master/img/ic_corona_virus
.png
'
,
needLoading
:
false
,
default
:
this
.
covFontColor
(),
},
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录