diff --git a/README.md b/README.md index cd8ef533..d929c9b9 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ Upstream README is below. ## list of changes in this fork: - additional confirmations for: - post visibility (choose direct, private, unlisted, public, local) - - posting with an attachment marked sensitive but no cw + - posting with an attachment marked sensitive but no cw (todo: fix the conf showing up with no attachments) - biting: - users - notes @@ -40,6 +40,7 @@ Upstream README is below. - for unreads: - option to disable favicon badge changing on unreads - option to disable title showing unreads + - option to not scroll to the top when showing unreads - update the list of emojis: - switched weird unicode ones to proper emojis - emojis are sourced from discord's list of emojis @@ -47,6 +48,7 @@ Upstream README is below. - 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 f9765aef..fb5221f0 100644 --- a/src/components/post_status_form/post_status_form.js +++ b/src/components/post_status_form/post_status_form.js @@ -458,6 +458,10 @@ const PostStatusForm = { const postHandler = this.postHandler ? this.postHandler : statusPoster.postStatus + let bef = null + if (document.getElementsByClassName("Timeline") > 0) + bef = document.getElementsByClassName("Timeline")[0].scrollHeight + postHandler(postingOptions).then((data) => { if (!data.error) { this.clearStatus() @@ -466,6 +470,14 @@ const PostStatusForm = { this.error = data.error } this.posting = false + + // same as timeline.js + if (this.$store.getters.mergedConfig.fixupScrollOnPostWStreaming && window.scrollY > 0 && (document.getElementsByClassName("Timeline") > 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/search/search.vue b/src/components/search/search.vue index b1ebbe0e..c0fff580 100644 --- a/src/components/search/search.vue +++ b/src/components/search/search.vue @@ -200,6 +200,10 @@ } } +.search-result .status-heading { + padding-bottom: .5em; +} + .loading-icon { padding: 1em; } diff --git a/src/components/settings_modal/tabs/general_tab.vue b/src/components/settings_modal/tabs/general_tab.vue index c0bf3489..8b7fa9e4 100644 --- a/src/components/settings_modal/tabs/general_tab.vue +++ b/src/components/settings_modal/tabs/general_tab.vue @@ -201,6 +201,14 @@ +
  • + + {{ $t('settings.scroll_to_top_on_new_post_click') }} + +
  • +
  • + + {{ $t('settings.fixup_scroll_on_post_with_streaming') }} + +
  • diff --git a/src/components/status/status.scss b/src/components/status/status.scss index 8b92f42a..608d0a15 100644 --- a/src/components/status/status.scss +++ b/src/components/status/status.scss @@ -42,6 +42,10 @@ padding: var(--status-margin, $status-margin); } + .popover .status-container { + padding: .5em; + } + &.classic .status-heading { margin-bottom: 0.5em; } diff --git a/src/components/timeline/timeline.js b/src/components/timeline/timeline.js index cdb35e08..1c2ae5b6 100644 --- a/src/components/timeline/timeline.js +++ b/src/components/timeline/timeline.js @@ -156,6 +156,8 @@ const Timeline = { if (e.key === '.') this.showNewStatuses() }, showNewStatuses () { + let bef = document.getElementsByClassName("Timeline")[0].scrollHeight + if (this.timeline.flushMarker !== 0) { this.$store.commit('clearTimeline', { timeline: this.timelineName, excludeUserId: true }) this.$store.commit('queueFlush', { timeline: this.timelineName, id: 0 }) @@ -165,8 +167,18 @@ const Timeline = { this.$store.commit('showNewStatuses', { timeline: this.timelineName }) this.paused = false } - if (!this.inProfile) { + if (!this.inProfile && this.$store.getters.mergedConfig.scrollToTopOnNewPostClick) { window.scrollTo({ top: 0 }) + } else if (!this.inProfile && !this.$store.getters.mergedConfig.scrollToTopOnNewPostClick && window.scrollY > 0) { + // i REALLY don't like this code. it results in flickering best case scenario. this is kind of just a limit + // of how akko-fe is written, and being able to do this without flicker would require an async rewrite most + // likely. this is probably the best way this can be reasonably done without a full rewrite. + setTimeout(function() { + let after = document.getElementsByClassName("Timeline")[0].scrollHeight + let diff = bef - after + if (diff < 0) diff = diff * -1 + window.scrollTo({ top: (window.scrollY + diff) }) + }, 0); } }, fetchOlderStatuses: throttle( function () { diff --git a/src/i18n/en.json b/src/i18n/en.json index d024dffd..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", @@ -753,6 +754,7 @@ "saving_err": "Error saving settings", "saving_ok": "Settings saved", "scope_copy": "Copy scope when replying (DMs are always copied)", + "scroll_to_top_on_new_post_click": "Scroll to the top when showing new posts (disabling this may result in buggy behavior)", "search_pagination_limit": "Results to show per search page", "search_user_to_block": "Search whom you want to block", "search_user_to_mute": "Search whom you want to mute", diff --git a/src/modules/config.js b/src/modules/config.js index efed69b4..8d57c3f2 100644 --- a/src/modules/config.js +++ b/src/modules/config.js @@ -128,6 +128,8 @@ export const defaultState = { recurseSearch: false, 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 75dd6aa7..13efbfb4 100644 --- a/src/modules/instance.js +++ b/src/modules/instance.js @@ -84,6 +84,8 @@ const defaultState = { recurseSearch: false, recurseSearchLimit: 100, dedupeBoosts: true, + scrollToTopOnNewPostClick: true, + fixupScrollOnPostWStreaming: false, showFaviconBadge: true, autoRefreshOnRequired: true, showUnreadInTitle: true,