From 72a415144b3d40035b360f294867ea8d254c1988 Mon Sep 17 00:00:00 2001 From: dgtlmoon Date: Wed, 21 Jun 2023 14:07:28 +0200 Subject: [PATCH] UI - Watch Table - Clicking anywhere on the watch list row table also activates the operations buttons and checkbox --- changedetectionio/static/js/watch-overview.js | 47 ++++++++++++------- 1 file changed, 29 insertions(+), 18 deletions(-) diff --git a/changedetectionio/static/js/watch-overview.js b/changedetectionio/static/js/watch-overview.js index e5fb69c9..a8b2b4fd 100644 --- a/changedetectionio/static/js/watch-overview.js +++ b/changedetectionio/static/js/watch-overview.js @@ -1,34 +1,45 @@ $(function () { - // Remove unviewed status when normally clicked - $('.diff-link').click(function () { - $(this).closest('.unviewed').removeClass('unviewed'); - }); + // Remove unviewed status when normally clicked + $('.diff-link').click(function () { + $(this).closest('.unviewed').removeClass('unviewed'); + }); $("#checkbox-assign-tag").click(function (e) { $('#op_extradata').val(prompt("Enter a tag name")); }); - $('.with-share-link > *').click(function () { - $("#copied-clipboard").remove(); + $('.with-share-link > *').click(function () { + $("#copied-clipboard").remove(); + + var range = document.createRange(); + var n = $("#share-link")[0]; + range.selectNode(n); + window.getSelection().removeAllRanges(); + window.getSelection().addRange(range); + document.execCommand("copy"); + window.getSelection().removeAllRanges(); - var range = document.createRange(); - var n=$("#share-link")[0]; - range.selectNode(n); - window.getSelection().removeAllRanges(); - window.getSelection().addRange(range); - document.execCommand("copy"); - window.getSelection().removeAllRanges(); + $('.with-share-link').append('Copied to clipboard'); + $("#copied-clipboard").fadeOut(2500, function () { + $(this).remove(); + }); + }); - $('.with-share-link').append('Copied to clipboard'); - $("#copied-clipboard").fadeOut(2500, function() { - $(this).remove(); - }); - }); + $(".watch-table tr").click(function (event) { + var tagName = event.target.tagName.toLowerCase(); + if (tagName === 'tr' || tagName === 'td') { + var x = $('input[type=checkbox]', this); + if (x) { + $(x).click(); + } + } + }); // checkboxes - check all $("#check-all").click(function (e) { $('input[type=checkbox]').not(this).prop('checked', this.checked); }); + // checkboxes - show/hide buttons $("input[type=checkbox]").click(function (e) { if ($('input[type=checkbox]:checked').length) {