You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
873 B

  1. const element = document.getElementById('initial-state');
  2. const initialState = element && function () {
  3. const result = JSON.parse(element.textContent);
  4. try {
  5. result.local_settings = JSON.parse(localStorage.getItem('mastodon-settings'));
  6. } catch (e) {
  7. result.local_settings = {};
  8. }
  9. return result;
  10. }();
  11. const getMeta = (prop) => initialState && initialState.meta && initialState.meta[prop];
  12. export const reduceMotion = getMeta('reduce_motion');
  13. export const autoPlayGif = getMeta('auto_play_gif');
  14. export const unfollowModal = getMeta('unfollow_modal');
  15. export const boostModal = getMeta('boost_modal');
  16. export const favouriteModal = getMeta('favourite_modal');
  17. export const deleteModal = getMeta('delete_modal');
  18. export const me = getMeta('me');
  19. export const maxChars = (initialState && initialState.max_toot_chars) || 500;
  20. export default initialState;