Merge pull request #3817 from evazion/fix-3816
Avoid flickering hidden page elements during page loads
This commit is contained in:
@@ -26,9 +26,6 @@ ArtistCommentary.initialize_commentary_display_tabs = function() {
|
||||
$(e.target).parent("li").addClass("active");
|
||||
e.preventDefault();
|
||||
});
|
||||
|
||||
$("#commentary-sections li:last-child").addClass("active");
|
||||
$("#original-artist-commentary").hide();
|
||||
}
|
||||
|
||||
ArtistCommentary.initialize_edit_commentary_dialog = function() {
|
||||
|
||||
@@ -186,8 +186,6 @@ Blacklist.initialize_all = function() {
|
||||
if (Blacklist.apply() > 0) {
|
||||
Blacklist.update_sidebar();
|
||||
Blacklist.initialize_disable_all_blacklists();
|
||||
} else {
|
||||
$("#blacklist-box").hide();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,13 +6,11 @@ Dtext.initialize_all = function() {
|
||||
}
|
||||
|
||||
Dtext.initialize_links = function() {
|
||||
$(".simple_form .dtext-preview").hide();
|
||||
$(".simple_form input[value=Preview]").click(Dtext.click_button);
|
||||
}
|
||||
|
||||
Dtext.initialize_expandables = function($parent) {
|
||||
$parent = $parent || $(document);
|
||||
$parent.find(".expandable-content").hide();
|
||||
$parent.find(".expandable-button").click(function(e) {
|
||||
var button = $(this);
|
||||
button.parent().next().fadeToggle("fast");
|
||||
|
||||
@@ -3,30 +3,6 @@ import Utility from './utility'
|
||||
|
||||
let Favorite = {}
|
||||
|
||||
Favorite.initialize_all = function() {
|
||||
if ($("#c-posts").length) {
|
||||
this.hide_or_show_add_to_favorites_link();
|
||||
}
|
||||
}
|
||||
|
||||
Favorite.hide_or_show_add_to_favorites_link = function() {
|
||||
var current_user_id = Utility.meta("current-user-id");
|
||||
if (current_user_id === "") {
|
||||
$("#add-to-favorites").hide();
|
||||
$("#remove-from-favorites").hide();
|
||||
$("#add-fav-button").hide();
|
||||
$("#remove-fav-button").hide();
|
||||
return;
|
||||
}
|
||||
if ($("#image-container").length && $("#image-container").data("is-favorited") === true) {
|
||||
$("#add-to-favorites").hide();
|
||||
$("#add-fav-button").hide();
|
||||
} else {
|
||||
$("#remove-from-favorites").hide();
|
||||
$("#remove-fav-button").hide();
|
||||
}
|
||||
}
|
||||
|
||||
Favorite.create = function(post_id) {
|
||||
Post.notice_update("inc");
|
||||
|
||||
@@ -57,9 +33,5 @@ Favorite.destroy = function(post_id) {
|
||||
});
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
Favorite.initialize_all();
|
||||
});
|
||||
|
||||
export default Favorite
|
||||
|
||||
|
||||
@@ -7,8 +7,6 @@ ForumPost.initialize_all = function() {
|
||||
}
|
||||
|
||||
ForumPost.initialize_edit_links = function() {
|
||||
$(".edit_forum_post, .edit_forum_topic").hide();
|
||||
|
||||
$(".edit_forum_post_link").click(function(e) {
|
||||
var link_id = $(this).attr("id");
|
||||
var forum_post_id = link_id.match(/^edit_forum_post_link_(\d+)$/)[1];
|
||||
|
||||
@@ -1,17 +1,8 @@
|
||||
import Utility from './utility'
|
||||
|
||||
let PostAppeal = {};
|
||||
|
||||
PostAppeal.initialize_all = function() {
|
||||
if ($("#c-posts").length && $("#a-show").length) {
|
||||
this.initialize_appeal();
|
||||
this.hide_or_show_appeal_link();
|
||||
}
|
||||
}
|
||||
|
||||
PostAppeal.hide_or_show_appeal_link = function() {
|
||||
if ((Utility.meta("post-is-flagged") === "false") && (Utility.meta("post-is-deleted") === "false")) {
|
||||
$("#appeal").hide();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,17 +1,8 @@
|
||||
import Utility from './utility'
|
||||
|
||||
let PostFlag = {};
|
||||
|
||||
PostFlag.initialize_all = function() {
|
||||
if ($("#c-posts").length && $("#a-show").length) {
|
||||
this.initialize_flag();
|
||||
this.hide_or_show_flag_link();
|
||||
}
|
||||
}
|
||||
|
||||
PostFlag.hide_or_show_flag_link = function() {
|
||||
if (Utility.meta("post-is-deleted") === "true") {
|
||||
$("#flag").hide();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
import Utility from './utility'
|
||||
|
||||
let PostModeration = {};
|
||||
|
||||
PostModeration.initialize_all = function() {
|
||||
if ($("#c-posts").length && $("#a-show").length) {
|
||||
this.hide_or_show_approve_and_disapprove_links();
|
||||
this.hide_or_show_delete_and_undelete_links();
|
||||
}
|
||||
}
|
||||
|
||||
PostModeration.hide_or_show_approve_and_disapprove_links = function() {
|
||||
if (Utility.meta("post-is-approvable") !== "true") {
|
||||
$("#approve").hide();
|
||||
$("#disapprove").hide();
|
||||
}
|
||||
}
|
||||
|
||||
PostModeration.hide_or_show_delete_and_undelete_links = function() {
|
||||
if (Utility.meta("post-is-deleted") === "true") {
|
||||
$("#delete").hide();
|
||||
} else {
|
||||
$("#undelete").hide();
|
||||
}
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
PostModeration.initialize_all();
|
||||
});
|
||||
@@ -273,8 +273,6 @@ Post.initialize_links = function() {
|
||||
|
||||
e.preventDefault();
|
||||
});
|
||||
|
||||
$(".unvote-post-link").hide();
|
||||
}
|
||||
|
||||
Post.initialize_post_relationship_previews = function() {
|
||||
@@ -309,24 +307,8 @@ Post.toggle_relationship_preview = function(preview, preview_link) {
|
||||
}
|
||||
|
||||
Post.initialize_favlist = function() {
|
||||
$("#favlist").hide();
|
||||
$("#hide-favlist-link").hide();
|
||||
var fav_count = $("#show-favlist-link").prev().text();
|
||||
if (fav_count === "0") {
|
||||
$("#show-favlist-link").hide();
|
||||
}
|
||||
|
||||
$("#show-favlist-link").click(function(e) {
|
||||
$("#favlist").show();
|
||||
$(this).hide();
|
||||
$("#hide-favlist-link").show();
|
||||
e.preventDefault();
|
||||
});
|
||||
|
||||
$("#hide-favlist-link").click(function(e) {
|
||||
$("#favlist").hide();
|
||||
$(this).hide();
|
||||
$("#show-favlist-link").show();
|
||||
$("#show-favlist-link, #hide-favlist-link").click(function(e) {
|
||||
$("#favlist, #show-favlist-link, #hide-favlist-link").toggle();
|
||||
e.preventDefault();
|
||||
});
|
||||
}
|
||||
@@ -481,11 +463,6 @@ Post.initialize_post_sections = function() {
|
||||
$(e.target).parent("li").addClass("active");
|
||||
e.preventDefault();
|
||||
});
|
||||
|
||||
$("#notes").hide();
|
||||
$("#edit").hide();
|
||||
$("#recommended").hide();
|
||||
$("#post-sections li:first-child").addClass("active");
|
||||
}
|
||||
|
||||
Post.resize_ugoira_controls = function() {
|
||||
|
||||
@@ -79,6 +79,7 @@ div.prose {
|
||||
}
|
||||
|
||||
div.expandable-content {
|
||||
display: none;
|
||||
padding: 0.4em;
|
||||
border-top: 1px solid #666;
|
||||
|
||||
@@ -89,6 +90,8 @@ div.prose {
|
||||
}
|
||||
|
||||
div.dtext-preview {
|
||||
display: none;
|
||||
|
||||
ul {
|
||||
margin-left: 1em;
|
||||
}
|
||||
|
||||
@@ -43,6 +43,10 @@ div.list-of-forum-posts {
|
||||
padding: 1em;
|
||||
margin-left: 14em;
|
||||
|
||||
.edit_forum_post, .edit_forum_topic {
|
||||
display: none;
|
||||
}
|
||||
|
||||
menu {
|
||||
margin-top: 0.5em;
|
||||
|
||||
|
||||
@@ -499,10 +499,12 @@ div#c-explore-posts {
|
||||
}
|
||||
}
|
||||
|
||||
.inline-blacklist {
|
||||
#blacklist-box {
|
||||
margin-bottom: 1em;
|
||||
}
|
||||
#blacklist-box {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#blacklist-box.inline-blacklist {
|
||||
margin-bottom: 1em;
|
||||
|
||||
#blacklist-list {
|
||||
display: inline;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<menu id="commentary-sections">
|
||||
<% if artist_commentary.original_present? && artist_commentary.translated_present? %>
|
||||
<li><a href="#original">Original</a></li> |
|
||||
<li><a href="#translated">Translated</a></li>
|
||||
<li class="active"><a href="#translated">Translated</a></li>
|
||||
<% elsif artist_commentary.original_present? %>
|
||||
<li><b>Original</b></li>
|
||||
<% elsif artist_commentary.translated_present? %>
|
||||
@@ -12,12 +12,12 @@
|
||||
</menu>
|
||||
|
||||
<% if artist_commentary.original_present? %>
|
||||
<section id="original-artist-commentary">
|
||||
<%= tag.section id: "original-artist-commentary", style: ("display: none" if artist_commentary.translated_present?) do %>
|
||||
<h3><%= artist_commentary.original_title %></h3>
|
||||
<div class="prose">
|
||||
<%= format_text(artist_commentary.original_description, :disable_mentions => true) %>
|
||||
</div>
|
||||
</section>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<% if artist_commentary.translated_present? %>
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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 »".html_safe, "#", :id => "show-favlist-link" %>
|
||||
<%= link_to "« 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>
|
||||
|
||||
@@ -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 %>
|
||||
|
||||
|
||||
@@ -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 %>">
|
||||
|
||||
Reference in New Issue
Block a user