Common emojis section when creating a new post

merge-requests/30/head
Bob Mottram 2022-04-19 12:22:23 +01:00
parent 9b1b48529e
commit 9eced44d76
24 changed files with 158 additions and 59 deletions

View File

@ -1,6 +1,11 @@
@charset "UTF-8";
:root {
--hashtag-margin: 2%;
--hashtag-size1: 30px;
--hashtag-size2: 40px;
--hashtag-vertical-spacing1: 50px;
--hashtag-vertical-spacing3: 100px;
--likes-names-margin: 2%;
--likes-names-size1: 30px;
--likes-names-size2: 40px;
@ -1104,6 +1109,20 @@ h3 {
font-size: var(--font-size);
color: var(--title-color);
}
.hashtagswarm {
font-size: var(--hashtag-size1);
font-family: Arial, Helvetica, sans-serif;
margin: var(--hashtag-margin);
line-height: var(--hashtag-vertical-spacing1);
-webkit-user-select: all;
-ms-user-select: all;
user-select: all;
white-space: nowrap;
}
.hashtagswarm img {
width: 5%;
min-width: 5%;
}
.likerNames {
font-size: var(--liker-names-size1);
font-family: Arial, Helvetica, sans-serif;
@ -1877,6 +1896,20 @@ h3 {
blockquote {
font-size: var(--quote-font-size-mobile);
}
.hashtagswarm {
font-size: var(--hashtag-size2);
font-family: Arial, Helvetica, sans-serif;
margin: var(--hashtag-margin);
line-height: var(--hashtag-vertical-spacing3);
-webkit-user-select: all;
-ms-user-select: all;
user-select: all;
white-space: nowrap;
}
.hashtagswarm img {
width: 10%;
min-width: 10%;
}
.likerNames {
font-size: var(--liker-names-size2);
font-family: Arial, Helvetica, sans-serif;
@ -2622,6 +2655,20 @@ h3 {
blockquote {
font-size: var(--quote-font-size-tiny);
}
.hashtagswarm {
font-size: var(--font-size2);
font-family: Arial, Helvetica, sans-serif;
margin: var(--hashtag-margin);
line-height: var(--hashtag-vertical-spacing3);
-webkit-user-select: all;
-ms-user-select: all;
user-select: all;
white-space: nowrap;
}
.hashtagswarm img {
width: 10%;
min-width: 10%;
}
.likerNames {
font-size: var(--font-size2);
font-family: 'Arial, Helvetica, sans-serif';

View File

@ -544,5 +544,7 @@
"lang_oc": "الأوكسيتانية",
"lang_pt": "البرتغالية",
"lang_sw": "السواحيلية",
"lang_zh": "صينى"
"lang_zh": "صينى",
"Common emoji": "الرموز التعبيرية الشائعة",
"Copy and paste into your text": "نسخ ولصق في النص الخاص بك"
}

View File

@ -544,5 +544,7 @@
"lang_oc": "Occità",
"lang_pt": "Portuguès",
"lang_sw": "Suahili",
"lang_zh": "Xinès"
"lang_zh": "Xinès",
"Common emoji": "Emoji comú",
"Copy and paste into your text": "Copia i enganxa al teu text"
}

View File

@ -544,5 +544,7 @@
"lang_oc": "Ocsitaneg",
"lang_pt": "Portiwgaleg",
"lang_sw": "Swahili",
"lang_zh": "Tseiniaidd"
"lang_zh": "Tseiniaidd",
"Common emoji": "Emoji cyffredin",
"Copy and paste into your text": "Copïwch a gludwch i'ch testun"
}

View File

@ -544,5 +544,7 @@
"lang_oc": "Okzitanisch",
"lang_pt": "Portugiesisch",
"lang_sw": "Suaheli",
"lang_zh": "Chinesisch"
"lang_zh": "Chinesisch",
"Common emoji": "Gewöhnliches Emoji",
"Copy and paste into your text": "Kopieren und in Ihren Text einfügen"
}

View File

@ -544,5 +544,7 @@
"lang_oc": "Occitan",
"lang_pt": "Portuguese",
"lang_sw": "Swahili",
"lang_zh": "Chinese"
"lang_zh": "Chinese",
"Common emoji": "Common emoji",
"Copy and paste into your text": "Copy and paste into your text"
}

View File

@ -544,5 +544,7 @@
"lang_oc": "Occitano",
"lang_pt": "Portuguesa",
"lang_sw": "Swahili",
"lang_zh": "China"
"lang_zh": "China",
"Common emoji": "Emoticonos comunes",
"Copy and paste into your text": "Copia y pega en tu texto"
}

View File

@ -544,5 +544,7 @@
"lang_oc": "Occitan",
"lang_pt": "Portugais",
"lang_sw": "Swahili",
"lang_zh": "Chinoise"
"lang_zh": "Chinoise",
"Common emoji": "Émoji commun",
"Copy and paste into your text": "Copiez et collez dans votre texte"
}

View File

