From 0ba7928d587fe80465101e4c0e705013704bd64c Mon Sep 17 00:00:00 2001 From: dgtlmoon Date: Mon, 23 Oct 2023 11:42:01 +0200 Subject: [PATCH] UI - Viewing text differences - Tweaks to "Jump to next change" button --- changedetectionio/static/js/diff-render.js | 12 ++++++------ changedetectionio/templates/diff.html | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/changedetectionio/static/js/diff-render.js b/changedetectionio/static/js/diff-render.js index c71a12de..53f1d68f 100644 --- a/changedetectionio/static/js/diff-render.js +++ b/changedetectionio/static/js/diff-render.js @@ -2,8 +2,7 @@ $(document).ready(function () { var a = document.getElementById("a"); var b = document.getElementById("b"); var result = document.getElementById("result"); - var inputs = document.getElementsByClassName("change"); - inputs.current = 0; + var inputs; $('#jump-next-diff').click(function () { @@ -59,9 +58,6 @@ $(document).ready(function () { result.textContent = ""; result.appendChild(fragment); - // Jump at start - inputs.current = 0; - // For nice mouse-over hover/title information const removed_current_option = $('#diff-version option:selected') if (removed_current_option) { @@ -75,7 +71,11 @@ $(document).ready(function () { $(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(); } diff --git a/changedetectionio/templates/diff.html b/changedetectionio/templates/diff.html index e060c4c5..6cac4605 100644 --- a/changedetectionio/templates/diff.html +++ b/changedetectionio/templates/diff.html @@ -60,7 +60,7 @@
- Jump + Jump