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);
|
||||
});
|
||||
|
||||
$('.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){
|
||||
window.viewType = viewType;
|
||||
@diffs.zipWithIndex.map { case (diff, i) =>
|
||||
@@ -146,28 +153,28 @@ $(function(){
|
||||
if (typeof $('#show-notes')[0] !== 'undefined' && !$('#show-notes')[0].checked) {
|
||||
$(this).hide();
|
||||
}
|
||||
if (typeof oldline !== 'undefined') {
|
||||
var tmp;
|
||||
var diff;
|
||||
if (typeof oldline !== 'undefined') {
|
||||
if (typeof newline !== 'undefined') {
|
||||
tmp = getInlineContainer();
|
||||
} else {
|
||||
tmp = getInlineContainer('old');
|
||||
}
|
||||
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);
|
||||
} else {
|
||||
var tmp = getInlineContainer('new');
|
||||
tmp = getInlineContainer('new');
|
||||
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);
|
||||
}
|
||||
});
|
||||
$('.toggle-notes').change(function() {
|
||||
if (!$(this).prop('checked')) {
|
||||
$(this).closest('table').find('.not-diff.inline-comment-form').remove();
|
||||
if (!diff.find('.toggle-notes').prop('checked')) {
|
||||
tmp.hide();
|
||||
}
|
||||
$(this).closest('table').find('.not-diff').toggle();
|
||||
});
|
||||
@if(hasWritePermission) {
|
||||
$('table.diff td').hover(
|
||||
|
||||
Reference in New Issue
Block a user