diff options
Diffstat (limited to 'ui-shared.c')
-rw-r--r-- | ui-shared.c | 17 |
1 files changed, 17 insertions, 0 deletions
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) | |||
780 | return 0; | 780 | return 0; |
781 | } | 781 | } |
782 | 782 | ||
783 | static int emit_js_link(struct string_list_item *s, void *arg) | ||
784 | { | ||
785 | html("<script type='text/javascript' src='"); | ||
786 | if (s) | ||
787 | html_attr(s->string); | ||
788 | else | ||
789 | html_attr((const char *)arg); | ||
790 | html("'></script>\n"); | ||
791 | |||
792 | return 0; | ||
793 | } | ||
794 | |||
783 | void cgit_print_docstart(void) | 795 | void cgit_print_docstart(void) |
784 | { | 796 | { |
785 | char *host = cgit_hosturl(); | 797 | char *host = cgit_hosturl(); |
@@ -805,6 +817,11 @@ void cgit_print_docstart(void) | |||
805 | else | 817 | else |
806 | emit_css_link(NULL, "/cgit.css"); | 818 | emit_css_link(NULL, "/cgit.css"); |
807 | 819 | ||
820 | if (ctx.cfg.js.items) | ||
821 | for_each_string_list(&ctx.cfg.js, emit_js_link, NULL); | ||
822 | else | ||
823 | emit_js_link(NULL, "/cgit.js"); | ||
824 | |||
808 | if (ctx.cfg.favicon) { | 825 | if (ctx.cfg.favicon) { |
809 | html("<link rel='shortcut icon' href='"); | 826 | html("<link rel='shortcut icon' href='"); |
810 | html_attr(ctx.cfg.favicon); | 827 | html_attr(ctx.cfg.favicon); |