From 9a6508c686edc2ca6de90f4563c0ade0b51014e4 Mon Sep 17 00:00:00 2001 From: Javier Sánchez Parra Date: Mon, 31 Jan 2022 11:35:58 +0100 Subject: Add helper function to store checksum status This function stores checksum status if is checked to browser local storage. Otherwise, it removes checksum from the storage. --- ogcp/static/js/ogcp.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'ogcp/static') diff --git a/ogcp/static/js/ogcp.js b/ogcp/static/js/ogcp.js index ff15390..f05d7f5 100644 --- a/ogcp/static/js/ogcp.js +++ b/ogcp/static/js/ogcp.js @@ -2,14 +2,18 @@ const Endpoint = '/scopes/status'; const Interval = 1000; let updateTimeoutId = null; +function storeCheckboxStatus(checkbox) { + if (checkbox.checked) + localStorage.setItem(checkbox.name, "check"); + else + localStorage.removeItem(checkbox.name); +} + function keepSelectedClients() { const checkboxes = $('input:checkbox[form|="scopesForm"]') checkboxes.on('change', function (event) { - if (this.checked) - localStorage.setItem(this.name, "check"); - else - localStorage.removeItem(this.name); + storeCheckboxStatus(this); }); checkboxes.each(function () { -- cgit v1.2.3-18-g5258