diff options
Diffstat (limited to 'public/ng/js/gogs.js')
-rw-r--r-- | public/ng/js/gogs.js | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/public/ng/js/gogs.js b/public/ng/js/gogs.js index b3749ca0dd..10bf20f0fc 100644 --- a/public/ng/js/gogs.js +++ b/public/ng/js/gogs.js @@ -403,6 +403,16 @@ function initRepo() { $clone_btn.tipsy({ fade: true }); + + // Markdown preview. + $('.markdown-preview').click(function() { + var $this = $(this); + $this.toggleAjax(function (resp) { + $($this.data("preview")).html(resp); + }, function () { + $($this.data("preview")).html("no content"); + }) + }); } // when user changes hook type, hide/show proper divs @@ -423,6 +433,13 @@ function initHookTypeChange() { }); } +function initRepoRelease() { + $('#release-new-target-branch-list li').click(function() { + $('#repo-branch-current').text($(this).text()); + $('#tag-target').val($(this).text()); + }) +} + function initRepoSetting() { // Options. // Confirmation of changing repository name. @@ -753,8 +770,12 @@ $(document).ready(function () { initRepoCreate(); } if ($('#repo-header').length) { + initTimeSwitch(); initRepo(); } + if ($('#release').length) { + initRepoRelease(); + } if ($('#repo-setting').length) { initRepoSetting(); } @@ -819,3 +840,7 @@ function homepage() { $('#promo-form').attr('action', Gogs.AppSubUrl + '/user/sign_up'); }); } + +String.prototype.endsWith = function (suffix) { + return this.indexOf(suffix, this.length - suffix.length) !== -1; +}; |