diff --git a/README.md b/README.md index 3ddc081d..373b3b15 100644 --- a/README.md +++ b/README.md @@ -34,6 +34,7 @@ - script to get new emojis is included for future unicode versions - add toggle for showing post edit notifications - add support for accepted follow request notifications +- add option to prevent page from getting pushed when making a new post with streaming api enabled (similar to 3rd "for unreads" option) - add a script to download ruffle for flash support (requires python3 and requests library) - download by entering `tools/` and running `python3 download_ruffle.py` diff --git a/src/components/post_status_form/post_status_form.js b/src/components/post_status_form/post_status_form.js index d40d2290..cb0536d2 100644 --- a/src/components/post_status_form/post_status_form.js +++ b/src/components/post_status_form/post_status_form.js @@ -436,6 +436,8 @@ const PostStatusForm = { const postHandler = this.postHandler ? this.postHandler : statusPoster.postStatus + let bef = document.getElementsByClassName("Timeline")[0].scrollHeight + postHandler(postingOptions).then((data) => { if (!data.error) { this.clearStatus() @@ -444,6 +446,14 @@ const PostStatusForm = { this.error = data.error } this.posting = false + + // same as timeline.js + if (this.$store.getters.mergedConfig.fixupScrollOnPostWStreaming && window.scrollY > 0) { + let after = document.getElementsByClassName("Timeline")[0].scrollHeight + let diff = bef - after + if (diff < 0) diff = diff * -1 + window.scrollTo({ top: (window.scrollY + diff) }) + } }) }, previewStatus () { diff --git a/src/components/settings_modal/tabs/general_tab.vue b/src/components/settings_modal/tabs/general_tab.vue index ed3b3c3d..8b7fa9e4 100644 --- a/src/components/settings_modal/tabs/general_tab.vue +++ b/src/components/settings_modal/tabs/general_tab.vue @@ -229,6 +229,15 @@ {{ $t('settings.deletePostsStreaming') }} +
  • + + {{ $t('settings.fixup_scroll_on_post_with_streaming') }} + +
  • diff --git a/src/i18n/en.json b/src/i18n/en.json index aa69983a..6cf74b63 100644 --- a/src/i18n/en.json +++ b/src/i18n/en.json @@ -577,6 +577,7 @@ }, "filtering": "Filtering", "filtering_explanation": "All posts containing these words will be muted, one per line", + "fixup_scroll_on_post_with_streaming": "Prevent the page from getting pushed down by new posts you make", "follow_export": "Follow export", "follow_export_button": "Export your follows to a csv file", "follow_import": "Follow import", diff --git a/src/modules/config.js b/src/modules/config.js index 777f052b..8d57c3f2 100644 --- a/src/modules/config.js +++ b/src/modules/config.js @@ -129,6 +129,7 @@ export const defaultState = { recurseSearchLimit: 100, dedupeBoosts: true, scrollToTopOnNewPostClick: true, + fixupScrollOnPostWStreaming: false, showFaviconBadge: true, autoRefreshOnRequired: true, showUnreadInTitle: true, diff --git a/src/modules/instance.js b/src/modules/instance.js index 6477d9b1..13efbfb4 100644 --- a/src/modules/instance.js +++ b/src/modules/instance.js @@ -85,6 +85,7 @@ const defaultState = { recurseSearchLimit: 100, dedupeBoosts: true, scrollToTopOnNewPostClick: true, + fixupScrollOnPostWStreaming: false, showFaviconBadge: true, autoRefreshOnRequired: true, showUnreadInTitle: true,