From f762d291b01eeda27fa9239c99efd607d5bf7a14 Mon Sep 17 00:00:00 2001 From: Andy Green Date: Sat, 23 Jun 2018 18:25:53 +0800 Subject: config: add js Just like the config allows setting css URL path, add a config for setting the js URL path Signed-off-by: Andy Green Reviewed-by: John Keeping Signed-off-by: Christian Hesse --- ui-shared.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'ui-shared.c') diff --git a/ui-shared.c b/ui-shared.c index 1251c9a..bc76a6e 100644 --- a/ui-shared.c +++ b/ui-shared.c @@ -780,6 +780,18 @@ 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("\n"); + + return 0; +} + void cgit_print_docstart(void) { char *host = cgit_hosturl(); @@ -805,6 +817,11 @@ void cgit_print_docstart(void) else emit_css_link(NULL, "/cgit.css"); + if (ctx.cfg.js.items) + for_each_string_list(&ctx.cfg.js, emit_js_link, NULL); + else + emit_js_link(NULL, "/cgit.js"); + if (ctx.cfg.favicon) { html("