diff options
| author | Yigit Sever | 2021-10-29 17:20:51 +0300 |
|---|---|---|
| committer | Yigit Sever | 2021-10-29 17:20:51 +0300 |
| commit | 761f5e3f6a953fadc60238b2fd7f838b30290482 (patch) | |
| tree | 589987d2276d6ac381fb0543fe813aeabb671d8b | |
| parent | 0f85ea8cc84a11f54516908e97ae485c7361cc99 (diff) | |
| download | cgit-761f5e3f6a953fadc60238b2fd7f838b30290482.tar.gz cgit-761f5e3f6a953fadc60238b2fd7f838b30290482.tar.bz2 cgit-761f5e3f6a953fadc60238b2fd7f838b30290482.zip | |
include javascript once
| -rw-r--r-- | ui-summary.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/ui-summary.c b/ui-summary.c index 1b65462..f3b3d92 100644 --- a/ui-summary.c +++ b/ui-summary.c | |||
| @@ -29,9 +29,12 @@ static void print_url(const char *url) | |||
| 29 | if (urls++ == 0) { | 29 | if (urls++ == 0) { |
| 30 | htmlf("<tr class='nohover'><td colspan='%d'> </td></tr>", columns); | 30 | htmlf("<tr class='nohover'><td colspan='%d'> </td></tr>", columns); |
| 31 | htmlf("<tr class='nohover'><th class='left' colspan='%d'>clone</th></tr>\n", columns); | 31 | htmlf("<tr class='nohover'><th class='left' colspan='%d'>clone</th></tr>\n", columns); |
| 32 | html("<script type='text/javascript' src='https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js'></script>"); | ||
| 33 | html("<script>\n"); | ||
| 34 | html("$(document).ready(function() { $('.copy').click(function(e) { var tmp = $('<input>'); $('body').append(tmp); tmp.val($(this).text()).select(); document.execCommand('copy'); tmp.remove(); e.preventDefault(); }); });\n"); | ||
| 35 | html("</script>"); | ||
| 32 | } | 36 | } |
| 33 | 37 | ||
| 34 | html("<script type='text/javascript' src='https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js'></script>"); | ||
| 35 | htmlf("<tr><td colspan='%d'><a class='copy' rel='vcs-git' href='", columns); | 38 | htmlf("<tr><td colspan='%d'><a class='copy' rel='vcs-git' href='", columns); |
| 36 | html_url_path(url); | 39 | html_url_path(url); |
| 37 | html("' title='"); | 40 | html("' title='"); |
| @@ -39,9 +42,6 @@ static void print_url(const char *url) | |||
| 39 | html(" git repository'>"); | 42 | html(" git repository'>"); |
| 40 | html_txt(url); | 43 | html_txt(url); |
| 41 | html("</a><span class='hint'> (click to copy)</span></td></tr>\n"); | 44 | html("</a><span class='hint'> (click to copy)</span></td></tr>\n"); |
| 42 | html("<script>\n"); | ||
| 43 | html("$(document).ready(function() { $('.copy').click(function(e) { var tmp = $('<input>'); $('body').append(tmp); tmp.val($(this).text()).select(); document.execCommand('copy'); tmp.remove(); e.preventDefault(); }); });\n"); | ||
| 44 | html("</script>"); | ||
| 45 | } | 45 | } |
| 46 | 46 | ||
| 47 | void cgit_print_summary(void) | 47 | void cgit_print_summary(void) |
