mirror of
https://github.com/friendica/friendica
synced 2024-12-22 18:40:17 +00:00
Issue 14174 and 14421: Option to hide emojis and pictures without description
This commit is contained in:
parent
159e6e79dc
commit
301717802d
7 changed files with 245 additions and 206 deletions
|
@ -273,6 +273,13 @@ class Page implements ArrayAccess
|
|||
'$max_imagesize' => round(Images::getMaxUploadBytes() / 1000000, 0),
|
||||
|
||||
]) . $this->page['htmlhead'];
|
||||
|
||||
if ($pConfig->get($localUID, 'accessibility', 'hide_empty_descriptions')) {
|
||||
$this->page['htmlhead'] .= "<style>.empty-description {display: none;}</style>\n";
|
||||
}
|
||||
if ($pConfig->get($localUID, 'accessibility', 'hide_custom_emojis')) {
|
||||
$this->page['htmlhead'] .= "<style>span.emoji.mastodon img {display: none;}</style>\n";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -686,7 +686,7 @@ class BBCode
|
|||
// to the last element
|
||||
$newbody = str_replace(
|
||||
'[$#saved_image' . $cnt . '#$]',
|
||||
'<img src="' . self::proxyUrl($image, self::INTERNAL, $uriid) . '" alt="' . DI::l10n()->t('Image/photo') . '" />',
|
||||
'<img src="' . self::proxyUrl($image, self::INTERNAL, $uriid) . '" alt="' . DI::l10n()->t('Image/photo') . '" class="empty-description"/>',
|
||||
$newbody
|
||||
);
|
||||
$cnt++;
|
||||
|
@ -1859,8 +1859,8 @@ class BBCode
|
|||
$text
|
||||
);
|
||||
|
||||
$text = preg_replace("/\[img\](.*?)\[\/img\]/ism", '<img src="$1" alt="' . DI::l10n()->t('Image/photo') . '" />', $text);
|
||||
$text = preg_replace("/\[zmg\](.*?)\[\/zmg\]/ism", '<img src="$1" alt="' . DI::l10n()->t('Image/photo') . '" />', $text);
|
||||
$text = preg_replace("/\[img\](.*?)\[\/img\]/ism", '<img src="$1" alt="' . DI::l10n()->t('Image/photo') . '" class="empty-description"/>', $text);
|
||||
$text = preg_replace("/\[zmg\](.*?)\[\/zmg\]/ism", '<img src="$1" alt="' . DI::l10n()->t('Image/photo') . '" class="empty-description" />', $text);
|
||||
|
||||
$text = self::convertImages($text, $simple_html, $uriid);
|
||||
|
||||
|
|
|
@ -3733,6 +3733,9 @@ class Item
|
|||
continue;
|
||||
}
|
||||
|
||||
if (empty($PostMedia->description) && DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'accessibility', 'hide_empty_descriptions')) {
|
||||
continue;
|
||||
}
|
||||
$images[] = $PostMedia->withUrl(new Uri($src_url))->withPreview(new Uri($preview_url), $preview_size);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -93,6 +93,8 @@ class Display extends BaseSettings
|
|||
$enable_dislike = (bool)$request['enable_dislike'];
|
||||
$display_resharer = (bool)$request['display_resharer'];
|
||||
$stay_local = (bool)$request['stay_local'];
|
||||
$hide_empty_descriptions = (bool)$request['hide_empty_descriptions'];
|
||||
$hide_custom_emojis = (bool)$request['hide_custom_emojis'];
|
||||
$show_page_drop = (bool)$request['show_page_drop'];
|
||||
$display_eventlist = (bool)$request['display_eventlist'];
|
||||
$preview_mode = (int)$request['preview_mode'];
|
||||
|
@ -152,6 +154,9 @@ class Display extends BaseSettings
|
|||
$this->pConfig->set($uid, 'system', 'enabled_timelines' , $enabled_timelines);
|
||||
$this->pConfig->set($uid, 'channel', 'languages' , $channel_languages);
|
||||
|
||||
$this->pConfig->set($uid, 'accessibility', 'hide_empty_descriptions', $hide_empty_descriptions);
|
||||
$this->pConfig->set($uid, 'accessibility', 'hide_custom_emojis' , $hide_custom_emojis);
|
||||
|
||||
$this->pConfig->set($uid, 'calendar', 'first_day_of_week' , $first_day_of_week);
|
||||
$this->pConfig->set($uid, 'calendar', 'default_view' , $calendar_default_view);
|
||||
|
||||
|
@ -241,6 +246,9 @@ class Display extends BaseSettings
|
|||
$show_page_drop = $this->pConfig->get($uid, 'system', 'show_page_drop', true);
|
||||
$display_eventlist = $this->pConfig->get($uid, 'system', 'display_eventlist', true);
|
||||
|
||||
$hide_empty_descriptions = $this->pConfig->get($uid, 'accessibility', 'hide_empty_descriptions', false);
|
||||
$hide_custom_emojis = $this->pConfig->get($uid, 'accessibility', 'hide_custom_emojis', false);
|
||||
|
||||
$preview_mode = $this->pConfig->get($uid, 'system', 'preview_mode', BBCode::PREVIEW_LARGE);
|
||||
$preview_modes = [
|
||||
BBCode::PREVIEW_NONE => $this->t('No preview'),
|
||||
|
@ -320,6 +328,8 @@ class Display extends BaseSettings
|
|||
'$show_page_drop' => ['show_page_drop' , $this->t('Show the post deletion checkbox'), $show_page_drop, $this->t("Display the checkbox for the post deletion on the network page.")],
|
||||
'$display_eventlist' => ['display_eventlist' , $this->t('DIsplay the event list'), $display_eventlist, $this->t("Display the birthday reminder and event list on the network page.")],
|
||||
'$preview_mode' => ['preview_mode' , $this->t('Link preview mode'), $preview_mode, $this->t('Appearance of the link preview that is added to each post with a link.'), $preview_modes, false],
|
||||
'$hide_empty_descriptions' => ['hide_empty_descriptions' , $this->t('Hide pictures with empty alternative text'), $hide_empty_descriptions, $this->t("Don't display pictures that are missing the alternative text.")],
|
||||
'$hide_custom_emojis' => ['hide_custom_emojis' , $this->t('Hide custom emojis'), $hide_custom_emojis, $this->t("Don't display custom emojis.")],
|
||||
|
||||
'$timeline_label' => $this->t('Label'),
|
||||
'$timeline_descriptiom' => $this->t('Description'),
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -28,7 +28,8 @@
|
|||
{{include file="field_checkbox.tpl" field=$show_page_drop}}
|
||||
{{include file="field_checkbox.tpl" field=$display_eventlist}}
|
||||
{{include file="field_select.tpl" field=$preview_mode}}
|
||||
|
||||
{{include file="field_checkbox.tpl" field=$hide_empty_descriptions}}
|
||||
{{include file="field_checkbox.tpl" field=$hide_custom_emojis}}
|
||||
<h2>{{$timeline_title}}</h2>
|
||||
{{$timeline_explanation}}
|
||||
<table class="table table-condensed table-striped table-bordered">
|
||||
|
|
|
@ -75,6 +75,8 @@
|
|||
{{include file="field_checkbox.tpl" field=$show_page_drop}}
|
||||
{{include file="field_checkbox.tpl" field=$display_eventlist}}
|
||||
{{include file="field_select.tpl" field=$preview_mode}}
|
||||
{{include file="field_checkbox.tpl" field=$hide_empty_descriptions}}
|
||||
{{include file="field_checkbox.tpl" field=$hide_custom_emojis}}
|
||||
</div>
|
||||
<div class="panel-footer">
|
||||
<button type="submit" name="submit" class="btn btn-primary" value="{{$submit}}">{{$submit}}</button>
|
||||
|
|
Loading…
Reference in a new issue