Merge pull request #3817 from evazion/fix-3816

Avoid flickering hidden page elements during page loads
This commit is contained in:
Albert Yi
2018-08-21 14:44:26 -07:00
committed by GitHub
18 changed files with 37 additions and 144 deletions

View File

@@ -1,7 +1,7 @@
<div id="blacklist-box" class="inline-blacklist">
<section id="blacklist-box" class="inline-blacklist">
<strong>Blacklisted: </strong>
<ul id="blacklist-list">
<li id="disable-all-blacklists" style="display: none;"><span class="link">Disable all</span></li>
<li id="re-enable-all-blacklists" style="display: none;"><span class="link">Re-enable all</span></li>
</ul>
</div>
</section>

View File

@@ -1,4 +1,4 @@
<section id="blacklist-box" style="display: none;">
<section id="blacklist-box">
<h1>Blacklisted (<%= link_to "Help", wiki_pages_path(:title => "help:blacklists") %>)</h1>
<ul id="blacklist-list">
</ul>

View File

@@ -19,11 +19,11 @@
</li>
<li>Source: <%= post_source_tag(post) %></li>
<li>Rating: <%= post.pretty_rating %></li>
<li>Score: <span id="score-for-post-<%= post.id %>"><%= post.score %></span> <% if CurrentUser.is_voter? %>(<span id="vote-links-for-post-<%= post.id %>">vote <%= link_to content_tag("i", nil, class: "far fa-thumbs-up"), post_votes_path(:post_id => post.id, :score => "up"), :remote => true, :method => :post %> <%= link_to content_tag("i", nil, class: "far fa-thumbs-down"), post_votes_path(:post_id => post.id, :score => "down"), :remote => true, :method => :post %></span><%= link_to "undo vote", post_votes_path(post), :remote => true, :method => :delete, :id => "unvote-link-for-post-#{post.id}", :class => "unvote-post-link" %>)<% end %></li>
<li>Score: <span id="score-for-post-<%= post.id %>"><%= post.score %></span> <% if CurrentUser.is_voter? %>(<span id="vote-links-for-post-<%= post.id %>">vote <%= link_to content_tag("i", nil, class: "far fa-thumbs-up"), post_votes_path(:post_id => post.id, :score => "up"), :remote => true, :method => :post %> <%= link_to content_tag("i", nil, class: "far fa-thumbs-down"), post_votes_path(:post_id => post.id, :score => "down"), :remote => true, :method => :post %></span><%= link_to "undo vote", post_votes_path(post), :remote => true, :method => :delete, :id => "unvote-link-for-post-#{post.id}", :class => "unvote-post-link", :style => "display: none;" %>)<% end %></li>
<li>Favorites: <span id="favcount-for-post-<%= post.id %>"><%= post.fav_count %></span>
<% if CurrentUser.is_gold? %>
<%= link_to "Show &raquo;".html_safe, "#", :id => "show-favlist-link" %>
<%= link_to "&laquo; Hide".html_safe, "#", :id => "hide-favlist-link", :style => "display: none;" %>
<%= link_to "Show »", "#", id: "show-favlist-link", style: ("display: none;" if post.fav_count == 0) %>
<%= link_to "« Hide", "#", id: "hide-favlist-link", style: "display: none;" %>
<div id="favlist" style="display: none;"><%= post_favlist(post) %></div>
<% end %></li>
<li>

View File

