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