diff options
| author | Andy Green <andy@warmcat.com> | 2018-06-23 18:25:53 +0800 |
|---|---|---|
| committer | Christian Hesse <mail@eworm.de> | 2022-04-12 17:46:05 +0200 |
| commit | 71bf57e59d9c446388d4e0cd61c6eead380af3d2 (patch) | |
| tree | 0fb5624d315b8be0e7f4af15a88307621d0616c4 /ui-shared.c | |
| parent | c0f45d1ce4d54a7c279307a8b21b46fc4cf048ef (diff) | |
config: add js
Just like the config allows setting css URL path,
add a config for setting the js URL path
Setting the js path to an empty string disables
emitting the reference to it in the head section.
Signed-off-by: Andy Green <andy@warmcat.com>
Reviewed-by: John Keeping <john@keeping.me.uk>
Signed-off-by: Christian Hesse <mail@eworm.de>
Diffstat (limited to 'ui-shared.c')
| -rw-r--r-- | ui-shared.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/ui-shared.c b/ui-shared.c index f998912..e6def60 100644 --- a/ui-shared.c +++ b/ui-shared.c @@ -780,6 +780,15 @@ static int emit_css_link(struct string_list_item *s, void *arg) return 0; } +static int emit_js_link(struct string_list_item *s, void *arg) +{ + html("<script type='text/javascript' src='"); + html_attr(s->string); + html("'></script>\n"); + + return 0; +} + void cgit_print_docstart(void) { char *host = cgit_hosturl(); @@ -805,6 +814,8 @@ void cgit_print_docstart(void) else emit_css_link(NULL, "/cgit.css"); + for_each_string_list(&ctx.cfg.js, emit_js_link, NULL); + if (ctx.cfg.favicon) { html("<link rel='shortcut icon' href='"); html_attr(ctx.cfg.favicon); |
