diff options
author | ThibG <thib@sitedethib.com> | 2018-08-11 15:28:06 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-11 15:28:06 +0200 |
commit | d787bcdeb1570e4d8d67f326dadaf321a6854e06 (patch) | |
tree | fa23a187b16bf07635312a7791013aacfc2c4474 /app/javascript/packs | |
parent | 03afc365d530e6d57754ae9dbbdbd0c56431ee02 (diff) | |
parent | 7067b64de33f9cd491e97329df266fde5fb49e42 (diff) |
Merge pull request #630 from ThibG/glitch-soc/merge-upstream
Merge upstream changes
Diffstat (limited to 'app/javascript/packs')
-rw-r--r-- | app/javascript/packs/public.js | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/app/javascript/packs/public.js b/app/javascript/packs/public.js index 3a1ca1a7b..7d632776e 100644 --- a/app/javascript/packs/public.js +++ b/app/javascript/packs/public.js @@ -15,6 +15,7 @@ function main() { const React = require('react'); const ReactDOM = require('react-dom'); const Rellax = require('rellax'); + const createHistory = require('history').createBrowserHistory; ready(() => { const locale = document.documentElement.lang; @@ -70,6 +71,14 @@ function main() { } new Rellax('.parallax', { speed: -1 }); + + const history = createHistory(); + const detailedStatuses = document.querySelectorAll('.public-layout .detailed-status'); + const location = history.location; + if (detailedStatuses.length === 1 && (!location.state || !location.state.scrolledToDetailedStatus)) { + detailedStatuses[0].scrollIntoView(); + history.replace(location.pathname, { ...location.state, scrolledToDetailedStatus: true }); + } }); } |