diff options
Diffstat (limited to 'public/js')
-rw-r--r-- | public/js/gogs.js | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/public/js/gogs.js b/public/js/gogs.js index d835fa052f..f297191a90 100644 --- a/public/js/gogs.js +++ b/public/js/gogs.js @@ -384,16 +384,15 @@ function initRepository() { // Diff if ($('.repository.diff').length > 0) { var $counter = $('.diff-counter'); - if ($counter.length < 1) { - return; + if ($counter.length >= 1) { + $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 + "%"); + }); } - $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 + "%"); - }); } // Quick start @@ -419,6 +418,7 @@ function initRepository() { fullTextSearch: true, onChange: function (text, value, $choice) { window.location.href = $choice.data('url'); + console.log($choice.data('url')) }, message: {noResults: $branch_dropdown.data('no-results')} }); |