From 8f7919388391742671ef0398e017383d7f0b2bc5 Mon Sep 17 00:00:00 2001
From: Ole Bertram <git@bertr.am>
Date: Wed, 4 Jul 2018 13:49:20 +0200
Subject: Unify button styles and use min-width

This seemed to be the same across multiple components anyway.

Switched to min-width to allow for buttons with longer text, e.g.
from other languages.
---
 src/components/settings/settings.vue | 2 --
 1 file changed, 2 deletions(-)

(limited to 'src/components/settings/settings.vue')

diff --git a/src/components/settings/settings.vue b/src/components/settings/settings.vue
index 6245e758..4786b930 100644
--- a/src/components/settings/settings.vue
+++ b/src/components/settings/settings.vue
@@ -83,8 +83,6 @@
 
   .btn {
     margin-top: 1em;
-    min-height: 28px;
-    width: 10em;
   }
 }
 .setting-list {
-- 
cgit v1.2.3-70-g09d2


From 87eee191b8eaa8b7c8a396f9c6ca976c280d44af Mon Sep 17 00:00:00 2001
From: Henry Jameson <me@hjkos.com>
Date: Mon, 13 Aug 2018 17:07:45 +0300
Subject: Made pausing TL updating configurable. Added styles for disabled
 checkboxes. Shuffled settings a bit b/c all the settings are in "Attachments"
 section depsite the fact not all of them are attachments-related.

---
 src/App.scss                         |   8 +++
 src/components/settings/settings.js  |   4 ++
 src/components/settings/settings.vue | 103 ++++++++++++++++++++---------------
 src/components/timeline/timeline.js  |   5 +-
 src/i18n/messages.js                 |   1 +
 5 files changed, 76 insertions(+), 45 deletions(-)

(limited to 'src/components/settings/settings.vue')

diff --git a/src/App.scss b/src/App.scss
index 2426b998..9f7ef860 100644
--- a/src/App.scss
+++ b/src/App.scss
@@ -142,6 +142,14 @@ input, textarea, .select {
       color: $fallback--fg;
       color: var(--fg, $fallback--fg);
     }
+    &:disabled,
+    {
+      &,
+      & + label,
+      & + label::before {
+        opacity: .5;
+      }
+    }
     + label::before {
       display: inline-block;
       content: '✔';
diff --git a/src/components/settings/settings.js b/src/components/settings/settings.js
index a26111d6..e5f4b001 100644
--- a/src/components/settings/settings.js
+++ b/src/components/settings/settings.js
@@ -10,6 +10,7 @@ const settings = {
       muteWordsString: this.$store.state.config.muteWords.join('\n'),
       autoLoadLocal: this.$store.state.config.autoLoad,
       streamingLocal: this.$store.state.config.streaming,
+      pauseOnUnfocused: this.$store.state.config.pauseOnUnfocused,
       hoverPreviewLocal: this.$store.state.config.hoverPreview,
       stopGifs: this.$store.state.config.stopGifs
     }
@@ -38,6 +39,9 @@ const settings = {
     streamingLocal (value) {
       this.$store.dispatch('setOption', { name: 'streaming', value })
     },
+    pauseOnUnfocusedLocal (value) {
+      this.$store.dispatch('setOption', { name: 'pauseOnUnfocused', value })
+    },
     hoverPreviewLocal (value) {
       this.$store.dispatch('setOption', { name: 'hoverPreview', value })
     },
diff --git a/src/components/settings/settings.vue b/src/components/settings/settings.vue
index 6245e758..d6dbab27 100644
--- a/src/components/settings/settings.vue
+++ b/src/components/settings/settings.vue
@@ -1,53 +1,64 @@
 <template>
-  <div class="settings panel panel-default">
-    <div class="panel-heading">
-      {{$t('settings.settings')}}
+<div class="settings panel panel-default">
+  <div class="panel-heading">
+    {{$t('settings.settings')}}
+  </div>
+  <div class="panel-body">
+    <div class="setting-item">
+      <h2>{{$t('settings.theme')}}</h2>
+      <style-switcher></style-switcher>
     </div>
-    <div class="panel-body">
-      <div class="setting-item">
-        <h2>{{$t('settings.theme')}}</h2>
-        <style-switcher></style-switcher>
-      </div>
-      <div class="setting-item">
-        <h2>{{$t('settings.filtering')}}</h2>
-        <p>{{$t('settings.filtering_explanation')}}</p>
-        <textarea id="muteWords" v-model="muteWordsString"></textarea>
-      </div>
-      <div class="setting-item">
-        <h2>{{$t('settings.attachments')}}</h2>
-        <ul class="setting-list">
-            <li>
-                <input type="checkbox" id="hideAttachments" v-model="hideAttachmentsLocal">
-                <label for="hideAttachments">{{$t('settings.hide_attachments_in_tl')}}</label>
-            </li>
-            <li>
-                <input type="checkbox" id="hideAttachmentsInConv" v-model="hideAttachmentsInConvLocal">
-                <label for="hideAttachmentsInConv">{{$t('settings.hide_attachments_in_convo')}}</label>
-            </li>
-            <li>
-                <input type="checkbox" id="hideNsfw" v-model="hideNsfwLocal">
-                <label for="hideNsfw">{{$t('settings.nsfw_clickthrough')}}</label>
-            </li>
-            <li>
-                <input type="checkbox" id="autoload" v-model="autoLoadLocal">
-                <label for="autoload">{{$t('settings.autoload')}}</label>
-            </li>
-            <li>
-                <input type="checkbox" id="streaming" v-model="streamingLocal">
-                <label for="streaming">{{$t('settings.streaming')}}</label>
-            </li>
-            <li>
-                <input type="checkbox" id="hoverPreview" v-model="hoverPreviewLocal">
-                <label for="hoverPreview">{{$t('settings.reply_link_preview')}}</label>
-            </li>
+    <div class="setting-item">
+      <h2>{{$t('settings.filtering')}}</h2>
+      <p>{{$t('settings.filtering_explanation')}}</p>
+      <textarea id="muteWords" v-model="muteWordsString"></textarea>
+    </div>
+    <div class="setting-item">
+      <h2>{{$t('nav.timeline')}}</h2>
+      <ul class="setting-list">
+        <li>
+          <input type="checkbox" id="streaming" v-model="streamingLocal">
+          <label for="streaming">{{$t('settings.streaming')}}</label>
+          <ul class="setting-list suboptions" :class="[{disabled: !streamingLocal}]">
             <li>
-                <input type="checkbox" id="stopGifs" v-model="stopGifs">
-                <label for="stopGifs">{{$t('settings.stop_gifs')}}</label>
+              <input :disabled="!streamingLocal" type="checkbox" id="pauseOnUnfocused" v-model="pauseOnUnfocusedLocal">
+              <label for="pauseOnUnfocused">{{$t('settings.pauseOnUnfocused')}}</label>
             </li>
-        </ul>
-      </div>
+          </ul>
+        </li>
+        <li>
+          <input type="checkbox" id="autoload" v-model="autoLoadLocal">
+          <label for="autoload">{{$t('settings.autoload')}}</label>
+        </li>
+        <li>
+          <input type="checkbox" id="hoverPreview" v-model="hoverPreviewLocal">
+          <label for="hoverPreview">{{$t('settings.reply_link_preview')}}</label>
+        </li>
+      </ul>
+    </div>
+    <div class="setting-item">
+      <h2>{{$t('settings.attachments')}}</h2>
+      <ul class="setting-list">
+        <li>
+          <input type="checkbox" id="hideAttachments" v-model="hideAttachmentsLocal">
+          <label for="hideAttachments">{{$t('settings.hide_attachments_in_tl')}}</label>
+        </li>
+        <li>
+          <input type="checkbox" id="hideAttachmentsInConv" v-model="hideAttachmentsInConvLocal">
+          <label for="hideAttachmentsInConv">{{$t('settings.hide_attachments_in_convo')}}</label>
+        </li>
+        <li>
+          <input type="checkbox" id="hideNsfw" v-model="hideNsfwLocal">
+          <label for="hideNsfw">{{$t('settings.nsfw_clickthrough')}}</label>
+        </li>
+        <li>
+          <input type="checkbox" id="stopGifs" v-model="stopGifs">
+          <label for="stopGifs">{{$t('settings.stop_gifs')}}</label>
+        </li>
+      </ul>
     </div>
   </div>
+</div>
 </template>
 
 <script src="./settings.js">
@@ -89,8 +100,12 @@
 }
 .setting-list {
   list-style-type: none;
+  padding-left: 2em;
   li {
     margin-bottom: 0.5em;
   }
+  .suboptions {
+    margin-top: 0.3em
+  }
 }
 </style>
diff --git a/src/components/timeline/timeline.js b/src/components/timeline/timeline.js
index 5c179567..a651f619 100644
--- a/src/components/timeline/timeline.js
+++ b/src/components/timeline/timeline.js
@@ -133,7 +133,10 @@ const Timeline = {
       }
       if (count > 0) {
         // only 'stream' them when you're scrolled to the top
-        if (window.pageYOffset < 15 && !this.paused && !this.unfocused) {
+        if (window.pageYOffset < 15 &&
+            !this.paused &&
+            !(this.unfocused && this.$store.state.config.pauseOnUnfocused)
+           ) {
           this.showNewStatuses()
         } else {
           this.paused = true
diff --git a/src/i18n/messages.js b/src/i18n/messages.js
index 003df68c..d672fc41 100644
--- a/src/i18n/messages.js
+++ b/src/i18n/messages.js
@@ -314,6 +314,7 @@ const en = {
     stop_gifs: 'Play-on-hover GIFs',
     autoload: 'Enable automatic loading when scrolled to the bottom',
     streaming: 'Enable automatic streaming of new posts when scrolled to the top',
+    pauseOnUnfocused: 'Pause streaming when tab is not focused',
     reply_link_preview: 'Enable reply-link preview on mouse hover',
     follow_import: 'Follow import',
     import_followers_from_a_csv_file: 'Import follows from a csv file',
-- 
cgit v1.2.3-70-g09d2


From 0e5b74e3dd798703cf842257e528c85bc7c00121 Mon Sep 17 00:00:00 2001
From: Henry Jameson <me@hjkos.com>
Date: Wed, 15 Aug 2018 12:51:21 +0300
Subject: Configurable video looping, option to not to loop silent videos.
 Updated localization strings.

---
 src/components/attachment/attachment.js  | 18 ++++++++++++++++++
 src/components/attachment/attachment.vue |  2 +-
 src/components/settings/settings.js      | 20 ++++++++++++++++++--
 src/components/settings/settings.vue     | 21 ++++++++++++++++++++-
 src/i18n/messages.js                     | 13 ++++++++++---
 src/modules/config.js                    |  3 +++
 6 files changed, 70 insertions(+), 7 deletions(-)

(limited to 'src/components/settings/settings.vue')

diff --git a/src/components/attachment/attachment.js b/src/components/attachment/attachment.js
index 775207c0..cc19714d 100644
--- a/src/components/attachment/attachment.js
+++ b/src/components/attachment/attachment.js
@@ -13,6 +13,7 @@ const Attachment = {
     return {
       nsfwImage,
       hideNsfwLocal: this.$store.state.config.hideNsfw,
+      loopVideo: this.$store.state.config.loopVideo,
       showHidden: false,
       loading: false,
       img: this.type === 'image' && document.createElement('img')
@@ -59,6 +60,23 @@ const Attachment = {
       } else {
         this.showHidden = !this.showHidden
       }
+    },
+    onVideoDataLoad (e) {
+      if (typeof e.srcElement.webkitAudioDecodedByteCount !== 'undefined') {
+        // non-zero if video has audio track
+        if (e.srcElement.webkitAudioDecodedByteCount > 0) {
+          this.loopVideo = this.loopVideo && !this.$store.state.config.loopVideoSilentOnly
+        }
+      } else if (typeof e.srcElement.mozHasAudio !== 'undefined') {
+        // true if video has audio track
+        if (e.srcElement.mozHasAudio) {
+          this.loopVideo = this.loopVideo && !this.$store.state.config.loopVideoSilentOnly
+        }
+      } else if (typeof e.srcElement.audioTracks !== 'undefined') {
+        if (e.srcElement.audioTracks.length > 0) {
+          this.loopVideo = this.loopVideo && !this.$store.state.config.loopVideoSilentOnly
+        }
+      }
     }
   }
 }
diff --git a/src/components/attachment/attachment.vue b/src/components/attachment/attachment.vue
index 66110de4..8342f34b 100644
--- a/src/components/attachment/attachment.vue
+++ b/src/components/attachment/attachment.vue
@@ -14,7 +14,7 @@
       <StillImage :class="{'small': isSmall}" referrerpolicy="no-referrer" :mimetype="attachment.mimetype" :src="attachment.large_thumb_url || attachment.url"/>
     </a>
 
-    <video :class="{'small': isSmall}" v-if="type === 'video' && !hidden" :src="attachment.url" controls loop></video>
+    <video :class="{'small': isSmall}" v-if="type === 'video' && !hidden" @loadeddata="onVideoDataLoad" :src="attachment.url" controls :loop="loopVideo"></video>
 
     <audio v-if="type === 'audio'" :src="attachment.url" controls></audio>
 
diff --git a/src/components/settings/settings.js b/src/components/settings/settings.js
index e5f4b001..169b9080 100644
--- a/src/components/settings/settings.js
+++ b/src/components/settings/settings.js
@@ -1,3 +1,4 @@
+/* eslint-env browser */
 import StyleSwitcher from '../style_switcher/style_switcher.vue'
 import { filter, trim } from 'lodash'
 
@@ -7,12 +8,21 @@ const settings = {
       hideAttachmentsLocal: this.$store.state.config.hideAttachments,
       hideAttachmentsInConvLocal: this.$store.state.config.hideAttachmentsInConv,
       hideNsfwLocal: this.$store.state.config.hideNsfw,
+      loopVideoLocal: this.$store.state.config.loopVideo,
+      loopVideoSilentOnlyLocal: this.$store.state.config.loopVideoSilentOnly,
       muteWordsString: this.$store.state.config.muteWords.join('\n'),
       autoLoadLocal: this.$store.state.config.autoLoad,
       streamingLocal: this.$store.state.config.streaming,
-      pauseOnUnfocused: this.$store.state.config.pauseOnUnfocused,
+      pauseOnUnfocusedLocal: this.$store.state.config.pauseOnUnfocused,
       hoverPreviewLocal: this.$store.state.config.hoverPreview,
-      stopGifs: this.$store.state.config.stopGifs
+      stopGifs: this.$store.state.config.stopGifs,
+      loopSilentAvailable:
+        // Firefox
+        Object.getOwnPropertyDescriptor(HTMLVideoElement.prototype, 'mozHasAudio') ||
+        // Chrome-likes
+        Object.getOwnPropertyDescriptor(HTMLMediaElement.prototype, 'webkitAudioDecodedByteCount') ||
+        // Future spec, still not supported in Nightly 63 as of 08/2018
+        Object.getOwnPropertyDescriptor(HTMLMediaElement.prototype, 'audioTracks')
     }
   },
   components: {
@@ -33,6 +43,12 @@ const settings = {
     hideNsfwLocal (value) {
       this.$store.dispatch('setOption', { name: 'hideNsfw', value })
     },
+    loopVideoLocal (value) {
+      this.$store.dispatch('setOption', { name: 'loopVideo', value })
+    },
+    loopVideoSilentOnlyLocal (value) {
+      this.$store.dispatch('setOption', { name: 'loopVideoSilentOnly', value })
+    },
     autoLoadLocal (value) {
       this.$store.dispatch('setOption', { name: 'autoLoad', value })
     },
diff --git a/src/components/settings/settings.vue b/src/components/settings/settings.vue
index d6dbab27..d6aec2ff 100644
--- a/src/components/settings/settings.vue
+++ b/src/components/settings/settings.vue
@@ -22,7 +22,7 @@
           <ul class="setting-list suboptions" :class="[{disabled: !streamingLocal}]">
             <li>
               <input :disabled="!streamingLocal" type="checkbox" id="pauseOnUnfocused" v-model="pauseOnUnfocusedLocal">
-              <label for="pauseOnUnfocused">{{$t('settings.pauseOnUnfocused')}}</label>
+              <label for="pauseOnUnfocused">{{$t('settings.pause_on_unfocused')}}</label>
             </li>
           </ul>
         </li>
@@ -55,6 +55,19 @@
           <input type="checkbox" id="stopGifs" v-model="stopGifs">
           <label for="stopGifs">{{$t('settings.stop_gifs')}}</label>
         </li>
+        <li>
+          <input type="checkbox" id="loopVideo" v-model="loopVideoLocal">
+          <label for="loopVideo">{{$t('settings.loop_video')}}</label>
+          <ul class="setting-list suboptions" :class="[{disabled: !streamingLocal}]">
+            <li>
+              <input :disabled="!loopVideoLocal || !loopSilentAvailable" type="checkbox" id="loopVideoSilentOnly" v-model="loopVideoSilentOnlyLocal">
+              <label for="loopVideoSilentOnly">{{$t('settings.loop_video_silent_only')}}</label>
+              <div v-if="!loopSilentAvailable" class="unavailable">
+                <i class="icon-globe"/>! {{$t('settings.limited_availability')}}
+              </div>
+            </li>
+          </ul>
+        </li>
       </ul>
     </div>
   </div>
@@ -78,6 +91,12 @@
     height: 100px;
   }
 
+  .unavailable,
+  .unavailable i {
+    color: var(--cRed, $fallback--cRed);
+    color: $fallback--cRed;
+  }
+
   .old-avatar {
     width: 128px;
     border-radius: $fallback--avatarRadius;
diff --git a/src/i18n/messages.js b/src/i18n/messages.js
index d672fc41..3c11af8c 100644
--- a/src/i18n/messages.js
+++ b/src/i18n/messages.js
@@ -314,7 +314,9 @@ const en = {
     stop_gifs: 'Play-on-hover GIFs',
     autoload: 'Enable automatic loading when scrolled to the bottom',
     streaming: 'Enable automatic streaming of new posts when scrolled to the top',
-    pauseOnUnfocused: 'Pause streaming when tab is not focused',
+    pause_on_unfocused: 'Pause streaming when tab is not focused',
+    loop_video: 'Loop videos',
+    loop_video_silent_only: 'Loop only videos without sound (i.e. Mastodon\'s "gifs")',
     reply_link_preview: 'Enable reply-link preview on mouse hover',
     follow_import: 'Follow import',
     import_followers_from_a_csv_file: 'Import follows from a csv file',
@@ -333,7 +335,8 @@ const en = {
     confirm_new_password: 'Confirm new password',
     changed_password: 'Password changed successfully!',
     change_password_error: 'There was an issue changing your password.',
-    lock_account_description: 'Restrict your account to approved followers only'
+    lock_account_description: 'Restrict your account to approved followers only',
+    limited_availability: 'Unavailable in your browser'
   },
   notifications: {
     notifications: 'Notifications',
@@ -1606,6 +1609,9 @@ const ru = {
     nsfw_clickthrough: 'Включить скрытие NSFW вложений',
     autoload: 'Включить автоматическую загрузку при прокрутке вниз',
     streaming: 'Включить автоматическую загрузку новых сообщений при прокрутке вверх',
+    pause_on_unfocused: 'Приостановить загрузку когда вкладка не в фокусе',
+    loop_video: 'Зациливать видео',
+    loop_video_silent_only: 'Зацикливать только беззвучные видео (т.е. "гифки" с Mastodon)',
     reply_link_preview: 'Включить предварительный просмотр ответа при наведении мыши',
     follow_import: 'Импортировать читаемых',
     import_followers_from_a_csv_file: 'Импортировать читаемых из файла .csv',
@@ -1623,7 +1629,8 @@ const ru = {
     new_password: 'Новый пароль',
     confirm_new_password: 'Подтверждение нового пароля',
     changed_password: 'Пароль изменён успешно.',
-    change_password_error: 'Произошла ошибка при попытке изменить пароль.'
+    change_password_error: 'Произошла ошибка при попытке изменить пароль.',
+    limited_availability: 'Не доступно в вашем браузере'
   },
   notifications: {
     notifications: 'Уведомления',
diff --git a/src/modules/config.js b/src/modules/config.js
index 2b50655b..26930e1d 100644
--- a/src/modules/config.js
+++ b/src/modules/config.js
@@ -7,9 +7,12 @@ const defaultState = {
   hideAttachments: false,
   hideAttachmentsInConv: false,
   hideNsfw: true,
+  loopVideo: true,
+  loopVideoSilentOnly: true,
   autoLoad: true,
   streaming: false,
   hoverPreview: true,
+  pauseOnUnfocused: true,
   muteWords: [],
   highlight: {}
 }
-- 
cgit v1.2.3-70-g09d2


From 1121f32c48d06105c976f91545ededca05b283e8 Mon Sep 17 00:00:00 2001
From: ensra <ensra@users.noreply.github.com>
Date: Mon, 20 Aug 2018 02:59:06 +0100
Subject: Add support for configurable CW clickthrough.

---
 src/components/settings/settings.js  |  4 +++
 src/components/settings/settings.vue |  4 +++
 src/components/status/status.js      | 52 +++++++++++++++++++++++++++---------
 src/components/status/status.vue     | 10 ++++---
 src/i18n/messages.js                 |  1 +
 src/modules/config.js                |  1 +
 6 files changed, 55 insertions(+), 17 deletions(-)

(limited to 'src/components/settings/settings.vue')

diff --git a/src/components/settings/settings.js b/src/components/settings/settings.js
index 169b9080..89be1624 100644
--- a/src/components/settings/settings.js
+++ b/src/components/settings/settings.js
@@ -15,6 +15,7 @@ const settings = {
       streamingLocal: this.$store.state.config.streaming,
       pauseOnUnfocusedLocal: this.$store.state.config.pauseOnUnfocused,
       hoverPreviewLocal: this.$store.state.config.hoverPreview,
+      expandCWLocal: this.$store.state.config.expandCW,
       stopGifs: this.$store.state.config.stopGifs,
       loopSilentAvailable:
         // Firefox
@@ -65,6 +66,9 @@ const settings = {
       value = filter(value.split('\n'), (word) => trim(word).length > 0)
       this.$store.dispatch('setOption', { name: 'muteWords', value })
     },
+    expandCWLocal (value) {
+      this.$store.dispatch('setOption', { name: 'expandCW', value })
+    },
     stopGifs (value) {
       this.$store.dispatch('setOption', { name: 'stopGifs', value })
     }
diff --git a/src/components/settings/settings.vue b/src/components/settings/settings.vue
index 6b65b14b..389b2be9 100644
--- a/src/components/settings/settings.vue
+++ b/src/components/settings/settings.vue
@@ -34,6 +34,10 @@
           <input type="checkbox" id="hoverPreview" v-model="hoverPreviewLocal">
           <label for="hoverPreview">{{$t('settings.reply_link_preview')}}</label>
         </li>
+        <li>
+          <input type="checkbox" id="expandCW" v-model="expandCWLocal">
+          <label for="expandCW">{{$t('settings.expand_cw')}}</label>
+        </li>
       </ul>
     </div>
     <div class="setting-item">
diff --git a/src/components/status/status.js b/src/components/status/status.js
index a2d6f41f..4321803e 100644
--- a/src/components/status/status.js
+++ b/src/components/status/status.js
@@ -22,15 +22,18 @@ const Status = {
     'noHeading',
     'inlineExpanded'
   ],
-  data: () => ({
-    replying: false,
-    expanded: false,
-    unmuted: false,
-    userExpanded: false,
-    preview: null,
-    showPreview: false,
-    showingTall: false
-  }),
+  data () {
+    return {
+      replying: false,
+      expanded: false,
+      unmuted: false,
+      userExpanded: false,
+      preview: null,
+      showPreview: false,
+      showingTall: false,
+      expandingCW: this.$store.state.config.expandCW
+    }
+  },
   computed: {
     muteWords () {
       return this.$store.state.config.muteWords
@@ -98,12 +101,27 @@ const Status = {
     //
     // Using max-height + overflow: auto for status components resulted in false positives
     // very often with japanese characters, and it was very annoying.
+    tallStatus () {
+      const lengthScore = this.status.statusnet_html.split(/<p|<br/).length + this.status.text.length / 80
+      return lengthScore > 20
+    },
+    hideCWStatus () {
+        if (this.tallStatus && this.$store.state.config.expandCW) {
+          return false
+        }
+        return !this.expandingCW && this.status.summary
+    },
     hideTallStatus () {
+      if (this.status.summary && !this.$store.state.config.expandCW) {
+        return false
+      }
       if (this.showingTall) {
         return false
       }
-      const lengthScore = this.status.statusnet_html.split(/<p|<br/).length + this.status.text.length / 80
-      return lengthScore > 20
+      return this.tallStatus
+    },
+    showingMore () {
+      return this.showingTall || (this.status.summary && this.expandingCW)
     },
     attachmentSize () {
       if ((this.$store.state.config.hideAttachments && !this.inConversation) ||
@@ -163,8 +181,16 @@ const Status = {
     toggleUserExpanded () {
       this.userExpanded = !this.userExpanded
     },
-    toggleShowTall () {
-      this.showingTall = !this.showingTall
+    toggleShowMore () {
+      if (this.showingTall) {
+        this.showingTall = false
+      } else if (this.expandingCW) {
+        this.expandingCW = false
+      } else if (this.hideTallStatus) {
+        this.showingTall = true
+      } else if (this.hideCWStatus) {
+        this.expandingCW = true
+      }
     },
     replyEnter (id, event) {
       this.showPreview = true
diff --git a/src/components/status/status.vue b/src/components/status/status.vue
index b8993b0d..ee081671 100644
--- a/src/components/status/status.vue
+++ b/src/components/status/status.vue
@@ -76,9 +76,11 @@
           </div>
 
           <div :class="{'tall-status': hideTallStatus}" class="status-content-wrapper">
-            <a class="tall-status-hider" :class="{ 'tall-status-hider_focused': isFocused }" v-if="hideTallStatus" href="#" @click.prevent="toggleShowTall">Show more</a>
-            <div @click.prevent="linkClicked" class="status-content media-body" v-html="status.statusnet_html"></div>
-            <a v-if="showingTall" href="#" class="tall-status-unhider" @click.prevent="toggleShowTall">Show less</a>
+            <a class="tall-status-hider" :class="{ 'tall-status-hider_focused': isFocused }" v-if="hideTallStatus" href="#" @click.prevent="toggleShowMore">Show more</a>
+            <div @click.prevent="linkClicked" class="status-content media-body" v-html="status.statusnet_html" v-if="!hideCWStatus"></div>
+            <div @click.prevent="linkClicked" class="status-content media-body" v-html="status.summary" v-else></div>
+            <a v-if="hideCWStatus" href="#" class="cw-status-hider" @click.prevent="toggleShowMore">Show more</a>
+            <a v-if="showingMore" href="#" class="status-unhider" @click.prevent="toggleShowMore">Show less</a>
           </div>
 
           <div v-if='status.attachments' class='attachments media-body'>
@@ -310,7 +312,7 @@
     }
   }
 
-  .tall-status-unhider {
+  .status-unhider, .cw-status-hider {
     width: 100%;
     text-align: center;
   }
diff --git a/src/i18n/messages.js b/src/i18n/messages.js
index 32d886fa..67ed973d 100644
--- a/src/i18n/messages.js
+++ b/src/i18n/messages.js
@@ -317,6 +317,7 @@ const en = {
     hide_attachments_in_tl: 'Hide attachments in timeline',
     hide_attachments_in_convo: 'Hide attachments in conversations',
     nsfw_clickthrough: 'Enable clickthrough NSFW attachment hiding',
+    expand_cw: 'Expand posts with subjects by default',
     stop_gifs: 'Play-on-hover GIFs',
     autoload: 'Enable automatic loading when scrolled to the bottom',
     streaming: 'Enable automatic streaming of new posts when scrolled to the top',
diff --git a/src/modules/config.js b/src/modules/config.js
index fe31ab01..eafe90ce 100644
--- a/src/modules/config.js
+++ b/src/modules/config.js
@@ -7,6 +7,7 @@ const defaultState = {
   hideAttachments: false,
   hideAttachmentsInConv: false,
   hideNsfw: true,
+  expandCW: false,
   loopVideo: true,
   loopVideoSilentOnly: true,
   autoLoad: true,
-- 
cgit v1.2.3-70-g09d2


From 3ec8e43a9704b2945d58395dba997adfa2106df5 Mon Sep 17 00:00:00 2001
From: ensra <ensra@users.noreply.github.com>
Date: Mon, 20 Aug 2018 03:41:40 +0100
Subject: Rename expandCW to collapseMessageWithSubject.

Add option to config.json, disabled by default.
---
 src/components/settings/settings.js  |  6 +++---
 src/components/settings/settings.vue |  8 ++++----
 src/components/status/status.js      | 20 ++++++++++----------
 src/components/status/status.vue     |  4 ++--
 src/i18n/messages.js                 |  2 +-
 src/main.js                          |  4 +++-
 src/modules/config.js                |  2 +-
 static/config.json                   |  3 ++-
 8 files changed, 26 insertions(+), 23 deletions(-)

(limited to 'src/components/settings/settings.vue')

diff --git a/src/components/settings/settings.js b/src/components/settings/settings.js
index 89be1624..c85ef59f 100644
--- a/src/components/settings/settings.js
+++ b/src/components/settings/settings.js
@@ -15,7 +15,7 @@ const settings = {
       streamingLocal: this.$store.state.config.streaming,
       pauseOnUnfocusedLocal: this.$store.state.config.pauseOnUnfocused,
       hoverPreviewLocal: this.$store.state.config.hoverPreview,
-      expandCWLocal: this.$store.state.config.expandCW,
+      collapseMessageWithSubjectLocal: this.$store.state.config.collapseMessageWithSubject,
       stopGifs: this.$store.state.config.stopGifs,
       loopSilentAvailable:
         // Firefox
@@ -66,8 +66,8 @@ const settings = {
       value = filter(value.split('\n'), (word) => trim(word).length > 0)
       this.$store.dispatch('setOption', { name: 'muteWords', value })
     },
-    expandCWLocal (value) {
-      this.$store.dispatch('setOption', { name: 'expandCW', value })
+    collapseMessageWithSubjectLocal (value) {
+      this.$store.dispatch('setOption', { name: 'collapseMessageWithSubject', value })
     },
     stopGifs (value) {
       this.$store.dispatch('setOption', { name: 'stopGifs', value })
diff --git a/src/components/settings/settings.vue b/src/components/settings/settings.vue
index 389b2be9..170f5773 100644
--- a/src/components/settings/settings.vue
+++ b/src/components/settings/settings.vue
@@ -16,6 +16,10 @@
     <div class="setting-item">
       <h2>{{$t('nav.timeline')}}</h2>
       <ul class="setting-list">
+        <li>
+          <input type="checkbox" id="collapseMessageWithSubject" v-model="collapseMessageWithSubjectLocal">
+          <label for="collapseMessageWithSubject">{{$t('settings.collapse_subject')}}</label>
+        </li>
         <li>
           <input type="checkbox" id="streaming" v-model="streamingLocal">
           <label for="streaming">{{$t('settings.streaming')}}</label>
@@ -34,10 +38,6 @@
           <input type="checkbox" id="hoverPreview" v-model="hoverPreviewLocal">
           <label for="hoverPreview">{{$t('settings.reply_link_preview')}}</label>
         </li>
-        <li>
-          <input type="checkbox" id="expandCW" v-model="expandCWLocal">
-          <label for="expandCW">{{$t('settings.expand_cw')}}</label>
-        </li>
       </ul>
     </div>
     <div class="setting-item">
diff --git a/src/components/status/status.js b/src/components/status/status.js
index 07aae7e8..9670f69d 100644
--- a/src/components/status/status.js
+++ b/src/components/status/status.js
@@ -31,7 +31,7 @@ const Status = {
       preview: null,
       showPreview: false,
       showingTall: false,
-      expandingCW: this.$store.state.config.expandCW
+      expandingSubject: !this.$store.state.config.collapseMessageWithSubject
     }
   },
   computed: {
@@ -105,14 +105,14 @@ const Status = {
       const lengthScore = this.status.statusnet_html.split(/<p|<br/).length + this.status.text.length / 80
       return lengthScore > 20
     },
-    hideCWStatus () {
-      if (this.tallStatus && this.$store.state.config.expandCW) {
+    hideSubjectStatus () {
+      if (this.tallStatus && !this.$store.state.config.collapseMessageWithSubject) {
         return false
       }
-      return !this.expandingCW && this.status.summary
+      return !this.expandingSubject && this.status.summary
     },
     hideTallStatus () {
-      if (this.status.summary && !this.$store.state.config.expandCW) {
+      if (this.status.summary && this.$store.state.config.collapseMessageWithSubject) {
         return false
       }
       if (this.showingTall) {
@@ -121,7 +121,7 @@ const Status = {
       return this.tallStatus
     },
     showingMore () {
-      return this.showingTall || (this.status.summary && this.expandingCW)
+      return this.showingTall || (this.status.summary && this.expandingSubject)
     },
     attachmentSize () {
       if ((this.$store.state.config.hideAttachments && !this.inConversation) ||
@@ -184,12 +184,12 @@ const Status = {
     toggleShowMore () {
       if (this.showingTall) {
         this.showingTall = false
-      } else if (this.expandingCW) {
-        this.expandingCW = false
+      } else if (this.expandingSubject) {
+        this.expandingSubject = false
       } else if (this.hideTallStatus) {
         this.showingTall = true
-      } else if (this.hideCWStatus) {
-        this.expandingCW = true
+      } else if (this.hideSubjectStatus) {
+        this.expandingSubject = true
       }
     },
     replyEnter (id, event) {
diff --git a/src/components/status/status.vue b/src/components/status/status.vue
index ee081671..e7d5ed7a 100644
--- a/src/components/status/status.vue
+++ b/src/components/status/status.vue
@@ -77,9 +77,9 @@
 
           <div :class="{'tall-status': hideTallStatus}" class="status-content-wrapper">
             <a class="tall-status-hider" :class="{ 'tall-status-hider_focused': isFocused }" v-if="hideTallStatus" href="#" @click.prevent="toggleShowMore">Show more</a>
-            <div @click.prevent="linkClicked" class="status-content media-body" v-html="status.statusnet_html" v-if="!hideCWStatus"></div>
+            <div @click.prevent="linkClicked" class="status-content media-body" v-html="status.statusnet_html" v-if="!hideSubjectStatus"></div>
             <div @click.prevent="linkClicked" class="status-content media-body" v-html="status.summary" v-else></div>
-            <a v-if="hideCWStatus" href="#" class="cw-status-hider" @click.prevent="toggleShowMore">Show more</a>
+            <a v-if="hideSubjectStatus" href="#" class="cw-status-hider" @click.prevent="toggleShowMore">Show more</a>
             <a v-if="showingMore" href="#" class="status-unhider" @click.prevent="toggleShowMore">Show less</a>
           </div>
 
diff --git a/src/i18n/messages.js b/src/i18n/messages.js
index 67ed973d..2fa0f910 100644
--- a/src/i18n/messages.js
+++ b/src/i18n/messages.js
@@ -317,7 +317,7 @@ const en = {
     hide_attachments_in_tl: 'Hide attachments in timeline',
     hide_attachments_in_convo: 'Hide attachments in conversations',
     nsfw_clickthrough: 'Enable clickthrough NSFW attachment hiding',
-    expand_cw: 'Expand posts with subjects by default',
+    collapse_subject: 'Collapse posts with subjects',
     stop_gifs: 'Play-on-hover GIFs',
     autoload: 'Enable automatic loading when scrolled to the bottom',
     streaming: 'Enable automatic streaming of new posts when scrolled to the top',
diff --git a/src/main.js b/src/main.js
index df271ce3..06f8a6ec 100644
--- a/src/main.js
+++ b/src/main.js
@@ -45,6 +45,7 @@ Vue.use(VueChatScroll)
 
 const persistedStateOptions = {
   paths: [
+    'config.collapseMessageWithSubject',
     'config.hideAttachments',
     'config.hideAttachmentsInConv',
     'config.hideNsfw',
@@ -95,7 +96,7 @@ window.fetch('/api/statusnet/config.json')
 window.fetch('/static/config.json')
   .then((res) => res.json())
   .then((data) => {
-    const {theme, background, logo, showWhoToFollowPanel, whoToFollowProvider, whoToFollowLink, showInstanceSpecificPanel, scopeOptionsEnabled} = data
+    const {theme, background, logo, showWhoToFollowPanel, whoToFollowProvider, whoToFollowLink, showInstanceSpecificPanel, scopeOptionsEnabled, collapseMessageWithSubject} = data
     store.dispatch('setOption', { name: 'theme', value: theme })
     store.dispatch('setOption', { name: 'background', value: background })
     store.dispatch('setOption', { name: 'logo', value: logo })
@@ -104,6 +105,7 @@ window.fetch('/static/config.json')
     store.dispatch('setOption', { name: 'whoToFollowLink', value: whoToFollowLink })
     store.dispatch('setOption', { name: 'showInstanceSpecificPanel', value: showInstanceSpecificPanel })
     store.dispatch('setOption', { name: 'scopeOptionsEnabled', value: scopeOptionsEnabled })
+    store.dispatch('setOption', { name: 'collapseMessageWithSubject', value: collapseMessageWithSubject })
     if (data['chatDisabled']) {
       store.dispatch('disableChat')
     }
diff --git a/src/modules/config.js b/src/modules/config.js
index eafe90ce..60210a95 100644
--- a/src/modules/config.js
+++ b/src/modules/config.js
@@ -4,10 +4,10 @@ import StyleSetter from '../services/style_setter/style_setter.js'
 const defaultState = {
   name: 'Pleroma FE',
   colors: {},
+  collapseMessageWithSubject: false,
   hideAttachments: false,
   hideAttachmentsInConv: false,
   hideNsfw: true,
-  expandCW: false,
   loopVideo: true,
   loopVideoSilentOnly: true,
   autoLoad: true,
diff --git a/static/config.json b/static/config.json
index 4dacfebe..62b85aae 100644
--- a/static/config.json
+++ b/static/config.json
@@ -11,5 +11,6 @@
   "whoToFollowLink": "https://vinayaka.distsn.org/?{{host}}+{{user}}",
   "whoToFollowLinkDummy2": "https://followlink.osa-p.net/recommend.html",
   "showInstanceSpecificPanel": false,
-  "scopeOptionsEnabled": false
+  "scopeOptionsEnabled": false,
+  "collapseMessageWithSubject": false
 }
-- 
cgit v1.2.3-70-g09d2

