diff --git a/app/controllers/settings/preferences_controller.rb b/app/controllers/settings/preferences_controller.rb index 12bea3ec3..2ae90c7fb 100644 --- a/app/controllers/settings/preferences_controller.rb +++ b/app/controllers/settings/preferences_controller.rb @@ -56,6 +56,7 @@ class Settings::PreferencesController < Settings::BaseController :setting_roar_lifespan, :setting_delayed_roars, :setting_delayed_for, + :setting_show_cursor, :setting_default_privacy, :setting_default_sensitive, diff --git a/app/javascript/flavours/glitch/styles/monsterpit.scss b/app/javascript/flavours/glitch/styles/monsterpit.scss index 71b4f4910..6c9e30d47 100644 --- a/app/javascript/flavours/glitch/styles/monsterpit.scss +++ b/app/javascript/flavours/glitch/styles/monsterpit.scss @@ -19,6 +19,12 @@ color: darken($secondary-text-color, 20%); } } + span.cursor { + color: lighten($dark-text-color, 20%); + font-family: $font-monospace, monospace; + /* animation: t_blink 1s linear infinite; */ + } + /* span.cursor::before { content: " █" } */ } .composer--reply > .content { @@ -99,3 +105,8 @@ div.drawer__inner__admin { } } } + +@keyframes t_blink { + from { opacity: 1 } + to { opacity: 0 } +} diff --git a/app/lib/formatter.rb b/app/lib/formatter.rb index bbe123b54..3456f30f8 100644 --- a/app/lib/formatter.rb +++ b/app/lib/formatter.rb @@ -249,7 +249,8 @@ class Formatter end def format_console(html) - "
#{html}
"
+ cursor = ''
+ "#{html.strip.sub(/<\/p>\Z/, cursor)}
"
end
def format_markdown(html)
diff --git a/app/lib/user_settings_decorator.rb b/app/lib/user_settings_decorator.rb
index 5aedf3a1c..d64a252e2 100644
--- a/app/lib/user_settings_decorator.rb
+++ b/app/lib/user_settings_decorator.rb
@@ -40,6 +40,7 @@ class UserSettingsDecorator
user.settings['roar_lifespan'] = roar_lifespan_preference if change?('setting_roar_lifespan')
user.settings['delayed_roars'] = delayed_roars_preference if change?('setting_delayed_roars')
user.settings['delayed_for'] = delayed_for_preference if change?('setting_delayed_for')
+ user.settings['show_cursor'] = show_cursor_preference if change?('setting_show_cursor')
user.settings['notification_emails'] = merged_notification_emails if change?('notification_emails')
user.settings['interactions'] = merged_interactions if change?('interactions')
@@ -141,6 +142,10 @@ class UserSettingsDecorator
settings['setting_delayed_for']
end
+ def show_cursor_preference
+ settings['setting_show_cursor']
+ end
+
def delayed_roars_preference
settings['setting_delayed_roars']
end
diff --git a/app/models/account.rb b/app/models/account.rb
index 05fb387aa..6528a7ae9 100644
--- a/app/models/account.rb
+++ b/app/models/account.rb
@@ -154,6 +154,7 @@ class Account < ApplicationRecord
:hides_filtered_gap?,
:hides_mascot?,
:hides_captions?,
+ :shows_cursor?,
to: :user,
prefix: true,
diff --git a/app/models/user.rb b/app/models/user.rb
index c14c33567..cbe62d189 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -128,6 +128,7 @@ class User < ApplicationRecord
:roar_lifespan,
:delayed_roars,
:delayed_for,
+ :show_cursor,
:auto_play_gif,
:default_sensitive,
@@ -314,6 +315,10 @@ class User < ApplicationRecord
@_delayed_for ||= (settings.delayed_for || 60)
end
+ def shows_cursor?
+ @show_cursor ||= (settings.show_cursor || false)
+ end
+
def defaults_to_local_only?
@defaults_to_local_only ||= (settings.default_local || false)
end
diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml
index 1110942ac..f21d8dd97 100755
--- a/app/views/layouts/application.html.haml
+++ b/app/views/layouts/application.html.haml
@@ -81,5 +81,10 @@
.status__content .emojione { width: 24px !important; height: 24px !important }
.status__content .hoverplay:hover { padding-left: 24px !important }
+ -if current_account&.user_shows_cursor?
+ :css
+ span.cursor { animation: t_blink 1s linear infinite }
+ span.cursor::before { content: " █" }
+
%body{ class: body_classes }
= content_for?(:content) ? yield(:content) : yield
diff --git a/app/views/settings/preferences/show.html.haml b/app/views/settings/preferences/show.html.haml
index 99eac3abf..07c9fd86f 100644
--- a/app/views/settings/preferences/show.html.haml
+++ b/app/views/settings/preferences/show.html.haml
@@ -27,6 +27,8 @@
= f.input :setting_default_content_type, collection: ['text/x-bbcode+markdown', 'text/markdown', 'text/x-bbcode', 'text/html', 'text/plain', 'text/console'], wrapper: :with_label, include_blank: false, label_method: lambda { |item| safe_join([t("simple_form.labels.defaults.setting_default_content_type_#{item.split('/')[1].gsub(/[+-]/, '_')}"), content_tag(:span, t("simple_form.hints.defaults.setting_default_content_type_#{item.split('/')[1].gsub(/[+-]/, '_')}_html"), class: 'hint')]) }, required: false, as: :radio_buttons, collection_wrapper_tag: 'ul', item_wrapper_tag: 'li'
+
+ .fields-group
= f.input :setting_default_local, as: :boolean, wrapper: :with_label
= f.input :setting_always_local, as: :boolean, wrapper: :with_label
= f.input :setting_default_sensitive, as: :boolean, wrapper: :with_label
@@ -72,6 +74,7 @@
= f.input :setting_larger_buttons, as: :boolean, wrapper: :with_label
= f.input :setting_larger_drawer, as: :boolean, wrapper: :with_label
= f.input :setting_larger_emoji, as: :boolean, wrapper: :with_label
+ = f.input :setting_show_cursor, as: :boolean, wrapper: :with_label
.fields-group
= f.input :setting_hide_mascot, as: :boolean, wrapper: :with_label
diff --git a/config/locales/simple_form.en.yml b/config/locales/simple_form.en.yml
index de15c62dd..82e4feabb 100644
--- a/config/locales/simple_form.en.yml
+++ b/config/locales/simple_form.en.yml
@@ -31,7 +31,7 @@ en:
setting_default_content_type_html_html: "<strong>Bold</strong>, <u>Underline</u>, <em>Italic</em>, <code>Console</code>
, ..."
setting_default_content_type_markdown_html: "**Bold**, _Underline_, *Italic*, `Console`
, ..."
setting_default_content_type_plain_html: No formatting.
- setting_default_content_type_console_html: Plain-text console formatting.
+ setting_default_content_type_console_html: Plain-text console formatting.
setting_default_content_type_x_bbcode_html: "[b]Bold[/b], [u]Underline[/u], [i]Italic[/i], [code]Console[/code]
, ..."
setting_default_content_type_x_bbcode_markdown_html: "**Bold**, [u]Underline[/u], *Italic*, [code]Console[/code]
, ..."
setting_default_language: The language of your roars can be detected automatically, but it's not always accurate
@@ -117,6 +117,7 @@ en:
setting_default_content_type_console: Console
setting_default_content_type_x_bbcode: BBCode
setting_default_content_type_x_bbcode_markdown: BBdown
+ setting_show_cursor: Show cursor (console format only)
setting_default_language: Posting language
setting_default_privacy: Post privacy
setting_roar_lifespan: Auto-delete new roars after