Skip to content

Commit aa90e64

Browse files
committed
Fix <script> tag for embedding
1 parent feaf364 commit aa90e64

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

Diff for: src/main/twirl/gitbucket/gist/menu.scala.html

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
@(active: String,
22
gist: gitbucket.gist.model.Gist,
33
repositoryUrl: gitbucket.gist.util.GistUtils.GistRepositoryURL)(implicit context: gitbucket.core.controller.Context)
4-
@import gitbucket.core.view.helpers
5-
@embedScript=@{"<script>"+repositoryUrl.embedUrl+"</script>"}
64
@menuitem(name: String, path: String, label: String, count: Int = 0) = {
75
<li @if(active == name){class="active"}>
86
<a href="@context.path/gist/@path">
@@ -74,15 +72,18 @@
7472
<script>
7573
$(function(){
7674
$('#repository-url-embed').click(function(){
77-
$('#repository-url').val('@embedScript'.replace(/&lt;/g,"<").replace(/&gt;/g,">"));
75+
$('#repository-url-proto').text('Embed');
76+
$('#repository-url').val('<script src="@repositoryUrl.embedUrl\"><\/script>');
7877
$('#repository-url-copy').attr('data-clipboard-text', $('#repository-url').val());
7978
});
8079
$('#repository-url-http').click(function(){
80+
$('#repository-url-proto').text('HTTP');
8181
$('#repository-url').val('@repositoryUrl.httpUrl');
8282
$('#repository-url-copy').attr('data-clipboard-text', $('#repository-url').val());
8383
});
8484
@if(context.settings.ssh && context.loginAccount.isDefined){
8585
$('#repository-url-ssh').click(function(){
86+
$('#repository-url-proto').text('SSH');
8687
$('#repository-url').val('@repositoryUrl.sshUrl(context.loginAccount.get.userName)');
8788
$('#repository-url-copy').attr('data-clipboard-text', $('#repository-url').val());
8889
});

0 commit comments

Comments
 (0)