Skip to content

Commit 0e04a20

Browse files
nemoinholunny
authored andcommitted
Fix Split-View line adjustment (#4622)
The $-function is unreachable in the previous implementation because jQuery is not loaded yet. I fix this by executing the function after the content is loaded, so jQuery is loaded at the time of execution and the call will not fail anymore. Signed-off-by: Felix Nehrke <[email protected]>
1 parent 578cf52 commit 0e04a20

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

templates/repo/diff/box.tmpl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@
200200

201201
{{if .IsSplitStyle}}
202202
<script>
203-
(function() {
203+
document.addEventListener('DOMContentLoaded', function() {
204204
$('tr.add-code').each(function() {
205205
var prev = $(this).prev();
206206
if(prev.is('.del-code') && prev.children().eq(3).text().trim() === '') {
@@ -217,7 +217,7 @@
217217
$(this).remove();
218218
}
219219
});
220-
}());
220+
});
221221
</script>
222222
{{end}}
223223
{{end}}

0 commit comments

Comments
 (0)