diff options
Diffstat (limited to 'public')
-rw-r--r-- | public/ng/css/gogs.css | 4 | ||||
-rw-r--r-- | public/ng/js/gogs.js | 37 | ||||
-rw-r--r-- | public/ng/less/gogs/repository.less | 4 |
3 files changed, 21 insertions, 24 deletions
diff --git a/public/ng/css/gogs.css b/public/ng/css/gogs.css index 9f6cf12f97..43931e94d3 100644 --- a/public/ng/css/gogs.css +++ b/public/ng/css/gogs.css @@ -1066,9 +1066,6 @@ The register and sign-in page style #repo-header-download-drop .btn > i { margin-right: 6px; } -#repo-header-download-drop input { - cursor: default; -} #repo-header-download-drop button, #repo-header-download-drop input { font-size: 11px; @@ -1089,6 +1086,7 @@ The register and sign-in page style border-right: none; width: 190px; border-left: none; + cursor: default; } #repo-clone-help { clear: both; diff --git a/public/ng/js/gogs.js b/public/ng/js/gogs.js index a6b9753e17..c5fd719c32 100644 --- a/public/ng/js/gogs.js +++ b/public/ng/js/gogs.js @@ -209,27 +209,28 @@ var Gogs = {}; $list.parents('tr').removeClass('end-selected-line'); $list.parents('tr').find('td').removeClass('selected-line'); if ($from) { - var expr = new RegExp(/diff-(\d+)L(\d+)/); + var expr = new RegExp(/diff-(\w+)([LR]\d+)/); var selectMatches = $select.attr('rel').match(expr) var fromMatches = $from.attr('rel').match(expr) - var a = parseInt(selectMatches[2]); - var b = parseInt(fromMatches[2]); - var linesIntToStr = {}; - linesIntToStr[a] = selectMatches[2]; - linesIntToStr[b] = fromMatches[2]; - - var c; - if (a != b) { - if (a > b) { - c = a; - a = b; - b = c; + var selectTop = $select.offset().top; + var fromTop = $from.offset().top; + var hash; + + if (selectMatches[2] != fromMatches[2]) { + if ((selectTop > fromTop)) { + $startElem = $from; + $endElem = $select; + hash = fromMatches[1]+fromMatches[2] + '-' + selectMatches[2]; + } else { + $startElem = $select; + $endElem = $from; + hash = selectMatches[1]+selectMatches[2] + '-' + fromMatches[2]; } - $('[rel=diff-'+fromMatches[1]+'L' + linesIntToStr[b] + ']').parents('tr').next().addClass('end-selected-line'); - var $selectedLines = $('[rel=diff-'+fromMatches[1]+'L' + linesIntToStr[a] + ']').parents('tr').nextUntil('.end-selected-line').andSelf(); + $endElem.parents('tr').next().addClass('end-selected-line'); + var $selectedLines = $startElem.parents('tr').nextUntil('.end-selected-line').andSelf(); $selectedLines.find('td.lines-num > span').addClass('active') $selectedLines.find('td').addClass('selected-line'); - $.changeHash('#diff-'+fromMatches[1]+'L' + linesIntToStr[a] + '-L' + linesIntToStr[b]); + $.changeHash('#diff-'+hash); return } } @@ -262,7 +263,7 @@ var Gogs = {}; }); $(window).on('hashchange', function (e) { - var m = window.location.hash.match(/^#diff-(\d+)(L\d+)\-(L\d+)$/); + var m = window.location.hash.match(/^#diff-(\w+)([LR]\d+)\-([LR]\d+)$/); var $list = $('.code-diff td.lines-num > span'); var $first; if (m) { @@ -271,7 +272,7 @@ var Gogs = {}; $("html, body").scrollTop($first.offset().top - 200); return; } - m = window.location.hash.match(/^#diff-(\d+)(L\d+)$/); + m = window.location.hash.match(/^#diff-(\w+)([LR]\d+)$/); if (m) { $first = $list.filter('[rel=diff-' + m[1] + m[2] + ']'); selectRange($list, $first); diff --git a/public/ng/less/gogs/repository.less b/public/ng/less/gogs/repository.less index d683d03341..63c25d06b6 100644 --- a/public/ng/less/gogs/repository.less +++ b/public/ng/less/gogs/repository.less @@ -81,9 +81,6 @@ .btn>i { margin-right: 6px; } - input { - cursor: default; - } button, input { font-size: 11px; } @@ -104,6 +101,7 @@ border-right: none; width: 190px; border-left: none; + cursor: default; } #repo-clone-help { clear: both; |