Skip to content

Commit fbeae55

Browse files
committed
Add a close button that always closes the right menu pages
1 parent f379dee commit fbeae55

File tree

3 files changed

+37
-2
lines changed

3 files changed

+37
-2
lines changed

css/layout.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ button#bandsButton {
2929
top: 10.5em;
3030
}
3131

32+
button#closeButton {
33+
top: 13em;
34+
}
35+
3236
button.slideOutButton i {
3337
padding: 0;
3438
margin: 0;

index.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
<button id="displayButton" class="slideOutButton"><i class="fa-solid fa-display"></i></button>
6060
<button id="dataButton" class="slideOutButton"><i class="fa-solid fa-cloud-arrow-down"></i></button>
6161
<button id="bandsButton" class="slideOutButton"><i class="fa-solid fa-ruler-vertical textFlipHorizontal"></i></button>
62+
<button id="closeButton" class="slideOutButton" style="display: none"><i class="fa-solid fa-xmark"></i></button>
6263
</div>
6364
<div id="map"></div>
6465
<div id="infoPanel" class="rightbox">
@@ -72,8 +73,8 @@ <h1><img src="img/favicon.svg" style="width: 40px; height: 40px; position: relat
7273
<li><a href="https://github.com/ianrenton/field-spotter/issues">Issue Tracker</a></li>
7374
</ul>
7475
<h3>Using the tool</h3>
75-
<p>Spots from portable amateur radio activities such as POTA, SOTA &amp; WWFF are displayed on the map. Click a marker to view details such as activator, park/summit code, distance and how old
76-
the spot is. Older spots appear faded out. When a location has multiple spots, click the marker to expand out the set of spots.</p>
76+
<p style="margin-right: 2.5em;">Spots from portable amateur radio activities such as POTA, SOTA &amp; WWFF are displayed on the map. Click a marker to view details such as activator,
77+
park/summit code, distance and how old the spot is. Older spots appear faded out. When a location has multiple spots, click the marker to expand out the set of spots.</p>
7778
<p>The <i class="fa-solid fa-filter"></i> button allows you to filter spots by program, mode and band.</p>
7879
<p>The <i class="fa-solid fa-display"></i> button allows you to configure display settings and extra features.</p>
7980
<p>The <i class="fa-solid fa-cloud-arrow-down"></i> button allows you to configure update rates and view API status.</p>

js/ui-funcs.js

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,13 @@ function manageRightBoxes(toggle, hide1, hide2, hide3, hide4, callback) {
2424
showDelay = 600;
2525
}
2626

27+
if (! $(toggle).is(":visible")) {
28+
setTimeout(function () {
29+
$("#closeButton").show();
30+
}, showDelay + 500);
31+
} else {
32+
$("#closeButton").hide();
33+
}
2734
setTimeout(function () {
2835
$(toggle).toggle("slide", {direction: "right"}, 500, callback);
2936
}, showDelay);
@@ -42,6 +49,26 @@ function manageRightBoxes(toggle, hide1, hide2, hide3, hide4, callback) {
4249
$(hide4).hide();
4350
}
4451
$(toggle).toggle(0, callback);
52+
if ($(toggle).is(":visible")) {
53+
$("#closeButton").show();
54+
} else {
55+
$("#closeButton").hide();
56+
}
57+
}
58+
}
59+
60+
// Close all right boxes
61+
function closeRightBoxes() {
62+
let allBoxes = ["#infoPanel", "#filtersPanel", "#displayPanel", "#dataPanel", "#bandsPanel"];
63+
for (let i = 0; i < allBoxes.length; i++) {
64+
if (enableAnimation) {
65+
if ($(allBoxes[i]).is(":visible")) {
66+
$(allBoxes[i]).hide("slide", {direction: "right"}, 500);
67+
}
68+
} else {
69+
$(allBoxes[i]).hide();
70+
}
71+
$("#closeButton").hide();
4572
}
4673
}
4774

@@ -79,6 +106,9 @@ $("#bandsButton").click(function () {
79106
}
80107
});
81108
});
109+
$("#closeButton").click(function () {
110+
closeRightBoxes();
111+
});
82112

83113
// Manual update button
84114
$("#updateNow").click(function () {

0 commit comments

Comments
 (0)