-
Notifications
You must be signed in to change notification settings - Fork 6
/
_template_.toml
230 lines (200 loc) · 5.11 KB
/
_template_.toml
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
name = "<name>"
# 唯一标识符
key = "<key>"
version = "1.0.0"
minAppVersion = "3.0.0"
url = "https://raw.githubusercontent.com/wgh136/pica_configs/master/<fileName>"
# 启动时执行的js代码
init = """
function init(){
// init
}
"""
[account]
[account.login]
js = """
async function login(account, pwd){
try {
// 请使用`success`和`error`方法返回结果
}
catch(e) {
error(e.toString())
}
}
"""
[account.logout]
# 列出需要清除的数据
# 列出需要清除cookies的域名
cookies = []
# 列出使用`setData`方法储存的数据的key
data = []
[account.register]
website = "<url>" # 在登录页面显示一个注册按钮, 点击后在浏览器打开此网页
[explore]
[[explore.pages]]
# title同时会被作为分类页面的key, 请确保其唯一性
title = "<pageName>"
type = "singlePageWithMultiPart" # "multiPageComicList"或者"singlePageWithMultiPart"
loadMultiPart = """
async function loadMultiPart(){
try{
// 请使用`success`和`error`方法返回结果
}
catch (e){
error(e.toString())
}
}
"""
[[explore.pages]]
# title同时会被作为分类页面的key, 请确保其唯一性
title = "<pageName>"
type = "multiPageComicList" # "multiPageComicList"或者"singlePageWithMultiPart"
loadMultiPart = """
async function loadPage(){
try{
// 请使用`success`和`error`方法返回结果
// success({
// maxPage = ?,
// comics = []
//})
}
catch (e){
error(e.toString())
}
}
"""
[category]
# title同时会被作为分类页面的key, 请确保其唯一性
title = "<title>"
enableRankingPage = false
[[category.parts]]
name = "<name>"
type = "fixed" # "fixed"或者"random". 如果为random, 需要设置字段`randomNumber`, 将在提供的标签中随机显示指定的数量
categories = []
itemType = "category" # 仅接受"category"或者"search", 或者"search_with_namespace", 用户点击时, 如果为category, 将进入定义的分类页面, 如果为search, 将进入搜索页面, 如果为search_with_namespace, 将会使用此部分的name作为namespace.
[[category.parts]]
name = "<name>"
type = "fixed"
categories = []
itemType = "category"
# categoryParams用于提供分类页面的参数,
# 如果提供该字段, 其长度必须与categories相等,
# 加载分类页面的函数的参数中的param将不为null
categoryParams = []
[categoryComics]
load = """
async function load(category, param, options, page){
try{
// 请使用`success`和`error`方法返回结果
//success({
// comics: [],
// maxPage: ?
//})
}
catch (e){
error(e.toString())
}
}
"""
[[categoryComics.options]]
# content 用于提供分类页面的选项, 按照如下格式, 使用`-`分割, 左侧为加载使用的参数, 右侧为显示在屏幕上的选项文字
content = """
1-选项1
2-选项2
3-选项3
"""
# notShowWhen提供一个列表, 当分类页面的名称为列表中的任意一个时, 将不会显示此选项
notShowWhen = ["a", "b", "c"]
[[categoryComics.options]]
content = """
1-选项1
2-选项2
3-选项3
"""
notShowWhen = ["a", "b", "c"]
[search]
load = """
async function load(keyword, options, page){
try{
// 请使用`success`和`error`方法返回结果
// success({
// comics: [],
// maxPage: ?
// })
}
catch (e){
error(e.toString())
}
}
"""
[favorite]
multiFolder = false
addOrDelFavorite = """
async function addOrDelFavorite(comicId, folderId, isAdding){
if(isAdding){
// 添加收藏
} else {
// 删除收藏
}
}
"""
loadComics = """
async function loadComics(page, folder){
try{
// 请使用`success`和`error`方法返回结果
// success({
// comics: comics,
// maxPage: maxPage
// })
}
catch (e){
error(e.toString())
}
}
"""
[comic]
loadInfo = """
async function loadInfo(id){
try{
// success({
// title: title,
// cover: cover,
// description: description,
// tags: {
// "作者": [author],
// "更新": [updateTime],
// "标签": tags
// },
// chapters: eps,
// subId: subId, # subId是一个可选项, 表示此漫画的另一个标识符, 如果存在, 将会在加载章节时传递给loadEp函数
// suggestions: comics
// })
}
catch (e){
error(e.toString())
}
}
"""
loadEp = """
async function loadEp(comicId, epId){
try{
// success({
// images: document.querySelectorAll("img.lazy").map(e => e.attributes["data-src"])
// })
}
catch (e){
error(e.toString())
}
}
"""
loadComments = """
async function loadComments(comicId, subId, page, replyTo){
}
"""
sendComment = """
async function sendComment(comicId, subId, content, replyTo){
}
"""
# 适用于漫画的id是url时, 提取标识符用于漫画储存的正则表达式
# 此标识符将用于储存漫画的文件夹名
matchBriefIdRegex = "https://example.com/book/(\\d+)/"