Skip to content

Commit

Permalink
Auto refresh sticky
Browse files Browse the repository at this point in the history
  • Loading branch information
aceberg committed Sep 7, 2024
1 parent b37d5c2 commit a76eb3f
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 13 deletions.
11 changes: 9 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
# Change Log
All notable changes to this project will be documented in this file.

## [v2.0.2] - 2024-09-
## [v2.0.2] - 2024-09-07
### Added
- Remember Refresh setting by browser

### Fixed
- Error when `IFACES`=""
- Error when `IFACES` are empty
- Sticky sort bug fix
- Bug [#124](https://github.com/aceberg/WatchYourLAN/issues/124)
- Bug [#128](https://github.com/aceberg/WatchYourLAN/issues/128)


## [v2.0.1] - 2024-09-02
### Added
Expand Down
7 changes: 6 additions & 1 deletion internal/web/public/js/refresh.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,17 @@ autoRefresh();

function toggleRefresh() {
ref = !ref;

localStorage.setItem("refAuto", ref);

autoRefresh()
autoRefresh();
}

function autoRefresh() {

ref = JSON.parse(localStorage.getItem("refAuto"));
document.getElementById("ref").checked = ref;

if (ref) {
const timeout = document.getElementById("ref-timeout").value;
console.log("Refresh timeout", timeout);
Expand Down
5 changes: 2 additions & 3 deletions internal/web/templates/history.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
{{ define "history.html" }}
</head>
<script src="/fs/public/js/history.js"></script>
<script src="/fs/public/js/hist-html.js"></script>

<body>
<div class="container-lg">
<div class="row">
Expand Down Expand Up @@ -36,6 +33,8 @@
</div>
</div>
</div>
<script src="/fs/public/js/history.js"></script>
<script src="/fs/public/js/hist-html.js"></script>

{{ template "footer.html" }}
{{ end }}
6 changes: 3 additions & 3 deletions internal/web/templates/host.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
{{ define "host.html" }}

<script src="/fs/public/js/host-scan.js"></script>
<script src="/fs/public/js/host.js"></script>
<script src="/fs/public/js/hist-html.js"></script>
<body>
<div class="container-lg">
<div class="row">
Expand Down Expand Up @@ -112,6 +109,9 @@
</div>
</div>
</div>
<script src="/fs/public/js/host-scan.js"></script>
<script src="/fs/public/js/host.js"></script>
<script src="/fs/public/js/hist-html.js"></script>
<script>
loadHistory('{{ .Host.Mac }}');
</script>
Expand Down
8 changes: 4 additions & 4 deletions internal/web/templates/index.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
{{ define "index.html" }}
</head>
<script src="/fs/public/js/index.js"></script>
<script src="/fs/public/js/sort.js"></script>
<script src="/fs/public/js/filter-search.js"></script>
<script src="/fs/public/js/refresh.js"></script>
<body>
<div class="container-lg">
<div class="row">
Expand Down Expand Up @@ -68,6 +64,10 @@
</div>
</div>
</div>
<script src="/fs/public/js/index.js"></script>
<script src="/fs/public/js/sort.js"></script>
<script src="/fs/public/js/filter-search.js"></script>
<script src="/fs/public/js/refresh.js"></script>

{{ template "footer.html" }}
{{ end }}

0 comments on commit a76eb3f

Please sign in to comment.