diff options
author | Javier Sánchez Parra <jsanchez@soleta.eu> | 2022-01-31 11:35:58 +0100 |
---|---|---|
committer | Javier Sánchez Parra <jsanchez@soleta.eu> | 2022-01-31 16:28:53 +0100 |
commit | 9a6508c686edc2ca6de90f4563c0ade0b51014e4 (patch) | |
tree | 68f5c43542ca0d066e70176f88ab657120347f80 | |
parent | ed294050f103f04e831cc645bbd6c3973246c608 (diff) |
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.
-rw-r--r-- | ogcp/static/js/ogcp.js | 12 |
1 files changed, 8 insertions, 4 deletions
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 () { |