Make anti-flicker script opt-in
This commit is contained in:
parent
9dbcbcf029
commit
abdc034e21
@ -13,10 +13,10 @@
|
||||
function fictioneer_bring_out_legacy_trash() {
|
||||
// Setup
|
||||
$options = wp_cache_get( 'alloptions', 'options' );
|
||||
$obsolete = ['fictioneer_disable_html_in_comments', 'fictioneer_block_subscribers_from_admin', 'fictioneer_admin_restrict_menus', 'fictioneer_admin_restrict_private_data', 'fictioneer_admin_reduce_subscriber_profile', 'fictioneer_enable_subscriber_self_delete', 'fictioneer_strip_shortcodes_for_non_administrators', 'fictioneer_restrict_media_access', 'fictioneer_subscription_enabled', 'fictioneer_patreon_badge_map', 'fictioneer_patreon_tier_as_badge', 'fictioneer_patreon_campaign_ids', 'fictioneer_patreon_campaign_id', 'fictioneer_mount_wpdiscuz_theme_styles', 'fictioneer_base_site_width', 'fictioneer_featherlight_enabled', 'fictioneer_tts_enabled', 'fictioneer_log', 'fictioneer_enable_ajax_nonce', 'fictioneer_flush_object_cache', 'fictioneer_enable_all_block_styles', 'fictioneer_light_mode_as_default', 'fictioneer_remove_wp_svg_filters', 'fictioneer_update_check_timestamp', 'fictioneer_latest_version', 'fictioneer_update_notice_timestamp', 'fictioneer_theme_status'];
|
||||
$obsolete = ['fictioneer_disable_html_in_comments', 'fictioneer_block_subscribers_from_admin', 'fictioneer_admin_restrict_menus', 'fictioneer_admin_restrict_private_data', 'fictioneer_admin_reduce_subscriber_profile', 'fictioneer_enable_subscriber_self_delete', 'fictioneer_strip_shortcodes_for_non_administrators', 'fictioneer_restrict_media_access', 'fictioneer_subscription_enabled', 'fictioneer_patreon_badge_map', 'fictioneer_patreon_tier_as_badge', 'fictioneer_patreon_campaign_ids', 'fictioneer_patreon_campaign_id', 'fictioneer_mount_wpdiscuz_theme_styles', 'fictioneer_base_site_width', 'fictioneer_featherlight_enabled', 'fictioneer_tts_enabled', 'fictioneer_log', 'fictioneer_enable_ajax_nonce', 'fictioneer_flush_object_cache', 'fictioneer_enable_all_block_styles', 'fictioneer_light_mode_as_default', 'fictioneer_remove_wp_svg_filters', 'fictioneer_update_check_timestamp', 'fictioneer_latest_version', 'fictioneer_update_notice_timestamp', 'fictioneer_theme_status', 'fictioneer_disable_anti_flicker'];
|
||||
|
||||
// Check for most recent obsolete option...
|
||||
if ( isset( $options['fictioneer_theme_status'] ) ) {
|
||||
if ( isset( $options['fictioneer_disable_anti_flicker'] ) ) {
|
||||
// Looping everything is not great but it only happens once!
|
||||
foreach ( $obsolete as $trash ) {
|
||||
delete_option( $trash );
|
||||
@ -1566,7 +1566,7 @@ add_action( 'admin_head', 'fictioneer_output_head_fonts', 5 );
|
||||
add_action( 'elementor/editor/after_enqueue_scripts', 'fictioneer_output_head_fonts', 5 );
|
||||
|
||||
// =============================================================================
|
||||
// OUTPUT HEAD NOSCRIPT
|
||||
// OUTPUT HEAD ANTI FLICKER
|
||||
// =============================================================================
|
||||
|
||||
/**
|
||||
@ -1585,7 +1585,7 @@ function fictioneer_output_head_anti_flicker() {
|
||||
<?php // <--- End HTML
|
||||
}
|
||||
|
||||
if ( ! get_option( 'fictioneer_disable_anti_flicker' ) ) {
|
||||
if ( get_option( 'fictioneer_enable_anti_flicker' ) ) {
|
||||
add_action( 'wp_head', 'fictioneer_output_head_anti_flicker' );
|
||||
}
|
||||
|
||||
|
@ -666,8 +666,8 @@ define( 'FICTIONEER_OPTIONS', array(
|
||||
'sanitize_callback' => 'fictioneer_sanitize_checkbox',
|
||||
'default' => 0
|
||||
),
|
||||
'fictioneer_disable_anti_flicker' => array(
|
||||
'name' => 'fictioneer_disable_anti_flicker',
|
||||
'fictioneer_enable_anti_flicker' => array(
|
||||
'name' => 'fictioneer_enable_anti_flicker',
|
||||
'group' => 'fictioneer-settings-general-group',
|
||||
'sanitize_callback' => 'fictioneer_sanitize_checkbox',
|
||||
'default' => 0
|
||||
@ -1157,7 +1157,7 @@ function fictioneer_get_option_label( $option ) {
|
||||
'fictioneer_disable_default_formatting_indent' => __( 'Disable default indentation of chapter paragraphs', 'fictioneer' ),
|
||||
'fictioneer_override_chapter_status_icons' => __( 'Override chapter status icons', 'fictioneer' ),
|
||||
'fictioneer_enable_custom_fields' => __( 'Enable custom fields', 'fictioneer' ),
|
||||
'fictioneer_disable_anti_flicker' => __( 'Disable anti-flicker script', 'fictioneer' ),
|
||||
'fictioneer_enable_anti_flicker' => __( 'Enable anti-flicker script', 'fictioneer' ),
|
||||
'fictioneer_hide_categories' => __( 'Hide categories on posts', 'fictioneer' ),
|
||||
'fictioneer_enable_story_card_caching' => __( 'Enable caching of story cards', 'fictioneer' ),
|
||||
'fictioneer_enable_query_result_caching' => __( 'Enable caching of large query results', 'fictioneer' ),
|
||||
|
@ -1269,10 +1269,10 @@ $issues = fictioneer_look_for_issues();
|
||||
<div class="fictioneer-card__row">
|
||||
<?php
|
||||
fictioneer_settings_label_checkbox(
|
||||
'fictioneer_disable_anti_flicker',
|
||||
__( 'Disable anti-flicker script', 'fictioneer' ),
|
||||
__( 'Do not hide the page until the document is fully parsed.', 'fictioneer' ),
|
||||
__( '<p>Rendering of the site begins while the HTML document is still being parsed, from top to bottom. This can cause the layout to flicker and shift for a split second if styles are applied to grouped elements that are still missing their counterparts. Ugly but not bad.</p><p>This script prevents such flickers by making the site invisible until the entire document has been parsed, which means the site may technically appear a split second later. However, if the script is blocked from being executed, the site will remain invisible. Although this is extremely unlikely, you can turn this feature off here if needed.</p>', 'fictioneer' )
|
||||
'fictioneer_enable_anti_flicker',
|
||||
__( 'Enable anti-flicker script', 'fictioneer' ),
|
||||
__( 'Hides the page until the document is fully parsed.', 'fictioneer' ),
|
||||
__( '<p>Rendering of the site begins while the HTML document is still being parsed, from top to bottom. This can cause the layout to flicker and shift for a split second if styles are applied to grouped elements that are still missing their counterparts. Not great, not terrible.</p><p>This script prevents such flickers by making the site invisible until the entire document has been parsed, which means the site technically appears a split second later. However, if the script is blocked, the site will remain invisible. This is extremely unlikely, though.</p>', 'fictioneer' )
|
||||
);
|
||||
?>
|
||||
</div>
|
||||
|
Loading…
x
Reference in New Issue
Block a user