@ -544,5 +544,7 @@
"lang_oc": "Béarla",
"lang_pt": "Portaingéilis",
"lang_sw": "Swahili",
"lang_zh": "Síneach"
"lang_zh": "Síneach",
"Common emoji": "Emoji coitianta",
"Copy and paste into your text": "Cóipeáil agus greamaigh isteach i do théacs"
}

View File

@ -544,5 +544,7 @@
"lang_oc": "ओसीटान",
"lang_pt": "पुर्तगाली",
"lang_sw": "Swahili",
"lang_zh": "चीनी"
"lang_zh": "चीनी",
"Common emoji": "आम इमोजी",
"Copy and paste into your text": "अपने टेक्स्ट में कॉपी और पेस्ट करें"
}

View File

@ -544,5 +544,7 @@
"lang_oc": "Occitano",
"lang_pt": "Portoghese",
"lang_sw": "Swahili",
"lang_zh": "Cinese"
"lang_zh": "Cinese",
"Common emoji": "Emoji comuni",
"Copy and paste into your text": "Copia e incolla nel tuo testo"
}

View File

@ -544,5 +544,7 @@
"lang_oc": "オック語",
"lang_pt": "ポルトガル語",
"lang_sw": "スワヒリ語",
"lang_zh": "中国語"
"lang_zh": "中国語",
"Common emoji": "一般的な絵文字",
"Copy and paste into your text": "コピーしてテキストに貼り付けます"
}

View File

@ -544,5 +544,7 @@
"lang_oc": "옥시탄",
"lang_pt": "포르투갈 인",
"lang_sw": "스와힐리어",
"lang_zh": "중국인"
"lang_zh": "중국인",
"Common emoji": "일반적인 이모티콘",
"Copy and paste into your text": "텍스트에 복사하여 붙여넣기"
}

View File

@ -544,5 +544,7 @@
"lang_oc": "Occitan",
"lang_pt": "Portekizî",
"lang_sw": "Swahîlîyî",
"lang_zh": "Çînî"
"lang_zh": "Çînî",
"Common emoji": "Emojiyên hevpar",
"Copy and paste into your text": "Di nivîsa xwe de kopî bikin û bixin"
}

View File

@ -540,5 +540,7 @@
"lang_oc": "Occitan",
"lang_pt": "Portuguese",
"lang_sw": "Swahili",
"lang_zh": "Chinese"
"lang_zh": "Chinese",
"Common emoji": "Common emoji",
"Copy and paste into your text": "Copy and paste into your text"
}

View File

@ -544,5 +544,7 @@
"lang_oc": "Prowansalski",
"lang_pt": "Portugalski",
"lang_sw": "Suahili",
"lang_zh": "Chiński"
"lang_zh": "Chiński",
"Common emoji": "Popularne emotikony",
"Copy and paste into your text": "Skopiuj i wklej do swojego tekstu"
}

View File

@ -544,5 +544,7 @@
"lang_oc": "Occitano",
"lang_pt": "Português",
"lang_sw": "Suaíli",
"lang_zh": "Chinês"
"lang_zh": "Chinês",
"Common emoji": "Emoji comum",
"Copy and paste into your text": "Copie e cole no seu texto"
}

View File

@ -544,5 +544,7 @@
"lang_oc": "окситанский",
"lang_pt": "португальский",
"lang_sw": "суахили",
"lang_zh": "Китайский"
"lang_zh": "Китайский",
"Common emoji": "Общие смайлики",
"Copy and paste into your text": "Скопируйте и вставьте в свой текст"
}

View File

@ -544,5 +544,7 @@
"lang_oc": "Oksitani",
"lang_pt": "Kireno",
"lang_sw": "Kiswahili",
"lang_zh": "Kichina"
"lang_zh": "Kichina",
"Common emoji": "Emoji ya kawaida",
"Copy and paste into your text": "Nakili na ubandike kwenye maandishi yako"
}

View File

@ -544,5 +544,7 @@
"lang_oc": "окситанський",
"lang_pt": "португальська",
"lang_sw": "суахілі",
"lang_zh": "китайський"
"lang_zh": "китайський",
"Common emoji": "Звичайні емодзі",
"Copy and paste into your text": "Скопіюйте та вставте у свій текст"
}

View File

@ -544,5 +544,7 @@
"lang_oc": "奥克西坦",
"lang_pt": "葡萄牙语",
"lang_sw": "斯瓦希里语",
"lang_zh": "中国人"
"lang_zh": "中国人",
"Common emoji": "常见表情符号",
"Copy and paste into your text": "复制并粘贴到您的文本中"
}

View File

