From 3a1ae3a30e1418099a71cdc8ea92d5f360b0f65d Mon Sep 17 00:00:00 2001 From: Shpuld Shpuldson Date: Wed, 31 May 2017 12:45:03 +0300 Subject: Add a custom timeago.json for shorter timestamps, for example '15s' instead of '15 seconds ago' --- src/main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/main.js') diff --git a/src/main.js b/src/main.js index 969ca8dc..35261578 100644 --- a/src/main.js +++ b/src/main.js @@ -24,7 +24,7 @@ Vue.use(VueRouter) Vue.use(VueTimeago, { locale: 'en-US', locales: { - 'en-US': require('vue-timeago/locales/en-US.json') + 'en-US': require('../static/timeago.json') } }) -- cgit v1.2.3-70-g09d2 From 65646c5a125126bca97b0f5bf5f43c9544fd2cb2 Mon Sep 17 00:00:00 2001 From: Shpuld Shpuldson Date: Sat, 3 Jun 2017 18:51:55 +0300 Subject: Add an option to initiate fetching older statuses automatically when scrolled 750 pixels or less from the bottom. --- src/components/settings/settings.js | 4 ++++ src/components/settings/settings.vue | 4 ++++ src/components/timeline/timeline.js | 7 +++++++ src/main.js | 1 + src/modules/config.js | 1 + 5 files changed, 17 insertions(+) (limited to 'src/main.js') diff --git a/src/components/settings/settings.js b/src/components/settings/settings.js index 4d0528b6..cfceedde 100644 --- a/src/components/settings/settings.js +++ b/src/components/settings/settings.js @@ -7,6 +7,7 @@ const settings = { hideAttachmentsLocal: this.$store.state.config.hideAttachments, hideAttachmentsInConvLocal: this.$store.state.config.hideAttachmentsInConv, hideNsfwLocal: this.$store.state.config.hideNsfw, + autoLoadLocal: this.$store.state.config.autoLoad, muteWordsString: this.$store.state.config.muteWords.join('\n') } }, @@ -23,6 +24,9 @@ const settings = { hideNsfwLocal (value) { this.$store.dispatch('setOption', { name: 'hideNsfw', value }) }, + autoLoadLocal (value) { + this.$store.dispatch('setOption', { name: 'autoLoad', value }) + }, muteWordsString (value) { value = filter(value.split('\n'), (word) => trim(word).length > 0) this.$store.dispatch('setOption', { name: 'muteWords', value }) diff --git a/src/components/settings/settings.vue b/src/components/settings/settings.vue index 33d46e7e..3fab1c1c 100644 --- a/src/components/settings/settings.vue +++ b/src/components/settings/settings.vue @@ -28,6 +28,10 @@ +
  • + + +
  • diff --git a/src/components/timeline/timeline.js b/src/components/timeline/timeline.js index d5a9adcc..6070e442 100644 --- a/src/components/timeline/timeline.js +++ b/src/components/timeline/timeline.js @@ -20,6 +20,8 @@ const Timeline = { const credentials = store.state.users.currentUser.credentials const showImmediately = this.timeline.visibleStatuses.length === 0 + window.onscroll = this.scrollLoad + timelineFetcher.fetchAndUpdate({ store, credentials, @@ -42,6 +44,11 @@ const Timeline = { older: true, showImmediately: true }).then(() => store.commit('setLoading', { timeline: this.timelineName, value: false })) + }, + scrollLoad (e) { + if (this.timeline.loading === false && this.$store.state.config.autoLoad && (window.innerHeight + window.pageYOffset) >= (document.body.scrollHeight - 750)) { + this.fetchOlderStatuses() + } } } } diff --git a/src/main.js b/src/main.js index 35261578..351149f1 100644 --- a/src/main.js +++ b/src/main.js @@ -33,6 +33,7 @@ const persistedStateOptions = { 'config.hideAttachments', 'config.hideAttachmentsInConv', 'config.hideNsfw', + 'config.autoLoad', 'config.muteWords', 'statuses.notifications', 'users.users' diff --git a/src/modules/config.js b/src/modules/config.js index f59dc6f0..c9152ecc 100644 --- a/src/modules/config.js +++ b/src/modules/config.js @@ -7,6 +7,7 @@ const defaultState = { hideAttachments: false, hideAttachmentsInConv: false, hideNsfw: true, + autoLoad: true, muteWords: [] } -- cgit v1.2.3-70-g09d2 From f915ae174d3454ade20b9f6c827ce84b04ad7089 Mon Sep 17 00:00:00 2001 From: Shpuld Shpuldson Date: Wed, 7 Jun 2017 17:58:24 +0300 Subject: Add floating status-previews on reply-link mouseover in conversations and make them optional in the settings, fix a small visual inconsistency in muted statuses while editing the file already.. --- src/components/conversation/conversation.js | 17 ++++++++++++- src/components/conversation/conversation.vue | 38 +++++++++++++++++++++++++++- src/components/settings/settings.js | 4 +++ src/components/settings/settings.vue | 4 +++ src/components/status/status.js | 9 +++++++ src/components/status/status.vue | 16 ++++++------ src/main.js | 1 + src/modules/config.js | 1 + 8 files changed, 80 insertions(+), 10 deletions(-) (limited to 'src/main.js') diff --git a/src/components/conversation/conversation.js b/src/components/conversation/conversation.js index 3e601c3d..c91e4fde 100644 --- a/src/components/conversation/conversation.js +++ b/src/components/conversation/conversation.js @@ -10,7 +10,12 @@ const sortAndFilterConversation = (conversation) => { const conversation = { data () { return { - highlight: null + highlight: null, + preview: { + x: 0, + y: 0, + status + } } }, props: [ @@ -76,6 +81,16 @@ const conversation = { }, setHighlight (id) { this.highlight = Number(id) + }, + setPreview (id, x, y) { + if (id) { + this.preview.x = x + this.preview.y = y + this.preview.status = filter(this.conversation, { id: id })[0] + console.log(this.preview.status) + } else { + this.preview.status = null + } } } } diff --git a/src/components/conversation/conversation.vue b/src/components/conversation/conversation.vue index 96e8a5d7..e8d97f99 100644 --- a/src/components/conversation/conversation.vue +++ b/src/components/conversation/conversation.vue @@ -8,7 +8,17 @@
    - + +
    +
    +
    + +
    +

    + {{ preview.status.user.name }} + {{ preview.status.user.screen_name}} +

    +
    @@ -21,4 +31,30 @@ border-bottom-style: solid; border-bottom-width: 1px; } + + .status-preview { + position: absolute; + max-width: 35em; + padding: 0.5em; + display: flex; + border-color: inherit; + border-style: solid; + border-width: 1px; + border-radius: 4px; + box-shadow: 2px 2px 3px rgba(0, 0, 0, 0.5); + .avatar { + width: 32px; + height: 32px; + border-radius: 50%; + } + .text { + h4 { + margin-bottom: 0.4em; + small { + font-weight: lighter; + } + } + padding: 0 0.5em 0.5em 0.5em; + } + } diff --git a/src/components/settings/settings.js b/src/components/settings/settings.js index cfceedde..998aa354 100644 --- a/src/components/settings/settings.js +++ b/src/components/settings/settings.js @@ -8,6 +8,7 @@ const settings = { hideAttachmentsInConvLocal: this.$store.state.config.hideAttachmentsInConv, hideNsfwLocal: this.$store.state.config.hideNsfw, autoLoadLocal: this.$store.state.config.autoLoad, + hoverPreviewLocal: this.$store.state.config.hoverPreview, muteWordsString: this.$store.state.config.muteWords.join('\n') } }, @@ -27,6 +28,9 @@ const settings = { autoLoadLocal (value) { this.$store.dispatch('setOption', { name: 'autoLoad', value }) }, + hoverPreviewLocal (value) { + this.$store.dispatch('setOption', { name: 'hoverPreview', value }) + }, muteWordsString (value) { value = filter(value.split('\n'), (word) => trim(word).length > 0) this.$store.dispatch('setOption', { name: 'muteWords', value }) diff --git a/src/components/settings/settings.vue b/src/components/settings/settings.vue index 3fab1c1c..af0242c4 100644 --- a/src/components/settings/settings.vue +++ b/src/components/settings/settings.vue @@ -32,6 +32,10 @@ +
  • + + +
  • diff --git a/src/components/status/status.js b/src/components/status/status.js index 9448b64b..99dc1b95 100644 --- a/src/components/status/status.js +++ b/src/components/status/status.js @@ -100,6 +100,15 @@ const Status = { }, toggleUserExpanded () { this.userExpanded = !this.userExpanded + }, + replyEnter (id, event) { + if (this.$store.state.config.hoverPreview) { + let rect = event.target.getBoundingClientRect() + this.$emit('preview', Number(id), rect.left + 20, rect.top + 20 + window.pageYOffset); + } + }, + replyLeave () { + this.$emit('preview', 0, 0, 0) } }, watch: { diff --git a/src/components/status/status.vue b/src/components/status/status.vue index a921c9a6..e582a80d 100644 --- a/src/components/status/status.vue +++ b/src/components/status/status.vue @@ -19,7 +19,7 @@
    {{status.user.screen_name}} {{muteWordHits.join(', ')}} - +