mirror of
https://git.notfire.cc/notfire/akkoma-fe.git
synced 2026-01-11 05:23:16 -08:00
add option to not scroll to the top when showing unread posts
This commit is contained in:
parent
949c933216
commit
01f19e7fcd
6 changed files with 27 additions and 2 deletions
|
|
@ -3,7 +3,7 @@
|
||||||
## list of changes in this fork:
|
## list of changes in this fork:
|
||||||
- additional confirmations for:
|
- additional confirmations for:
|
||||||
- post visibility (choose direct, private, unlisted, public, local)
|
- 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:
|
- biting:
|
||||||
- users
|
- users
|
||||||
- notes
|
- notes
|
||||||
|
|
@ -26,6 +26,7 @@
|
||||||
- for unreads:
|
- for unreads:
|
||||||
- option to disable favicon badge changing on unreads
|
- option to disable favicon badge changing on unreads
|
||||||
- option to disable title showing unreads
|
- option to disable title showing unreads
|
||||||
|
- option to not scroll to the top when showing unreads
|
||||||
- update the list of emojis:
|
- update the list of emojis:
|
||||||
- switched weird unicode ones to proper emojis
|
- switched weird unicode ones to proper emojis
|
||||||
- emojis are sourced from discord's list of emojis
|
- emojis are sourced from discord's list of emojis
|
||||||
|
|
|
||||||
|
|
@ -201,6 +201,14 @@
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
|
<li>
|
||||||
|
<BooleanSetting
|
||||||
|
path="scrollToTopOnNewPostClick"
|
||||||
|
expert="1"
|
||||||
|
>
|
||||||
|
{{ $t('settings.scroll_to_top_on_new_post_click') }}
|
||||||
|
</BooleanSetting>
|
||||||
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<BooleanSetting
|
<BooleanSetting
|
||||||
path="useStreamingApi"
|
path="useStreamingApi"
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ import TimelineQuickSettings from './timeline_quick_settings.vue'
|
||||||
import { debounce, throttle, keyBy } from 'lodash'
|
import { debounce, throttle, keyBy } from 'lodash'
|
||||||
import { library } from '@fortawesome/fontawesome-svg-core'
|
import { library } from '@fortawesome/fontawesome-svg-core'
|
||||||
import { faCircleNotch, faCog, faPlus, faMinus } from '@fortawesome/free-solid-svg-icons'
|
import { faCircleNotch, faCog, faPlus, faMinus } from '@fortawesome/free-solid-svg-icons'
|
||||||
|
import {calcLineCount} from "diff/lib/patch/merge";
|
||||||
|
|
||||||
library.add(
|
library.add(
|
||||||
faCircleNotch,
|
faCircleNotch,
|
||||||
|
|
@ -156,6 +157,8 @@ const Timeline = {
|
||||||
if (e.key === '.') this.showNewStatuses()
|
if (e.key === '.') this.showNewStatuses()
|
||||||
},
|
},
|
||||||
showNewStatuses () {
|
showNewStatuses () {
|
||||||
|
let bef = document.getElementsByClassName("Timeline")[0].scrollHeight
|
||||||
|
|
||||||
if (this.timeline.flushMarker !== 0) {
|
if (this.timeline.flushMarker !== 0) {
|
||||||
this.$store.commit('clearTimeline', { timeline: this.timelineName, excludeUserId: true })
|
this.$store.commit('clearTimeline', { timeline: this.timelineName, excludeUserId: true })
|
||||||
this.$store.commit('queueFlush', { timeline: this.timelineName, id: 0 })
|
this.$store.commit('queueFlush', { timeline: this.timelineName, id: 0 })
|
||||||
|
|
@ -165,8 +168,18 @@ const Timeline = {
|
||||||
this.$store.commit('showNewStatuses', { timeline: this.timelineName })
|
this.$store.commit('showNewStatuses', { timeline: this.timelineName })
|
||||||
this.paused = false
|
this.paused = false
|
||||||
}
|
}
|
||||||
if (!this.inProfile) {
|
if (!this.inProfile && this.$store.getters.mergedConfig.scrollToTopOnNewPostClick) {
|
||||||
window.scrollTo({ top: 0 })
|
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 () {
|
fetchOlderStatuses: throttle( function () {
|
||||||
|
|
|
||||||
|
|
@ -753,6 +753,7 @@
|
||||||
"saving_err": "Error saving settings",
|
"saving_err": "Error saving settings",
|
||||||
"saving_ok": "Settings saved",
|
"saving_ok": "Settings saved",
|
||||||
"scope_copy": "Copy scope when replying (DMs are always copied)",
|
"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_pagination_limit": "Results to show per search page",
|
||||||
"search_user_to_block": "Search whom you want to block",
|
"search_user_to_block": "Search whom you want to block",
|
||||||
"search_user_to_mute": "Search whom you want to mute",
|
"search_user_to_mute": "Search whom you want to mute",
|
||||||
|
|
|
||||||
|
|
@ -128,6 +128,7 @@ export const defaultState = {
|
||||||
recurseSearch: false,
|
recurseSearch: false,
|
||||||
recurseSearchLimit: 100,
|
recurseSearchLimit: 100,
|
||||||
dedupeBoosts: true,
|
dedupeBoosts: true,
|
||||||
|
scrollToTopOnNewPostClick: true,
|
||||||
showFaviconBadge: true,
|
showFaviconBadge: true,
|
||||||
autoRefreshOnRequired: true,
|
autoRefreshOnRequired: true,
|
||||||
showUnreadInTitle: true,
|
showUnreadInTitle: true,
|
||||||
|
|
|
||||||
|
|
@ -84,6 +84,7 @@ const defaultState = {
|
||||||
recurseSearch: false,
|
recurseSearch: false,
|
||||||
recurseSearchLimit: 100,
|
recurseSearchLimit: 100,
|
||||||
dedupeBoosts: true,
|
dedupeBoosts: true,
|
||||||
|
scrollToTopOnNewPostClick: true,
|
||||||
showFaviconBadge: true,
|
showFaviconBadge: true,
|
||||||
autoRefreshOnRequired: true,
|
autoRefreshOnRequired: true,
|
||||||
showUnreadInTitle: true,
|
showUnreadInTitle: true,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue