mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-15 09:55:49 +01:00
(refs #589) Prevent adding event handler several times
This commit is contained in:
@@ -120,6 +120,13 @@ $(function(){
|
|||||||
renderDiffs(0);
|
renderDiffs(0);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('.toggle-notes').change(function() {
|
||||||
|
if (!$(this).prop('checked')) {
|
||||||
|
$(this).closest('table').find('.not-diff.inline-comment-form').remove();
|
||||||
|
}
|
||||||
|
$(this).closest('table').find('.not-diff').toggle();
|
||||||
|
});
|
||||||
|
|
||||||
function renderDiffs(viewType){
|
function renderDiffs(viewType){
|
||||||
window.viewType = viewType;
|
window.viewType = viewType;
|
||||||
@diffs.zipWithIndex.map { case (diff, i) =>
|
@diffs.zipWithIndex.map { case (diff, i) =>
|
||||||
@@ -146,28 +153,28 @@ $(function(){
|
|||||||
if (typeof $('#show-notes')[0] !== 'undefined' && !$('#show-notes')[0].checked) {
|
if (typeof $('#show-notes')[0] !== 'undefined' && !$('#show-notes')[0].checked) {
|
||||||
$(this).hide();
|
$(this).hide();
|
||||||
}
|
}
|
||||||
|
var tmp;
|
||||||
|
var diff;
|
||||||
if (typeof oldline !== 'undefined') {
|
if (typeof oldline !== 'undefined') {
|
||||||
var tmp;
|
|
||||||
if (typeof newline !== 'undefined') {
|
if (typeof newline !== 'undefined') {
|
||||||
tmp = getInlineContainer();
|
tmp = getInlineContainer();
|
||||||
} else {
|
} else {
|
||||||
tmp = getInlineContainer('old');
|
tmp = getInlineContainer('old');
|
||||||
}
|
}
|
||||||
tmp.children('td:first').html($(this).clone().show());
|
tmp.children('td:first').html($(this).clone().show());
|
||||||
$('table[filename="' + filename + '"]').find('table.diff').find('.oldline[line-number=' + oldline + ']')
|
diff = $('table[filename="' + filename + '"]');
|
||||||
|
diff.find('table.diff').find('.oldline[line-number=' + oldline + ']')
|
||||||
.parent().nextAll(':not(.not-diff):first').before(tmp);
|
.parent().nextAll(':not(.not-diff):first').before(tmp);
|
||||||
} else {
|
} else {
|
||||||
var tmp = getInlineContainer('new');
|
tmp = getInlineContainer('new');
|
||||||
tmp.children('td:last').html($(this).clone().show());
|
tmp.children('td:last').html($(this).clone().show());
|
||||||
$('table[filename="' + filename + '"]').find('table.diff').find('.newline[line-number=' + newline + ']')
|
diff = $('table[filename="' + filename + '"]');
|
||||||
|
diff.find('table.diff').find('.newline[line-number=' + newline + ']')
|
||||||
.parent().nextAll(':not(.not-diff):first').before(tmp);
|
.parent().nextAll(':not(.not-diff):first').before(tmp);
|
||||||
}
|
}
|
||||||
});
|
if (!diff.find('.toggle-notes').prop('checked')) {
|
||||||
$('.toggle-notes').change(function() {
|
tmp.hide();
|
||||||
if (!$(this).prop('checked')) {
|
|
||||||
$(this).closest('table').find('.not-diff.inline-comment-form').remove();
|
|
||||||
}
|
}
|
||||||
$(this).closest('table').find('.not-diff').toggle();
|
|
||||||
});
|
});
|
||||||
@if(hasWritePermission) {
|
@if(hasWritePermission) {
|
||||||
$('table.diff td').hover(
|
$('table.diff td').hover(
|
||||||
|
|||||||
Reference in New Issue
Block a user