Skip to content

Commit f63e5a0

Browse files
committed
Back button
1 parent 80aca35 commit f63e5a0

3 files changed

Lines changed: 41 additions & 0 deletions

File tree

frontend/pages/foot.ejs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
<% if (typeof tenant !== 'undefined') { %>
33
<p class="fixed">© <%= new Date().getFullYear() %> CommTrackr</p>
44
<p class="fixed2">Changes saved</p>
5+
<p class="fixed3">← Back</p>
56
<% } else { %>
67
<p class="fixed">Internal error</p>
78
<% } %>

frontend/public/scripts.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,12 @@ function anim_out() {
2626

2727
window.onload = function () {
2828
anim_in();
29+
if (document.referrer && (document.referrer !== window.location.href)) {
30+
document.querySelector('.fixed3').classList.add('visible');
31+
document.querySelector('.fixed3').addEventListener('click', function () {
32+
window.history.back();
33+
});
34+
};
2935
document.querySelectorAll('.inputField').forEach(field => {
3036
field.querySelectorAll('input:not([type="radio"]), textarea').forEach(input => {
3137
if (localStorage.getItem(field.id)) {
@@ -70,6 +76,14 @@ window.onload = function () {
7076
});
7177
};
7278

79+
window.addEventListener('pageshow', (event) => {
80+
if (event.persisted) anim_in();
81+
});
82+
83+
window.addEventListener('pagehide', (event) => {
84+
if (event.persisted) anim_out();
85+
});
86+
7387
// anim_out();
7488
// setTimeout(() => {
7589
// anim_in();

frontend/public/styles.css

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,32 @@ main {
223223
transition: 0.25s;
224224
}
225225

226+
> .fixed3 {
227+
position: absolute;
228+
top: 25px;
229+
left: 30px;
230+
cursor: pointer;
231+
opacity: 0;
232+
transition: 0.25s;
233+
}
234+
235+
> .fixed3:not(.visible) {
236+
user-select: none;
237+
pointer-events: none;
238+
}
239+
240+
> .fixed3.visible {
241+
opacity: 0.75;
242+
transition: 0.25s;
243+
}
244+
245+
> .fixed3.visible:hover {
246+
opacity: 0.5;
247+
left: 25px;
248+
padding-right: 5px;
249+
transition: 0.25s;
250+
}
251+
226252
> .progress {
227253
position: absolute;
228254
top: 0;

0 commit comments

Comments
 (0)