-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathmanifest_common.libsonnet
52 lines (50 loc) · 1.22 KB
/
manifest_common.libsonnet
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
local content_script = {
// Using std.prune() function to remove all "empty" members
new(matches, js, css, exclude_matches, run_at):: std.prune({
matches: matches,
js: js,
css: css,
run_at: run_at,
exclude_matches: exclude_matches,
}),
};
{
/**
* @name Extension name
* @keyword Omnibox keyword
* @description Extension description
* @version Extension version
*/
new(
name,
keyword,
description,
version,
):: {
_icons:: {},
name: name,
description: description,
version: version,
omnibox: {
keyword: keyword,
},
icons: self._icons,
permissions: [],
content_scripts: [],
addIcons(icons):: self + {
_icons+: icons,
},
setOptionsUi(page, open_in_tab=true):: self + {
[if std.length(page) > 0 then 'options_ui' else null]: {
page: page,
open_in_tab: open_in_tab,
},
},
addPermissions(permission):: self + {
permissions+: if std.isArray(permission) then permission else [permission],
},
addContentScript(matches, js, css, exclude_matches=[], run_at='document_start'):: self + {
content_scripts+: [content_script.new(matches, js, css, exclude_matches, run_at)],
},
},
}