diff --git a/bookwyrm/static/js/bookwyrm.js b/bookwyrm/static/js/bookwyrm.js index 5ca3d7d7..a4149c6f 100644 --- a/bookwyrm/static/js/bookwyrm.js +++ b/bookwyrm/static/js/bookwyrm.js @@ -1,4 +1,4 @@ -/* globals setDisplay TabGroup updateDisplay */ +/* globals TabGroup */ // set up javascript listeners window.onload = function() { @@ -28,14 +28,6 @@ window.onload = function() { Array.from(document.getElementsByClassName('tab-group')) .forEach(t => new TabGroup(t)); - - // display based on localstorage vars - document.querySelectorAll('[data-hide]') - .forEach(t => setDisplay(t)); - - // update localstorage - Array.from(document.getElementsByClassName('set-display')) - .forEach(t => t.onclick = updateDisplay); }; function back(e) { diff --git a/bookwyrm/static/js/localstorage.js b/bookwyrm/static/js/localstorage.js index aa79ee30..5104b44a 100644 --- a/bookwyrm/static/js/localstorage.js +++ b/bookwyrm/static/js/localstorage.js @@ -18,3 +18,11 @@ function setDisplay(el) { var value = window.localStorage.getItem(key); addRemoveClass(el, 'hidden', value); } + +// display based on localstorage vars +document.querySelectorAll('[data-hide]') + .forEach(t => setDisplay(t)); + +// update localstorage +Array.from(document.getElementsByClassName('set-display')) + .forEach(t => t.onclick = updateDisplay);