aboutsummaryrefslogtreecommitdiffstats
path: root/ui-shared.c
diff options
context:
space:
mode:
authorAndy Green <andy@warmcat.com>2018-06-23 18:25:53 +0800
committerChristian Hesse <mail@eworm.de>2020-01-13 21:12:37 +0100
commit58bf23c66327bcb5479142ce56c49327bb354678 (patch)
tree7a27d69b82ca8c981a1a43f64e8fbef0e0352401 /ui-shared.c
parentcss: change to be a list (diff)
downloadcgit-58bf23c66327bcb5479142ce56c49327bb354678.tar.xz
cgit-58bf23c66327bcb5479142ce56c49327bb354678.zip
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.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/ui-shared.c b/ui-shared.c
index 8b378c9..3513e10 100644
--- a/ui-shared.c
+++ b/ui-shared.c
@@ -779,6 +779,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();
@@ -804,6 +813,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);