@@ -2,8 +2,8 @@
<li><%= link_to "Resize to window", "#", :id => "image-resize-to-window-link" %></li>
<% if CurrentUser.is_member? %>
<li><%= link_to "Favorite", favorites_path(:post_id => post.id), :remote => true, :method => :post, :id => "add-to-favorites", :"data-shortcut" => "f" %></li>
<li><%= link_to "Unfavorite", favorite_path(post), :remote => true, :method => :delete, :id => "remove-from-favorites", :"data-shortcut" => "shift+f" %></li>
<li><%= link_to "Favorite", favorites_path(:post_id => post.id), :remote => true, :method => :post, :id => "add-to-favorites", :"data-shortcut" => "f", style: ("display: none;" if @post.is_favorited?) %></li>
<li><%= link_to "Unfavorite", favorite_path(post), :remote => true, :method => :delete, :id => "remove-from-favorites", :"data-shortcut" => "shift+f", style: ("display: none;" if !@post.is_favorited?) %></li>
<li><%= link_to_if post.visible?, "Download", post.tagged_file_url + "?download=1", download: post.presenter.filename_for_download %></li>
<li id="add-to-pool-list"><%= link_to "Add to pool", "#", :id => "pool" %></li>
<% if post.is_note_locked? %>
@@ -21,11 +21,9 @@
<% if post.is_status_locked? %>
<li><span id="status-locked-notice">Status locked</span></li>
<% else %>
<% if !post.is_deleted? && !post.is_pending? %>
<% if !post.is_deleted? && !post.is_pending? && !post.is_flagged? %>
<li><%= link_to "Flag", new_post_flag_path(:post_id => post.id), :id => "flag" %></li>
<% end %>
<% if post.is_flagged? || post.is_deleted? %>
<% elsif post.is_flagged? || post.is_deleted? %>
<li><%= link_to "Appeal", new_post_appeal_path(:post_id => post.id), :id => "appeal" %></li>
<% end %>
@@ -39,9 +37,8 @@
<li><%= link_to "Delete", confirm_delete_moderator_post_post_path(:post_id => post.id) %></li>
<% end %>
<% if post.is_flagged? || post.is_pending? %>
<% if post.is_approvable? && !post.is_deleted? %>
<li><%= link_to "Approve", moderator_post_approval_path(:post_id => post.id), :remote => true, :method => :post, :id => "approve", :"data-shortcut" => "shift+o", :"data-confirm" => "Are you sure you want to approve this post?" %></li>
<% else %>
<li><%= link_to "Hide from queue", moderator_post_disapproval_path(post_disapproval: { post_id: post.id, reason: "disinterest" }), remote: true, method: :post, id: "disapprove" %></li>
<% end %>

View File

@@ -48,10 +48,12 @@
<%= @post.presenter.image_html(self) %>
</section>
<div class="fav-buttons">
<%= button_to "Favorite", favorites_path(post_id: @post.id), remote: true, method: :post, form: {id: "add-fav-button"}, class: "ui-button ui-widget ui-corner-all gradient", data: {disable_with: "Favoriting..."} %>
<%= button_to "Unfavorite", favorite_path(@post), remote: true, method: :delete, form: {id: "remove-fav-button"}, class: "ui-button ui-widget ui-corner-all gradient", data: {disable_with: "Unfavoriting..."} %>
</div>
<% if CurrentUser.is_member? %>
<div class="fav-buttons">
<%= button_to "Favorite", favorites_path(post_id: @post.id), remote: true, method: :post, form: {id: "add-fav-button", style: ("display: none;" if @post.is_favorited?)}, class: "ui-button ui-widget ui-corner-all gradient", data: {disable_with: "Favoriting..."} %>
<%= button_to "Unfavorite", favorite_path(@post), remote: true, method: :delete, form: {id: "remove-fav-button", style: ("display: none;" if !@post.is_favorited?)}, class: "ui-button ui-widget ui-corner-all gradient", data: {disable_with: "Unfavoriting..."} %>
</div>
<% end %>
<section id="mark-as-translated-section" style="display: none;">
<%= form_tag(mark_as_translated_post_path(@post), :class => "simple_form", :method => :put) do |f| %>
@@ -87,7 +89,7 @@
<% end %>
<menu id="post-sections">
<li><a href="#comments">Comments</a></li>
<li class="active"><a href="#comments">Comments</a></li>
<% if RecommenderService.available_for_post?(@post) %>
<li><a href="#recommended">Recommended</a></li>
@@ -101,7 +103,7 @@
</menu>
<% if RecommenderService.available_for_post?(@post) %>
<section id="recommended">
<section id="recommended" style="display: none;">
<p><em>Loading...</em></p>
</section>
<% end %>
@@ -166,15 +168,7 @@
<% content_for(:html_header) do %>
<meta name="description" content="<%= @post.presenter.humanized_tag_string %>">
<meta name="tags" content="<%= @post.tag_string %>">
<meta name="pools" content="<%= @post.pool_string %>">
<meta name="post-id" content="<%= @post.id %>">
<% if CurrentUser.can_approve_posts? %>
<meta name="post-is-approvable" content="<%= @post.is_approvable? %>">
<% end %>
<meta name="post-is-deleted" content="<%= @post.is_deleted? %>">
<meta name="post-is-flagged" content="<%= @post.is_flagged? %>">
<meta name="config-large-width" content="<%= Danbooru.config.large_image_width %>">
<meta name="post-has-embedded-notes" content="<%= @post.has_embedded_notes? %>">
<meta name="always-resize-images" content="<%= CurrentUser.user.always_resize_images? %>">
<meta property="og:title" content="<%= @post.presenter.humanized_essential_tag_string %> - <%= Danbooru.config.app_name %>">