mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-05 04:56:02 +01:00
Fix broken blame
This commit is contained in:
@@ -104,6 +104,7 @@ $(window).load(function(){
|
||||
function updateSourceLineNum(){
|
||||
$('.source-line-num').remove();
|
||||
var pos = pre.find('ol.linenums').position();
|
||||
if(pos){
|
||||
$('<div class="source-line-num">').css({
|
||||
height : pre.height(),
|
||||
width : '48px',
|
||||
@@ -135,6 +136,7 @@ $(window).load(function(){
|
||||
}
|
||||
}).appendTo(pre);
|
||||
}
|
||||
}
|
||||
var repository = $('.blame-action').data('repository');
|
||||
$('.blame-action').click(function(e){
|
||||
if(history.pushState && $('pre.prettyprint.no-renderable').length){
|
||||
@@ -148,7 +150,7 @@ $(window).load(function(){
|
||||
var m = /^\/(blame|blob)(\/.*)$/.exec(location.href.substring(repository.length));
|
||||
var mode = m[1];
|
||||
$('.blame-action').toggleClass("active", mode=='blame').attr('href', repository + (m[1] == 'blame' ? '/blob' : '/blame') + m[2]);
|
||||
if(pre.parents("td").find(".blame").length){
|
||||
if(pre.parents("div.box-content-bottom").find(".blame").length){
|
||||
pre.parents("div.container").toggleClass("blame-container", mode == 'blame');
|
||||
updateSourceLineNum();
|
||||
return;
|
||||
@@ -159,7 +161,7 @@ $(window).load(function(){
|
||||
}
|
||||
$(document.body).toggleClass('no-box-shadow',document.body.style.boxShadow===undefined);
|
||||
$('.blame-action').addClass("active");
|
||||
var base = $('<div class="blame">').css({height:pre.height()}).prependTo(pre.parents("td")[0]);
|
||||
var base = $('<div class="blame">').css({height: pre.height()}).prependTo(pre.parents("div.box-content-bottom"));
|
||||
base.parents("div.container").addClass("blame-container");
|
||||
updateSourceLineNum();
|
||||
$.get($('.blame-action').data('url')).done(function(data){
|
||||
@@ -207,6 +209,8 @@ $(window).load(function(){
|
||||
updateBlame();
|
||||
});
|
||||
|
||||
var scrolling = false;
|
||||
|
||||
/**
|
||||
* Hightlight lines which are specified by URL hash.
|
||||
*/
|
||||
@@ -217,7 +221,7 @@ function updateHighlighting(){
|
||||
var lines = hash.substr(1).split('-');
|
||||
if(lines.length == 1){
|
||||
$('#' + lines[0]).addClass('highlight');
|
||||
if(!updateHighlighting.scrolling){
|
||||
if(!scrolling){
|
||||
$(window).scrollTop($('#' + lines[0]).offset().top - 40);
|
||||
}
|
||||
} else if(lines.length > 1){
|
||||
@@ -226,11 +230,11 @@ function updateHighlighting(){
|
||||
for(var i = start; i <= end; i++){
|
||||
$('#L' + i).addClass('highlight');
|
||||
}
|
||||
if(!updateHighlighting.scrolling){
|
||||
if(!scrolling){
|
||||
$(window).scrollTop($('#L' + start).offset().top - 40);
|
||||
}
|
||||
}
|
||||
updateHighlighting.scrolling = true;
|
||||
scrolling = true;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -1755,9 +1755,12 @@ h6 a.markdown-anchor-link {
|
||||
padding-left: 50px;
|
||||
}
|
||||
|
||||
/*
|
||||
div.container.blame-container{
|
||||
width:1270px;
|
||||
}
|
||||
*/
|
||||
|
||||
.line-age-legend {
|
||||
display: none;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user