preserve scrolling on refresh

toast
Kit Kasune 3 years ago
parent afa130030e
commit cab476ac32
  1. 1
      scripts/fileview/lightrefresh.js
  2. 4
      scripts/fileview/load/render.js
  3. 2
      scripts/startup/preload.js

@ -1,5 +1,6 @@
const refresh = require('./refresh'); const refresh = require('./refresh');
module.exports = (newPath, customOptions) => { module.exports = (newPath, customOptions) => {
window.kade.currentScroll = window.scrollY;
return refresh(newPath || window.kade.cpath, customOptions || {animate: false, resetNav: false, scroll: false}); return refresh(newPath || window.kade.cpath, customOptions || {animate: false, resetNav: false, scroll: false});
}; };

@ -70,4 +70,8 @@ module.exports = (dir, options) => {
} }
if (options.resetNav) {loadHierarchy();} if (options.resetNav) {loadHierarchy();}
if (!options.scroll && window.kade.scrollY) {
window.scrollTo(0, window.kade.scrollY);
window.kade.scrollY = 0;
}
}; };

@ -34,7 +34,7 @@ window.addEventListener('DOMContentLoaded', () => {
if (window.kade.context) {hideContext(window);} if (window.kade.context) {hideContext(window);}
} }
window.kade.refreshInterval = setInterval(lightRefresh, 60000); window.kade.refreshInterval = setInterval(() => {if (!window.kade.modal) {lightRefresh();}}, 60000);
window.kade.checkDirInterval = setInterval(checkDir, 5000); window.kade.checkDirInterval = setInterval(checkDir, 5000);
require('../keybinds/handleKey')(); require('../keybinds/handleKey')();

Loading…
Cancel
Save