UI - Viewing text differences - Tweaks to "Jump to next change" button

pull/1886/head
dgtlmoon 1 year ago
parent 1709e8f936
commit 0ba7928d58

@ -2,8 +2,7 @@ $(document).ready(function () {
var a = document.getElementById("a"); var a = document.getElementById("a");
var b = document.getElementById("b"); var b = document.getElementById("b");
var result = document.getElementById("result"); var result = document.getElementById("result");
var inputs = document.getElementsByClassName("change"); var inputs;
inputs.current = 0;
$('#jump-next-diff').click(function () { $('#jump-next-diff').click(function () {
@ -59,9 +58,6 @@ $(document).ready(function () {
result.textContent = ""; result.textContent = "";
result.appendChild(fragment); result.appendChild(fragment);
// Jump at start
inputs.current = 0;
// For nice mouse-over hover/title information // For nice mouse-over hover/title information
const removed_current_option = $('#diff-version option:selected') const removed_current_option = $('#diff-version option:selected')
if (removed_current_option) { if (removed_current_option) {
@ -75,7 +71,11 @@ $(document).ready(function () {
$(this).prop('title', 'Inserted '+inserted_current_option[0].label); $(this).prop('title', 'Inserted '+inserted_current_option[0].label);
}); });
} }
// Set the list of possible differences to jump to
inputs = document.querySelectorAll('#diff-ui .change')
// Set the "current" diff pointer
inputs.current = 0;
// Goto diff
$('#jump-next-diff').click(); $('#jump-next-diff').click();
} }

@ -60,7 +60,7 @@
</div> </div>
<div id="diff-jump"> <div id="diff-jump">
<a id="jump-next-diff">Jump</a> <a id="jump-next-diff" title="Jump to next difference">Jump</a>
</div> </div>
<script src="{{url_for('static_content', group='js', filename='tabs.js')}}" defer></script> <script src="{{url_for('static_content', group='js', filename='tabs.js')}}" defer></script>

Loading…
Cancel
Save