Made it optional

This commit is contained in:
Henry Jameson 2019-11-14 00:47:20 +02:00
parent 692ee0e95a
commit 897131572f
6 changed files with 40 additions and 20 deletions

View file

@ -270,6 +270,17 @@
</li> </li>
</ul> </ul>
</div> </div>
<div class="setting-item">
<h2>{{ $t('settings.fun') }}</h2>
<ul class="setting-list">
<li>
<Checkbox v-model="greentext">
{{ $t('settings.greentext') }} {{ $t('settings.instance_default', { value: greentextLocalizedValue }) }}
</Checkbox>
</li>
</ul>
</div>
</div> </div>
<div :label="$t('settings.theme')"> <div :label="$t('settings.theme')">

View file

@ -259,26 +259,30 @@ const Status = {
postBodyHtml () { postBodyHtml () {
const html = this.status.statusnet_html const html = this.status.statusnet_html
try { if (this.mergedConfig.greentext) {
if (html.includes('&gt;')) { try {
// This checks if post has '>' at the beginning, excluding mentions so that @mention >impying works if (html.includes('&gt;')) {
return processHtml(html, (string) => { // This checks if post has '>' at the beginning, excluding mentions so that @mention >impying works
if (string.includes('&gt;') && return processHtml(html, (string) => {
string if (string.includes('&gt;') &&
.replace(/<[^>]+?>/gi, '') // remove all tags string
.replace(/@\w+/gi, '') // remove mentions (even failed ones) .replace(/<[^>]+?>/gi, '') // remove all tags
.trim() .replace(/@\w+/gi, '') // remove mentions (even failed ones)
.startsWith('&gt;')) { .trim()
return `<span class='greentext'>${string}</span>` .startsWith('&gt;')) {
} else { return `<span class='greentext'>${string}</span>`
return string } else {
} return string
}) }
} else { })
} else {
return html
}
} catch (e) {
console.err('Failed to process status html', e)
return html return html
} }
} catch (e) { } else {
console.err('Failed to process status html', e)
return html return html
} }
}, },

View file

@ -606,7 +606,7 @@ $status-margin: 0.75em;
height: 100%; height: 100%;
mask: linear-gradient(to top, white, transparent) bottom/100% 70px no-repeat, mask: linear-gradient(to top, white, transparent) bottom/100% 70px no-repeat,
linear-gradient(to top, white, white); linear-gradient(to top, white, white);
// Autoprefixed seem to ignore this one, and also syntax is different /* Autoprefixed seem to ignore this one, and also syntax is different */
-webkit-mask-composite: xor; -webkit-mask-composite: xor;
mask-composite: exclude; mask-composite: exclude;
} }
@ -752,7 +752,8 @@ $status-margin: 0.75em;
} }
.greentext { .greentext {
color: green; color: $fallback--cGreen;
color: var(--cGreen, $fallback--cGreen);
} }
.status-conversation { .status-conversation {

View file

@ -370,6 +370,8 @@
"false": "no", "false": "no",
"true": "yes" "true": "yes"
}, },
"fun": "Fun",
"greentext": "Meme arrows",
"notifications": "Notifications", "notifications": "Notifications",
"notification_setting": "Receive notifications from:", "notification_setting": "Receive notifications from:",
"notification_setting_follows": "Users you follow", "notification_setting_follows": "Users you follow",

View file

@ -45,6 +45,7 @@ export const defaultState = {
playVideosInModal: false, playVideosInModal: false,
useOneClickNsfw: false, useOneClickNsfw: false,
useContainFit: false, useContainFit: false,
greentext: undefined, // instance default
hidePostStats: undefined, // instance default hidePostStats: undefined, // instance default
hideUserStats: undefined // instance default hideUserStats: undefined // instance default
} }

View file

@ -32,6 +32,7 @@ const defaultState = {
noAttachmentLinks: false, noAttachmentLinks: false,
showFeaturesPanel: true, showFeaturesPanel: true,
minimalScopesMode: false, minimalScopesMode: false,
greentext: false,
// Nasty stuff // Nasty stuff
pleromaBackend: true, pleromaBackend: true,