Skip to content

Commit

Permalink
Keep record of unwinded containers on page refresh
Browse files Browse the repository at this point in the history
The solution retains a record of the currently un-collapsed container and unwinds it on a page refresh. No extra refresh button and no live-update.
The minor inconvenience of this solution is that on a page refresh the unwind animation plays.

Helps #568
  • Loading branch information
ResamVi committed Oct 2, 2023
1 parent 7ec1131 commit 3dcd988
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions resources/static/functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,21 @@ $(function () {
.removeClass('glyphicon-collapse-down')
.addClass('glyphicon-collapse-up');
event.stopPropagation();

localStorage.setItem("coll_" + this.id, true);
})
$('div.collapse').on('hide.bs.collapse', function (event) {
$(this).prev().find('span.toggle-icon')
.removeClass('glyphicon-collapse-up')
.addClass('glyphicon-collapse-down');
event.stopPropagation();

localStorage.setItem("coll_" + this.id, false);
})

$("div.collapse").each(function() {
if (localStorage.getItem("coll_" + this.id) == "true") {
$(this).collapse("show");
}
});
})

0 comments on commit 3dcd988

Please sign in to comment.