diff options
author | Unknwon <u@gogs.io> | 2015-08-21 00:18:30 +0800 |
---|---|---|
committer | Unknwon <u@gogs.io> | 2015-08-21 00:18:30 +0800 |
commit | 4275b3720a04ccbca99907e800a55ab9df9fdcf6 (patch) | |
tree | 34e79fcd8e4ca061dd3e6a36a21ab7533f37659a /public/js | |
parent | aa65761d81d3f33bdfee578c14bb2b0c7a6ca639 (diff) | |
download | gitea-4275b3720a04ccbca99907e800a55ab9df9fdcf6.tar.gz gitea-4275b3720a04ccbca99907e800a55ab9df9fdcf6.zip |
finsih diff and compare
Diffstat (limited to 'public/js')
-rw-r--r-- | public/js/gogs.js | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/public/js/gogs.js b/public/js/gogs.js index 98b1e336fd..2193101de5 100644 --- a/public/js/gogs.js +++ b/public/js/gogs.js @@ -339,6 +339,25 @@ function initRepository() { }) } + // Diff + if ($('.repository.diff').length > 0) { + $('.diff-detail-box .toggle.button').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 + "%"); + }); + } + // Pull request if ($('.repository.compare.pull').length > 0) { var $branch_dropdown = $('.choose.branch .dropdown') |