diff options
author | evolvedlight <steve@evolvedlight.co.uk> | 2014-10-13 20:30:31 +0100 |
---|---|---|
committer | evolvedlight <steve@evolvedlight.co.uk> | 2014-10-13 20:30:31 +0100 |
commit | 8d2a6fc484b540819e211d52b8d54e97269f0918 (patch) | |
tree | e5bfe7d3937bb2d18ba2fb50ea72514bd5bb4e13 /public/ng/js/gogs.js | |
parent | 29ac3980ffdb5faa525d77fddc109c9023ebe257 (diff) | |
parent | 89bd994c836ecc9b6ceb80849f470521e1b15917 (diff) |
Merge remote-tracking branch 'upstream/dev'
Conflicts:
models/repo.go
Diffstat (limited to 'public/ng/js/gogs.js')
-rw-r--r-- | public/ng/js/gogs.js | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/public/ng/js/gogs.js b/public/ng/js/gogs.js index 4bcdc5c8..eba1744b 100644 --- a/public/ng/js/gogs.js +++ b/public/ng/js/gogs.js @@ -299,6 +299,9 @@ function initCore() { e.preventDefault(); $.magnificPopup.close(); }); + + // Collapse. + $('.collapse').hide(); } function initUserSetting() { @@ -698,6 +701,37 @@ function initProfile() { }); } +function initTimeSwitch() { + // Time switch. + $(".time-since[title]").on("click", function () { + var $this = $(this); + + var title = $this.attr("title"); + var text = $this.text(); + + $this.text(title); + $this.attr("title", text); + }); +} + +function initDiff() { + $('.diff-detail-box>a').click(function () { + $($(this).data('target')).slideToggle(100); + }) + + var $counter = $('.diff-counter'); + if ($counter.length < 1) { + return; + } + $counter.each(function (i, item) { + var $item = $(item); + var addLine = $item.find('span[data-line].add').data("line"); + var delLine = $item.find('span[data-line].del').data("line"); + var addPercent = parseFloat(addLine) / (parseFloat(addLine) + parseFloat(delLine)) * 100; + $item.find(".bar .add").css("width", addPercent + "%"); + }); +} + $(document).ready(function () { Gogs.AppSubUrl = $('head').data('suburl') || ''; initCore(); @@ -737,6 +771,10 @@ $(document).ready(function () { if ($('#user-profile-page').length) { initProfile(); } + if ($('#diff-page').length) { + initTimeSwitch(); + initDiff(); + } $('#dashboard-sidebar-menu').tabs(); $('#pull-issue-preview').markdown_preview(".issue-add-comment"); |