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

@@ -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() {

View File

@@ -186,8 +186,6 @@ Blacklist.initialize_all = function() {
if (Blacklist.apply() > 0) {
Blacklist.update_sidebar();
Blacklist.initialize_disable_all_blacklists();
} else {
$("#blacklist-box").hide();
}
}

View File

@@ -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");

View File

@@ -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

View File

@@ -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];

View File

@@ -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();
}
}

View File

@@ -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();
}
}

View File

@@ -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();
});

View File

@@ -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() {