@ -19,6 +19,7 @@ from utils import get_currencies
from utils import get_category_types
from utils import get_account_timezone
from utils import get_supported_languages
from webapp_utils import html_common_emoji
from webapp_utils import begin_edit_section
from webapp_utils import end_edit_section
from webapp_utils import get_banner_file
@ -381,6 +382,14 @@ def html_new_post(css_cache: {}, media_instance: bool, translate: {},
'imageDescription', '')
new_post_image_section += end_edit_section()
new_post_emoji_section = \
begin_edit_section('😀 ' + translate['Common emoji'])
new_post_emoji_section += \
'<label class="labels">' + \
translate['Copy and paste into your text'] + '</label><br>\n'
new_post_emoji_section += html_common_emoji(base_dir, 16)
new_post_emoji_section += end_edit_section()
scope_icon = 'scope_public.png'
scope_description = translate['Public']
if share_description:
@ -826,6 +835,7 @@ def html_new_post(css_cache: {}, media_instance: bool, translate: {},
new_post_form += reply_str
if media_instance and not reply_str:
new_post_form += new_post_image_section
new_post_form += new_post_emoji_section
if not share_description:
share_description = ''
@ -880,6 +890,7 @@ def html_new_post(css_cache: {}, media_instance: bool, translate: {},
extra_fields + citations_str + replies_section + date_and_location
if not media_instance or reply_str:
new_post_form += new_post_image_section
new_post_form += new_post_emoji_section
new_post_form += \
' <div class="container">\n' + \

View File

@ -30,6 +30,7 @@ from skills import get_skills_from_list
from categories import get_hashtag_category
from feeds import rss2tag_header
from feeds import rss2tag_footer
from webapp_utils import html_common_emoji
from webapp_utils import set_custom_background
from webapp_utils import html_keyboard_navigation
from webapp_utils import html_header_with_external_style
@ -330,44 +331,6 @@ def html_search_shared_items(css_cache: {}, translate: {},
return shared_items_form
def _html_common_emoji(base_dir: str, no_of_emoji: int) -> str:
"""Shows common emoji
"""
common_emoji_filename = base_dir + '/accounts/common_emoji.txt'
if not os.path.isfile(common_emoji_filename):
return ''
common_emoji = None
try:
with open(common_emoji_filename, 'r') as fp_emoji:
common_emoji = fp_emoji.readlines()
except OSError:
print('EX: html_common_emoji unable to load file')
return ''
if not common_emoji:
return ''
line_ctr = 0
ctr = 0
html_str = ''
while ctr < no_of_emoji and line_ctr < len(common_emoji):
emoji_name = common_emoji[ctr].split(' ')[1].replace('\n', '')
emoji_filename = base_dir + '/emoji/' + emoji_name + '.png'
if os.path.isfile(emoji_filename):
# NOTE: deliberately no alt text, so that without graphics only
# the emoji name shows
html_str += \
'<label class="hashtagswarm"><img ' + \
'src="/emoji/' + emoji_name + '.png" ' + \
'alt="" title="">' + \
':' + emoji_name + ':</label>\n'
ctr += 1
line_ctr += 1
if html_str:
html_str = \
'<center><div class="container"><p>' + html_str + \
'</p></div></center>\n'
return html_str
def html_search_emoji_text_entry(css_cache: {}, translate: {},
base_dir: str, path: str) -> str:
"""Search for an emoji by name
@ -407,7 +370,11 @@ def html_search_emoji_text_entry(css_cache: {}, translate: {},
emoji_str += ' </form>\n'
emoji_str += ' </center>\n'
emoji_str += ' </div>\n'
emoji_str += _html_common_emoji(base_dir, 16)
emoji_str += ' <center>\n'
emoji_str += ' <div class="container"><p>\n'
emoji_str += html_common_emoji(base_dir, 16) + '\n'
emoji_str += ' </p></div>\n'
emoji_str += ' </center>\n'
emoji_str += '</div>\n'
emoji_str += html_footer()
return emoji_str

View File

@ -1672,3 +1672,37 @@ def set_custom_background(base_dir: str, background: str,
base_dir + '/accounts/' + new_background + '.' + ext)
return ext
return None
def html_common_emoji(base_dir: str, no_of_emoji: int) -> str:
"""Shows common emoji
"""
common_emoji_filename = base_dir + '/accounts/common_emoji.txt'
if not os.path.isfile(common_emoji_filename):
return ''
common_emoji = None
try:
with open(common_emoji_filename, 'r') as fp_emoji:
common_emoji = fp_emoji.readlines()
except OSError:
print('EX: html_common_emoji unable to load file')
return ''
if not common_emoji:
return ''
line_ctr = 0
ctr = 0
html_str = ''
while ctr < no_of_emoji and line_ctr < len(common_emoji):
emoji_name = common_emoji[ctr].split(' ')[1].replace('\n', '')
emoji_filename = base_dir + '/emoji/' + emoji_name + '.png'
if os.path.isfile(emoji_filename):
# NOTE: deliberately no alt text, so that without graphics only
# the emoji name shows
html_str += \
'<label class="hashtagswarm"><img ' + \
'src="/emoji/' + emoji_name + '.png" ' + \
'alt="" title="">' + \
':' + emoji_name + ':</label>\n'
ctr += 1
line_ctr += 1
return html_str