mirror of
https://git.zx2c4.com/cgit
synced 2025-07-02 22:34:32 +02:00
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 <andy@warmcat.com> Reviewed-by: John Keeping <john@keeping.me.uk> Signed-off-by: Christian Hesse <mail@eworm.de>
This commit is contained in:
parent
093ac96970
commit
aee39b4e9a
6 changed files with 33 additions and 0 deletions
17
ui-shared.c
17
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("<script type='text/javascript' src='");
|
||||
if (s)
|
||||
html_attr(s->string);
|
||||
else
|
||||
html_attr((const char *)arg);
|
||||
html("'></script>\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("<link rel='shortcut icon' href='");
|
||||
html_attr(ctx.cfg.favicon);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue