forked from shosetsuorg/extensions
-
Notifications
You must be signed in to change notification settings - Fork 0
/
DefaultStructure.lua
74 lines (64 loc) · 1.8 KB
/
DefaultStructure.lua
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
-- {"id":-1,"ver":"1.0.0","libVer":"1.0.0","author":"","repo":"","dep":["foo","bar"]}
local baseURL = "TODO"
local settings = {}
--- @param chapterURL string
--- @return string
local function getPassage(chapterURL)
return ""
end
--- @param novelURL string
--- @return NovelInfo
local function parseNovel(novelURL)
return NovelInfo()
end
--- @param filters table @of applied filter values [QUERY] is the search query, may be empty
--- @param reporter fun(v : string | any)
--- @return Novel[]
local function search(filters, reporter)
return {}
end
return {
id = -1,
name = "DEFAULT",
baseURL = baseURL,
-- Optional values to change
imageURL = "",
hasCloudFlare = false,
hasSearch = true,
-- Must have at least one value
listings = {
Listing("Something", false, function(data)
return {}
end),
Listing("Something (with pages!)", true, function(data, index)
return {}
end),
Listing("Something without anything", false, function()
return {}
end)
},
-- Optional if usable
searchFilters = {
TextFilter(1, "RANDOM STRING INPUT"),
SwitchFilter(2, "RANDOM SWITCH INPUT"),
CheckboxFilter(3, "RANDOM CHECKBOX INPUT"),
TriStateFilter(4, "RANDOM TRISTATE CHECKBOX INPUT"),
RadioGroupFilter(5, "RANDOM RGROUP INPUT", { "A","B","C" }),
DropdownFilter(6, "RANDOM DDOWN INPUT", { "A","B","C" })
},
settings = {
TextFilter(1, "RANDOM STRING INPUT"),
SwitchFilter(2, "RANDOM SWITCH INPUT"),
CheckboxFilter(3, "RANDOM CHECKBOX INPUT"),
TriStateFilter(4, "RANDOM TRISTATE CHECKBOX INPUT"),
RadioGroupFilter(5, "RANDOM RGROUP INPUT", { "A","B","C" }),
DropdownFilter(6, "RANDOM DDOWN INPUT", { "A","B","C" })
},
-- Default functions that have to be set
getPassage = getPassage,
parseNovel = parseNovel,
search = search,
updateSetting = function(id, value)
settings[id] = value
end
}