simplify emojification on public pages with .emojify class
This commit is contained in:
		
							parent
							
								
									131bae89fd
								
							
						
					
					
						commit
						917cf0bf5d
					
				@ -1,7 +1,7 @@
 | 
				
			|||||||
import emojify from './components/emoji'
 | 
					import emojify from './components/emoji'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
$(() => {
 | 
					$(() => {
 | 
				
			||||||
  $.each($('.entry .content, .entry .status__content, .status__display-name, .display-name, .name, .account__header__content'), (_, content) => {
 | 
					  $.each($('.emojify'), (_, content) => {
 | 
				
			||||||
    const $content = $(content);
 | 
					    const $content = $(content);
 | 
				
			||||||
    $content.html(emojify($content.html()));
 | 
					    $content.html(emojify($content.html()));
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
				
			|||||||
@ -3,6 +3,6 @@
 | 
				
			|||||||
    .avatar= image_tag account.avatar.url(:original)
 | 
					    .avatar= image_tag account.avatar.url(:original)
 | 
				
			||||||
    .name
 | 
					    .name
 | 
				
			||||||
      = link_to TagManager.instance.url_for(account) do
 | 
					      = link_to TagManager.instance.url_for(account) do
 | 
				
			||||||
        %span.display_name= display_name(account)
 | 
					        %span.display_name.emojify= display_name(account)
 | 
				
			||||||
        %span.username= "@#{account.acct}"
 | 
					        %span.username= "@#{account.acct}"
 | 
				
			||||||
  %p.note= truncate(strip_tags(account.note), length: 150)
 | 
					  %p.note.emojify= truncate(strip_tags(account.note), length: 150)
 | 
				
			||||||
 | 
				
			|||||||
@ -11,13 +11,13 @@
 | 
				
			|||||||
        = link_to t('accounts.remote_follow'), account_remote_follow_path(@account), class: 'button'
 | 
					        = link_to t('accounts.remote_follow'), account_remote_follow_path(@account), class: 'button'
 | 
				
			||||||
  .avatar= image_tag @account.avatar.url(:original), class: 'u-photo'
 | 
					  .avatar= image_tag @account.avatar.url(:original), class: 'u-photo'
 | 
				
			||||||
  %h1.name
 | 
					  %h1.name
 | 
				
			||||||
    %span.p-name= display_name(@account)
 | 
					    %span.p-name.emojify= display_name(@account)
 | 
				
			||||||
    %small
 | 
					    %small
 | 
				
			||||||
      %span.p-nickname= "@#{@account.username}"
 | 
					      %span.p-nickname= "@#{@account.username}"
 | 
				
			||||||
      = fa_icon('lock') if @account.locked?
 | 
					      = fa_icon('lock') if @account.locked?
 | 
				
			||||||
  .details
 | 
					  .details
 | 
				
			||||||
    .bio
 | 
					    .bio
 | 
				
			||||||
      .account__header__content.p-note= Formatter.instance.simplified_format(@account)
 | 
					      .account__header__content.p-note.emojify= Formatter.instance.simplified_format(@account)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    .details-counters
 | 
					    .details-counters
 | 
				
			||||||
      .counter{ class: active_nav_class(account_url(@account)) }
 | 
					      .counter{ class: active_nav_class(account_url(@account)) }
 | 
				
			||||||
 | 
				
			|||||||
@ -4,8 +4,8 @@
 | 
				
			|||||||
      = image_tag account.avatar.url(:original), alt: '', width: 48, height: 48, class: 'avatar'
 | 
					      = image_tag account.avatar.url(:original), alt: '', width: 48, height: 48, class: 'avatar'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    %span.display-name
 | 
					    %span.display-name
 | 
				
			||||||
      %strong= display_name(account)
 | 
					      %strong.emojify= display_name(account)
 | 
				
			||||||
      %span= "@#{account.acct}"
 | 
					      %span= "@#{account.acct}"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  - unless account.note.blank?
 | 
					  - unless account.note.blank?
 | 
				
			||||||
    .account__header__content= Formatter.instance.simplified_format(account)
 | 
					    .account__header__content.emojify= Formatter.instance.simplified_format(account)
 | 
				
			||||||
 | 
				
			|||||||
@ -4,10 +4,10 @@
 | 
				
			|||||||
      %div.avatar
 | 
					      %div.avatar
 | 
				
			||||||
        = image_tag status.account.avatar.url(:original), width: 48, height: 48, alt: '', class: 'u-photo'
 | 
					        = image_tag status.account.avatar.url(:original), width: 48, height: 48, alt: '', class: 'u-photo'
 | 
				
			||||||
    %span.display-name
 | 
					    %span.display-name
 | 
				
			||||||
      %strong.p-name= display_name(status.account)
 | 
					      %strong.p-name.emojify= display_name(status.account)
 | 
				
			||||||
      %span.p-nickname= acct(status.account)
 | 
					      %span.p-nickname= acct(status.account)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  .status__content.e-content.p-name= Formatter.instance.format(status)
 | 
					  .status__content.e-content.p-name.emojify= Formatter.instance.format(status)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  - unless status.media_attachments.empty?
 | 
					  - unless status.media_attachments.empty?
 | 
				
			||||||
    - if status.media_attachments.first.video?
 | 
					    - if status.media_attachments.first.video?
 | 
				
			||||||
 | 
				
			|||||||
@ -1,5 +1,5 @@
 | 
				
			|||||||
.entry.entry-favourite
 | 
					.entry.entry-favourite
 | 
				
			||||||
  .content
 | 
					  .content.emojify
 | 
				
			||||||
    %strong= favourite.account.acct
 | 
					    %strong= favourite.account.acct
 | 
				
			||||||
    = t('stream_entries.favourited')
 | 
					    = t('stream_entries.favourited')
 | 
				
			||||||
    %strong= favourite.status.account.acct
 | 
					    %strong= favourite.status.account.acct
 | 
				
			||||||
 | 
				
			|||||||
@ -1,5 +1,5 @@
 | 
				
			|||||||
.entry.entry-follow
 | 
					.entry.entry-follow
 | 
				
			||||||
  .content
 | 
					  .content.emojify
 | 
				
			||||||
    %strong= link_to follow.account.acct, account_path(follow.account)
 | 
					    %strong= link_to follow.account.acct, account_path(follow.account)
 | 
				
			||||||
    = t('stream_entries.is_now_following')
 | 
					    = t('stream_entries.is_now_following')
 | 
				
			||||||
    %strong= link_to follow.target_account.acct, TagManager.instance.url_for(follow.target_account)
 | 
					    %strong= link_to follow.target_account.acct, TagManager.instance.url_for(follow.target_account)
 | 
				
			||||||
 | 
				
			|||||||
@ -9,10 +9,10 @@
 | 
				
			|||||||
        %div
 | 
					        %div
 | 
				
			||||||
          = image_tag status.account.avatar(:original), width: 48, height: 48, alt: '', class: 'u-photo'
 | 
					          = image_tag status.account.avatar(:original), width: 48, height: 48, alt: '', class: 'u-photo'
 | 
				
			||||||
      %span.display-name
 | 
					      %span.display-name
 | 
				
			||||||
        %strong.p-name= display_name(status.account)
 | 
					        %strong.p-name.emojify= display_name(status.account)
 | 
				
			||||||
        %span.p-nickname= acct(status.account)
 | 
					        %span.p-nickname= acct(status.account)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  .status__content.e-content.p-name= Formatter.instance.format(status)
 | 
					  .status__content.e-content.p-name.emojify= Formatter.instance.format(status)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  - unless status.media_attachments.empty?
 | 
					  - unless status.media_attachments.empty?
 | 
				
			||||||
    .status__attachments
 | 
					    .status__attachments
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user