From e3ac7c5d6c0d3ffc78bb918c218875d9a0b66b57 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Mon, 18 Apr 2022 21:49:53 +0100 Subject: [PATCH 01/30] Maintain a list of common emoji reactions --- reaction.py | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/reaction.py b/reaction.py index b8f530caa..d511fb231 100644 --- a/reaction.py +++ b/reaction.py @@ -446,6 +446,54 @@ def outbox_undo_reaction(recent_posts_cache: {}, print('DEBUG: post undo reaction via c2s - ' + post_filename) +def _update_common_reactions(base_dir: str, emoji_content: str) -> None: + """Updates the list of commonly used reactions + """ + common_reactions_filename = base_dir + '/accounts/common_reactions.txt' + common_reactions = None + if os.path.isfile(common_reactions_filename): + try: + with open(common_reactions_filename, 'r') as fp_react: + common_reactions = fp_react.readlines() + except OSError: + print('EX: unable to load common reactions file') + pass + if common_reactions: + new_common_reactions = [] + reaction_found = False + for line in common_reactions: + if ' ' + emoji_content in line: + if not reaction_found: + reaction_found = True + counter = 1 + count_str = line.split(' ')[0] + if count_str.isdigit(): + counter = int(count_str) + 1 + count_str = str(counter).zfill(16) + line = count_str + ' ' + emoji_content + new_common_reactions.append(line) + else: + new_common_reactions.append(line.replace('\n', '')) + if not reaction_found: + new_common_reactions.append(str(1).zfill(16) + ' ' + emoji_content) + new_common_reactions.sort(reverse=True) + try: + with open(common_reactions_filename, 'w+') as fp_react: + for line in new_common_reactions: + fp_react.write(line + '\n') + except OSError: + print('EX: error writing common reactions 1') + return + else: + line = str(1).zfill(16) + ' ' + emoji_content + '\n' + try: + with open(common_reactions_filename, 'w+') as fp_react: + fp_react.write(line) + except OSError: + print('EX: error writing common reactions 2') + return + + def update_reaction_collection(recent_posts_cache: {}, base_dir: str, post_filename: str, object_url: str, actor: str, @@ -515,6 +563,8 @@ def update_reaction_collection(recent_posts_cache: {}, itlen = len(obj['reactions']['items']) obj['reactions']['totalItems'] = itlen + _update_common_reactions(base_dir, emoji_content) + if debug: print('DEBUG: saving post with emoji reaction added') pprint(post_json_object) From d927ebb41e638c7e0c404c1b4cb804191672224d Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Mon, 18 Apr 2022 22:02:03 +0100 Subject: [PATCH 02/30] Store commonly used emoji --- content.py | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/content.py b/content.py index 08363ec1a..93c556811 100644 --- a/content.py +++ b/content.py @@ -322,6 +322,55 @@ def _save_custom_emoji(session, base_dir: str, emojiName: str, url: str, print('EX: cusom emoji already saved') +def _update_common_emoji(base_dir: str, emoji_content: str) -> None: + """Updates the list of commonly used emoji + """ + emoji_content = emoji_content.replace(':', '') + common_emoji_filename = base_dir + '/accounts/common_emoji.txt' + common_emoji = None + if os.path.isfile(common_emoji_filename): + try: + with open(common_emoji_filename, 'r') as fp_emoji: + common_emoji = fp_emoji.readlines() + except OSError: + print('EX: unable to load common emoji file') + pass + if common_emoji: + new_common_emoji = [] + emoji_found = False + for line in common_emoji: + if ' ' + emoji_content in line: + if not emoji_found: + emoji_found = True + counter = 1 + count_str = line.split(' ')[0] + if count_str.isdigit(): + counter = int(count_str) + 1 + count_str = str(counter).zfill(16) + line = count_str + ' ' + emoji_content + new_common_emoji.append(line) + else: + new_common_emoji.append(line.replace('\n', '')) + if not emoji_found: + new_common_emoji.append(str(1).zfill(16) + ' ' + emoji_content) + new_common_emoji.sort(reverse=True) + try: + with open(common_emoji_filename, 'w+') as fp_emoji: + for line in new_common_emoji: + fp_emoji.write(line + '\n') + except OSError: + print('EX: error writing common emoji 1') + return + else: + line = str(1).zfill(16) + ' ' + emoji_content + '\n' + try: + with open(common_emoji_filename, 'w+') as fp_emoji: + fp_emoji.write(line) + except OSError: + print('EX: error writing common emoji 2') + return + + def replace_emoji_from_tags(session, base_dir: str, content: str, tag: [], message_type: str, debug: bool) -> str: @@ -345,6 +394,7 @@ def replace_emoji_from_tags(session, base_dir: str, icon_name = tag_item['icon']['url'].split('/')[-1] if icon_name: if len(icon_name) > 1: + _update_common_emoji(base_dir, icon_name) if icon_name[0].isdigit(): if '.' in icon_name: icon_name = icon_name.split('.')[0] From 814aa5275e19ad9ade2a0f53a3a75cafbb225c08 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Mon, 18 Apr 2022 22:04:22 +0100 Subject: [PATCH 03/30] Missing object --- daemon.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/daemon.py b/daemon.py index f2693d88c..c5e029fce 100644 --- a/daemon.py +++ b/daemon.py @@ -1717,7 +1717,7 @@ class PubServer(BaseHTTPRequestHandler): if not isinstance(message_json['object'][check_field], str): print('INBOX: ' + check_field + ' should be a string ' + - str(message_json[check_field])) + str(message_json['object'][check_field])) self._400() self.server.postreq_busy = False return 3 @@ -1731,7 +1731,7 @@ class PubServer(BaseHTTPRequestHandler): if not isinstance(message_json['object'][check_field], list): print('INBOX: ' + check_field + ' should be a list ' + - str(message_json[check_field])) + str(message_json['object'][check_field])) self._400() self.server.postreq_busy = False return 3 From 9878d637fa91f1c0c0fd9b1e6ad06929314779d3 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Mon, 18 Apr 2022 22:13:08 +0100 Subject: [PATCH 04/30] Remove file ending --- content.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/content.py b/content.py index 93c556811..2fcd0318b 100644 --- a/content.py +++ b/content.py @@ -325,6 +325,8 @@ def _save_custom_emoji(session, base_dir: str, emojiName: str, url: str, def _update_common_emoji(base_dir: str, emoji_content: str) -> None: """Updates the list of commonly used emoji """ + if '.' in emoji_content: + emoji_content = emoji_content.split('.')[0] emoji_content = emoji_content.replace(':', '') common_emoji_filename = base_dir + '/accounts/common_emoji.txt' common_emoji = None From f1d7d07d3b90d4f54a4c0182c34c1fcdfbf81836 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Mon, 18 Apr 2022 23:19:27 +0100 Subject: [PATCH 05/30] Show common emoji on search screen --- webapp_search.py | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/webapp_search.py b/webapp_search.py index 1213593c3..6936a9f01 100644 --- a/webapp_search.py +++ b/webapp_search.py @@ -330,6 +330,42 @@ 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 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 += \ + '
' + \ + '
:' + emoji_name + ':
\n' + ctr += 1 + line_ctr += 1 + if html_str: + html_str = \ + '
' + html_str + '
\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 @@ -367,6 +403,7 @@ def html_search_emoji_text_entry(css_cache: {}, translate: {}, ' \n' emoji_str += ' \n' + emoji_str += _html_common_emoji(base_dir, 8) emoji_str += ' \n' emoji_str += ' \n' emoji_str += '\n' From 35b8ba9ff2455538cd5ef9f7bf5b815001905859 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Mon, 18 Apr 2022 23:21:34 +0100 Subject: [PATCH 06/30] Line counter --- webapp_search.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webapp_search.py b/webapp_search.py index 6936a9f01..b1a72a6e0 100644 --- a/webapp_search.py +++ b/webapp_search.py @@ -348,7 +348,7 @@ def _html_common_emoji(base_dir: str, no_of_emoji: int) -> str: line_ctr = 0 ctr = 0 html_str = '' - while ctr < no_of_emoji and ctr < len(common_emoji): + 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): From 99bad0d7331e0c37bb4d00335901f0c227d5dcfe Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Mon, 18 Apr 2022 23:34:43 +0100 Subject: [PATCH 07/30] Emoji width --- epicyon-follow.css | 18 ++++++++++++++++++ webapp_search.py | 3 ++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/epicyon-follow.css b/epicyon-follow.css index bcb4a7024..c8eaa8753 100644 --- a/epicyon-follow.css +++ b/epicyon-follow.css @@ -246,6 +246,12 @@ input[type=text] { padding: 10px; margin: 20px 30px; } + figure img.common_emoji { + width: 5%; + } + figcaption { + font-size: var(--font-size); + } } @media screen and (max-width: 1000px) { @@ -293,6 +299,12 @@ input[type=text] { padding: 20px; margin: 30px 40px; } + figure img.common_emoji { + width: 5%; + } + figcaption { + font-size: var(--font-size); + } } @media screen and (max-width: 480px) { @@ -343,4 +355,10 @@ input[type=text] { padding: 20px; margin: 30px 40px; } + figure img.common_emoji { + width: 5%; + } + figcaption { + font-size: var(--font-size); + } } diff --git a/webapp_search.py b/webapp_search.py index b1a72a6e0..ff87847c8 100644 --- a/webapp_search.py +++ b/webapp_search.py @@ -355,7 +355,8 @@ def _html_common_emoji(base_dir: str, no_of_emoji: int) -> str: # NOTE: deliberately no alt text, so that without graphics only # the emoji name shows html_str += \ - '
' + \ '
:' + emoji_name + ':
\n' ctr += 1 From 259c9cb3645e21266d8acf866b7fd6f43f234f13 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Mon, 18 Apr 2022 23:46:20 +0100 Subject: [PATCH 08/30] Emoji position --- epicyon-follow.css | 13 ++++++++++--- webapp_search.py | 4 ++-- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/epicyon-follow.css b/epicyon-follow.css index c8eaa8753..e1edcd628 100644 --- a/epicyon-follow.css +++ b/epicyon-follow.css @@ -201,6 +201,10 @@ input[type=text] { width: 15%; } +.container { + width: 100%; +} + @media screen and (min-width: 400px) { .hashtagswarm { font-size: var(--hashtag-size1); @@ -246,8 +250,9 @@ input[type=text] { padding: 10px; margin: 20px 30px; } - figure img.common_emoji { + .container img { width: 5%; + min-width: 5%; } figcaption { font-size: var(--font-size); @@ -299,8 +304,9 @@ input[type=text] { padding: 20px; margin: 30px 40px; } - figure img.common_emoji { + .container img { width: 5%; + min-width: 5%; } figcaption { font-size: var(--font-size); @@ -355,8 +361,9 @@ input[type=text] { padding: 20px; margin: 30px 40px; } - figure img.common_emoji { + .container img { width: 5%; + min-width: 5%; } figcaption { font-size: var(--font-size); diff --git a/webapp_search.py b/webapp_search.py index ff87847c8..9a4ba9550 100644 --- a/webapp_search.py +++ b/webapp_search.py @@ -363,7 +363,7 @@ def _html_common_emoji(base_dir: str, no_of_emoji: int) -> str: line_ctr += 1 if html_str: html_str = \ - '
' + html_str + '
\n' + '
' + html_str + '
\n' return html_str @@ -404,10 +404,10 @@ def html_search_emoji_text_entry(css_cache: {}, translate: {}, ' \n' emoji_str += ' \n' - emoji_str += _html_common_emoji(base_dir, 8) emoji_str += ' \n' emoji_str += ' \n' emoji_str += '\n' + emoji_str += _html_common_emoji(base_dir, 8) emoji_str += html_footer() return emoji_str From b89997bc45df32e9818645682301343b9e86f4c2 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Mon, 18 Apr 2022 23:49:05 +0100 Subject: [PATCH 09/30] Emoji position --- epicyon-follow.css | 4 ++++ webapp_search.py | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/epicyon-follow.css b/epicyon-follow.css index e1edcd628..8ed535bb3 100644 --- a/epicyon-follow.css +++ b/epicyon-follow.css @@ -114,6 +114,10 @@ a:focus { background-color: var(--main-bg-color); } +.follow container { + width: 100%; +} + .followAvatar { margin: 0% 0; } diff --git a/webapp_search.py b/webapp_search.py index 9a4ba9550..116fbfb12 100644 --- a/webapp_search.py +++ b/webapp_search.py @@ -406,8 +406,8 @@ def html_search_emoji_text_entry(css_cache: {}, translate: {}, emoji_str += ' \n' emoji_str += ' \n' emoji_str += ' \n' - emoji_str += '\n' emoji_str += _html_common_emoji(base_dir, 8) + emoji_str += '\n' emoji_str += html_footer() return emoji_str From 075e2b3b30bf57a3a74641297df63b9c39d9e495 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Tue, 19 Apr 2022 10:23:49 +0100 Subject: [PATCH 10/30] Emoji label --- epicyon-follow.css | 33 ++++++++++++--------------------- webapp_search.py | 7 ++++--- 2 files changed, 16 insertions(+), 24 deletions(-) diff --git a/epicyon-follow.css b/epicyon-follow.css index 8ed535bb3..827394ca0 100644 --- a/epicyon-follow.css +++ b/epicyon-follow.css @@ -216,6 +216,10 @@ input[type=text] { margin: var(--hashtag-margin); line-height: var(--hashtag-vertical-spacing1); } + .hashtagswarm img { + width: 5%; + min-width: 5%; + } .followText { font-size: var(--follow-text-size1); font-family: Arial, Helvetica, sans-serif; @@ -254,13 +258,6 @@ input[type=text] { padding: 10px; margin: 20px 30px; } - .container img { - width: 5%; - min-width: 5%; - } - figcaption { - font-size: var(--font-size); - } } @media screen and (max-width: 1000px) { @@ -270,6 +267,10 @@ input[type=text] { margin: var(--hashtag-margin); line-height: var(--hashtag-vertical-spacing3); } + .hashtagswarm img { + width: 5%; + min-width: 5%; + } .followText { font-size: var(--follow-text-size2); font-family: Arial, Helvetica, sans-serif; @@ -308,13 +309,6 @@ input[type=text] { padding: 20px; margin: 30px 40px; } - .container img { - width: 5%; - min-width: 5%; - } - figcaption { - font-size: var(--font-size); - } } @media screen and (max-width: 480px) { @@ -327,6 +321,10 @@ input[type=text] { margin: var(--hashtag-margin); line-height: var(--hashtag-vertical-spacing3); } + .hashtagswarm img { + width: 5%; + min-width: 5%; + } .followText { font-size: var(--font-size2); font-family: Arial, Helvetica, sans-serif; @@ -365,11 +363,4 @@ input[type=text] { padding: 20px; margin: 30px 40px; } - .container img { - width: 5%; - min-width: 5%; - } - figcaption { - font-size: var(--font-size); - } } diff --git a/webapp_search.py b/webapp_search.py index 116fbfb12..b7cfd4b53 100644 --- a/webapp_search.py +++ b/webapp_search.py @@ -355,15 +355,16 @@ def _html_common_emoji(base_dir: str, no_of_emoji: int) -> str: # NOTE: deliberately no alt text, so that without graphics only # the emoji name shows html_str += \ - '
' + \ - '
:' + emoji_name + ':
\n' + ':' + emoji_name + ':\n' ctr += 1 line_ctr += 1 if html_str: html_str = \ - '
' + html_str + '
\n' + '

' + html_str + \ + '

\n' return html_str From 4abc01b64403913260fe29c9f855576f9f32cdf4 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Tue, 19 Apr 2022 10:45:20 +0100 Subject: [PATCH 11/30] Selection of text for common emoji --- epicyon-follow.css | 9 +++++++++ webapp_search.py | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/epicyon-follow.css b/epicyon-follow.css index 827394ca0..0f9f925e9 100644 --- a/epicyon-follow.css +++ b/epicyon-follow.css @@ -215,6 +215,9 @@ input[type=text] { 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; } .hashtagswarm img { width: 5%; @@ -266,6 +269,9 @@ input[type=text] { 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; } .hashtagswarm img { width: 5%; @@ -320,6 +326,9 @@ input[type=text] { 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; } .hashtagswarm img { width: 5%; diff --git a/webapp_search.py b/webapp_search.py index b7cfd4b53..534c5aeca 100644 --- a/webapp_search.py +++ b/webapp_search.py @@ -358,7 +358,7 @@ def _html_common_emoji(base_dir: str, no_of_emoji: int) -> str: '\n' + '\n' ctr += 1 line_ctr += 1 if html_str: From e6c686b4d1c62162035d013ccaa64075fe7a0a41 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Tue, 19 Apr 2022 10:46:57 +0100 Subject: [PATCH 12/30] Increase the number of common eomjis shown on search screen --- webapp_search.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webapp_search.py b/webapp_search.py index 534c5aeca..97187ff66 100644 --- a/webapp_search.py +++ b/webapp_search.py @@ -407,7 +407,7 @@ def html_search_emoji_text_entry(css_cache: {}, translate: {}, emoji_str += ' \n' emoji_str += ' \n' emoji_str += ' \n' - emoji_str += _html_common_emoji(base_dir, 8) + emoji_str += _html_common_emoji(base_dir, 16) emoji_str += '\n' emoji_str += html_footer() return emoji_str From 37e1973780869eee7a4202f51b0505ecf6947480 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Tue, 19 Apr 2022 10:54:42 +0100 Subject: [PATCH 13/30] Selecting emoji names on the emoji search results screen --- epicyon-follow.css | 28 ++++++++++++++-------------- epicyon-profile.css | 6 ++++++ 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/epicyon-follow.css b/epicyon-follow.css index 0f9f925e9..f5a55df8a 100644 --- a/epicyon-follow.css +++ b/epicyon-follow.css @@ -220,8 +220,8 @@ input[type=text] { user-select: all; } .hashtagswarm img { - width: 5%; - min-width: 5%; + width: 5%; + min-width: 5%; } .followText { font-size: var(--follow-text-size1); @@ -253,13 +253,13 @@ input[type=text] { } input[type=checkbox] { - -ms-transform: scale(2); - -moz-transform: scale(2); - -webkit-transform: scale(2); - -o-transform: scale(2); - transform: scale(2); - padding: 10px; - margin: 20px 30px; + -ms-transform: scale(2); + -moz-transform: scale(2); + -webkit-transform: scale(2); + -o-transform: scale(2); + transform: scale(2); + padding: 10px; + margin: 20px 30px; } } @@ -274,8 +274,8 @@ input[type=text] { user-select: all; } .hashtagswarm img { - width: 5%; - min-width: 5%; + width: 5%; + min-width: 5%; } .followText { font-size: var(--follow-text-size2); @@ -319,7 +319,7 @@ input[type=text] { @media screen and (max-width: 480px) { body, html { - min-width: 400px; + min-width: 400px; } .hashtagswarm { font-size: var(--font-size2); @@ -331,8 +331,8 @@ input[type=text] { user-select: all; } .hashtagswarm img { - width: 5%; - min-width: 5%; + width: 5%; + min-width: 5%; } .followText { font-size: var(--font-size2); diff --git a/epicyon-profile.css b/epicyon-profile.css index 9b678c737..c8f82cc3a 100644 --- a/epicyon-profile.css +++ b/epicyon-profile.css @@ -1082,6 +1082,12 @@ div.container { margin: 0 20%; } +h3 { + -webkit-user-select: all; + -ms-user-select: all; + user-select: all; +} + @media screen and (min-width: 400px) { body, html { background-color: var(--main-bg-color); From 426404c4b29dc350df9ccd292be8b6ab86c2d971 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Tue, 19 Apr 2022 10:56:24 +0100 Subject: [PATCH 14/30] No textareas --- webapp_search.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webapp_search.py b/webapp_search.py index 97187ff66..0b8040e79 100644 --- a/webapp_search.py +++ b/webapp_search.py @@ -358,7 +358,7 @@ def _html_common_emoji(base_dir: str, no_of_emoji: int) -> str: '\n' + ':' + emoji_name + ':\n' ctr += 1 line_ctr += 1 if html_str: From c2594f66896a760489911f97f2e3ae7067ee0896 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Tue, 19 Apr 2022 11:08:29 +0100 Subject: [PATCH 15/30] Larger emoji on smaller screens --- epicyon-follow.css | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/epicyon-follow.css b/epicyon-follow.css index f5a55df8a..9003297bc 100644 --- a/epicyon-follow.css +++ b/epicyon-follow.css @@ -274,8 +274,8 @@ input[type=text] { user-select: all; } .hashtagswarm img { - width: 5%; - min-width: 5%; + width: 10%; + min-width: 10%; } .followText { font-size: var(--follow-text-size2); @@ -331,8 +331,8 @@ input[type=text] { user-select: all; } .hashtagswarm img { - width: 5%; - min-width: 5%; + width: 10%; + min-width: 10%; } .followText { font-size: var(--font-size2); From 9b1b48529e7429ecf557a3355c2d9b33ddc7f784 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Tue, 19 Apr 2022 11:12:08 +0100 Subject: [PATCH 16/30] Don't wrap whitespace --- epicyon-follow.css | 3 +++ 1 file changed, 3 insertions(+) diff --git a/epicyon-follow.css b/epicyon-follow.css index 9003297bc..bfbbe808d 100644 --- a/epicyon-follow.css +++ b/epicyon-follow.css @@ -218,6 +218,7 @@ input[type=text] { -webkit-user-select: all; -ms-user-select: all; user-select: all; + white-space: nowrap; } .hashtagswarm img { width: 5%; @@ -272,6 +273,7 @@ input[type=text] { -webkit-user-select: all; -ms-user-select: all; user-select: all; + white-space: nowrap; } .hashtagswarm img { width: 10%; @@ -329,6 +331,7 @@ input[type=text] { -webkit-user-select: all; -ms-user-select: all; user-select: all; + white-space: nowrap; } .hashtagswarm img { width: 10%; From 9eced44d766aeaaf1dff05f57214cc38ff41b820 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Tue, 19 Apr 2022 12:22:23 +0100 Subject: [PATCH 17/30] Common emojis section when creating a new post --- epicyon-profile.css | 47 +++++++++++++++++++++++++++++++++++++++++++ translations/ar.json | 4 +++- translations/ca.json | 4 +++- translations/cy.json | 4 +++- translations/de.json | 4 +++- translations/en.json | 4 +++- translations/es.json | 4 +++- translations/fr.json | 4 +++- translations/ga.json | 4 +++- translations/hi.json | 4 +++- translations/it.json | 4 +++- translations/ja.json | 4 +++- translations/ko.json | 4 +++- translations/ku.json | 4 +++- translations/oc.json | 4 +++- translations/pl.json | 4 +++- translations/pt.json | 4 +++- translations/ru.json | 4 +++- translations/sw.json | 4 +++- translations/uk.json | 4 +++- translations/zh.json | 4 +++- webapp_create_post.py | 11 ++++++++++ webapp_search.py | 45 ++++++----------------------------------- webapp_utils.py | 34 +++++++++++++++++++++++++++++++ 24 files changed, 158 insertions(+), 59 deletions(-) diff --git a/epicyon-profile.css b/epicyon-profile.css index c8f82cc3a..b1233f330 100644 --- a/epicyon-profile.css +++ b/epicyon-profile.css @@ -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'; diff --git a/translations/ar.json b/translations/ar.json index 82cfd684e..b1e77a64b 100644 --- a/translations/ar.json +++ b/translations/ar.json @@ -544,5 +544,7 @@ "lang_oc": "الأوكسيتانية", "lang_pt": "البرتغالية", "lang_sw": "السواحيلية", - "lang_zh": "صينى" + "lang_zh": "صينى", + "Common emoji": "الرموز التعبيرية الشائعة", + "Copy and paste into your text": "نسخ ولصق في النص الخاص بك" } diff --git a/translations/ca.json b/translations/ca.json index 56a0d088e..1c250ca7e 100644 --- a/translations/ca.json +++ b/translations/ca.json @@ -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" } diff --git a/translations/cy.json b/translations/cy.json index 46678d36e..4df858f12 100644 --- a/translations/cy.json +++ b/translations/cy.json @@ -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" } diff --git a/translations/de.json b/translations/de.json index 95e049766..ebe210e6b 100644 --- a/translations/de.json +++ b/translations/de.json @@ -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" } diff --git a/translations/en.json b/translations/en.json index 6b0837189..059f1ea90 100644 --- a/translations/en.json +++ b/translations/en.json @@ -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" } diff --git a/translations/es.json b/translations/es.json index 17b8fa63e..8f8ded93e 100644 --- a/translations/es.json +++ b/translations/es.json @@ -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" } diff --git a/translations/fr.json b/translations/fr.json index f58c6dfbe..869b5a612 100644 --- a/translations/fr.json +++ b/translations/fr.json @@ -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" } diff --git a/translations/ga.json b/translations/ga.json index d926e2297..1b9e61da3 100644 --- a/translations/ga.json +++ b/translations/ga.json @@ -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" } diff --git a/translations/hi.json b/translations/hi.json index 117e07501..41c166e2b 100644 --- a/translations/hi.json +++ b/translations/hi.json @@ -544,5 +544,7 @@ "lang_oc": "ओसीटान", "lang_pt": "पुर्तगाली", "lang_sw": "Swahili", - "lang_zh": "चीनी" + "lang_zh": "चीनी", + "Common emoji": "आम इमोजी", + "Copy and paste into your text": "अपने टेक्स्ट में कॉपी और पेस्ट करें" } diff --git a/translations/it.json b/translations/it.json index 943f9fb17..a329d132c 100644 --- a/translations/it.json +++ b/translations/it.json @@ -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" } diff --git a/translations/ja.json b/translations/ja.json index 5c0a3a5cf..c2a12661e 100644 --- a/translations/ja.json +++ b/translations/ja.json @@ -544,5 +544,7 @@ "lang_oc": "オック語", "lang_pt": "ポルトガル語", "lang_sw": "スワヒリ語", - "lang_zh": "中国語" + "lang_zh": "中国語", + "Common emoji": "一般的な絵文字", + "Copy and paste into your text": "コピーしてテキストに貼り付けます" } diff --git a/translations/ko.json b/translations/ko.json index 357d59cc9..c9e30c908 100644 --- a/translations/ko.json +++ b/translations/ko.json @@ -544,5 +544,7 @@ "lang_oc": "옥시탄", "lang_pt": "포르투갈 인", "lang_sw": "스와힐리어", - "lang_zh": "중국인" + "lang_zh": "중국인", + "Common emoji": "일반적인 이모티콘", + "Copy and paste into your text": "텍스트에 복사하여 붙여넣기" } diff --git a/translations/ku.json b/translations/ku.json index 6416f3408..920756b66 100644 --- a/translations/ku.json +++ b/translations/ku.json @@ -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" } diff --git a/translations/oc.json b/translations/oc.json index 03b7c7cb0..09b274b18 100644 --- a/translations/oc.json +++ b/translations/oc.json @@ -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" } diff --git a/translations/pl.json b/translations/pl.json index 50e42f8d5..f88f3d844 100644 --- a/translations/pl.json +++ b/translations/pl.json @@ -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" } diff --git a/translations/pt.json b/translations/pt.json index de70aeddb..060083ce1 100644 --- a/translations/pt.json +++ b/translations/pt.json @@ -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" } diff --git a/translations/ru.json b/translations/ru.json index b06b21eea..2886a8258 100644 --- a/translations/ru.json +++ b/translations/ru.json @@ -544,5 +544,7 @@ "lang_oc": "окситанский", "lang_pt": "португальский", "lang_sw": "суахили", - "lang_zh": "Китайский" + "lang_zh": "Китайский", + "Common emoji": "Общие смайлики", + "Copy and paste into your text": "Скопируйте и вставьте в свой текст" } diff --git a/translations/sw.json b/translations/sw.json index f765626ac..e7412ba0c 100644 --- a/translations/sw.json +++ b/translations/sw.json @@ -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" } diff --git a/translations/uk.json b/translations/uk.json index 6df79c654..a1afb5f8c 100644 --- a/translations/uk.json +++ b/translations/uk.json @@ -544,5 +544,7 @@ "lang_oc": "окситанський", "lang_pt": "португальська", "lang_sw": "суахілі", - "lang_zh": "китайський" + "lang_zh": "китайський", + "Common emoji": "Звичайні емодзі", + "Copy and paste into your text": "Скопіюйте та вставте у свій текст" } diff --git a/translations/zh.json b/translations/zh.json index e7c1cbbe9..76cc3775c 100644 --- a/translations/zh.json +++ b/translations/zh.json @@ -544,5 +544,7 @@ "lang_oc": "奥克西坦", "lang_pt": "葡萄牙语", "lang_sw": "斯瓦希里语", - "lang_zh": "中国人" + "lang_zh": "中国人", + "Common emoji": "常见表情符号", + "Copy and paste into your text": "复制并粘贴到您的文本中" } diff --git a/webapp_create_post.py b/webapp_create_post.py index e0a196353..47a85365f 100644 --- a/webapp_create_post.py +++ b/webapp_create_post.py @@ -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 += \ + '
\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 += \ '
\n' + \ diff --git a/webapp_search.py b/webapp_search.py index 0b8040e79..f15a12e3a 100644 --- a/webapp_search.py +++ b/webapp_search.py @@ -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 += \ - '\n' - ctr += 1 - line_ctr += 1 - if html_str: - html_str = \ - '

' + html_str + \ - '

\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 += ' \n' emoji_str += ' \n' emoji_str += '
\n' - emoji_str += _html_common_emoji(base_dir, 16) + emoji_str += '
\n' + emoji_str += '

\n' + emoji_str += html_common_emoji(base_dir, 16) + '\n' + emoji_str += '

\n' + emoji_str += '
\n' emoji_str += '\n' emoji_str += html_footer() return emoji_str diff --git a/webapp_utils.py b/webapp_utils.py index 04978db5e..4c4e35c1b 100644 --- a/webapp_utils.py +++ b/webapp_utils.py @@ -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 += \ + '\n' + ctr += 1 + line_ctr += 1 + return html_str From e6dec01bab0a0dc5c4abbe4dde1fdff5cede2664 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Tue, 19 Apr 2022 12:42:25 +0100 Subject: [PATCH 18/30] lazy load common emoji --- epicyon-profile.css | 6 +++--- webapp_utils.py | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/epicyon-profile.css b/epicyon-profile.css index b1233f330..cbaab7d90 100644 --- a/epicyon-profile.css +++ b/epicyon-profile.css @@ -1119,7 +1119,7 @@ h3 { user-select: all; white-space: nowrap; } - .hashtagswarm img { + .hashtagswarm img.commonemojilabel { width: 5%; min-width: 5%; } @@ -1906,7 +1906,7 @@ h3 { user-select: all; white-space: nowrap; } - .hashtagswarm img { + .hashtagswarm img.commonemojilabel { width: 10%; min-width: 10%; } @@ -2665,7 +2665,7 @@ h3 { user-select: all; white-space: nowrap; } - .hashtagswarm img { + .hashtagswarm img.commonemojilabel { width: 10%; min-width: 10%; } diff --git a/webapp_utils.py b/webapp_utils.py index 4c4e35c1b..852eba6d2 100644 --- a/webapp_utils.py +++ b/webapp_utils.py @@ -1699,7 +1699,8 @@ def html_common_emoji(base_dir: str, no_of_emoji: int) -> str: # NOTE: deliberately no alt text, so that without graphics only # the emoji name shows html_str += \ - '\n' From 914d35403f6ab9bd39e3c7079b4db9f6ddf03242 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Tue, 19 Apr 2022 12:44:11 +0100 Subject: [PATCH 19/30] Too many emoji sections --- webapp_create_post.py | 1 - 1 file changed, 1 deletion(-) diff --git a/webapp_create_post.py b/webapp_create_post.py index 47a85365f..87160146c 100644 --- a/webapp_create_post.py +++ b/webapp_create_post.py @@ -835,7 +835,6 @@ 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 = '' From 51b086ca9b2f14e681a2e0af7a55a2426a07e1be Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Tue, 19 Apr 2022 12:48:18 +0100 Subject: [PATCH 20/30] Image class --- webapp_utils.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/webapp_utils.py b/webapp_utils.py index 852eba6d2..607a36d21 100644 --- a/webapp_utils.py +++ b/webapp_utils.py @@ -1699,8 +1699,9 @@ def html_common_emoji(base_dir: str, no_of_emoji: int) -> str: # NOTE: deliberately no alt text, so that without graphics only # the emoji name shows html_str += \ - '\n' From a59f66cc46a5ae3fcb9a391cd805a21d1c0862d9 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Tue, 19 Apr 2022 13:05:42 +0100 Subject: [PATCH 21/30] Image id --- epicyon-profile.css | 15 +++++++++------ webapp_utils.py | 2 +- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/epicyon-profile.css b/epicyon-profile.css index cbaab7d90..075b1ec28 100644 --- a/epicyon-profile.css +++ b/epicyon-profile.css @@ -1117,9 +1117,10 @@ h3 { -webkit-user-select: all; -ms-user-select: all; user-select: all; - white-space: nowrap; + white-space: nowrap; } - .hashtagswarm img.commonemojilabel { + .commonemojilabel { + float: none; width: 5%; min-width: 5%; } @@ -1904,9 +1905,10 @@ h3 { -webkit-user-select: all; -ms-user-select: all; user-select: all; - white-space: nowrap; + white-space: nowrap; } - .hashtagswarm img.commonemojilabel { + .commonemojilabel { + float: none; width: 10%; min-width: 10%; } @@ -2663,9 +2665,10 @@ h3 { -webkit-user-select: all; -ms-user-select: all; user-select: all; - white-space: nowrap; + white-space: nowrap; } - .hashtagswarm img.commonemojilabel { + .commonemojilabel { + float: none; width: 10%; min-width: 10%; } diff --git a/webapp_utils.py b/webapp_utils.py index 607a36d21..fae6ca662 100644 --- a/webapp_utils.py +++ b/webapp_utils.py @@ -1700,7 +1700,7 @@ def html_common_emoji(base_dir: str, no_of_emoji: int) -> str: # the emoji name shows html_str += \ '