[Resolved] Removing remnant javascript

Home Forums Support [Resolved] Removing remnant javascript

Home Forums Support Removing remnant javascript

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #1620367
    Jeff

    Hi folks, I’ve read some posts that only the sticky requires javascript, but I’m having some trouble getting rid of a few remnants:

    – Sticky is turned off
    – Do have Menu Plus enabled, no other premium items besides elements
    – javascript being loaded:

    ~~~
    /wp-content/plugins/gp-premium/menu-plus/functions/js/sticky.min.js?ver=1.12.3
    /wp-content/themes/generatepress/assets/js/navigation-search.min.js?ver=3.0.2
    /wp-content/themes/generatepress/assets/js/dropdown-click.min.js?ver=3.0.2
    /wp-includes/js/jquery/jquery.min.js?ver=3.5.1
    /wp-content/themes/generatepress/assets/js/main.min.js?ver=3.0.2
    ~~~

    Any way I can get rid of any/all of these?

    #1620486
    Leo
    Staff
    Customer Support

    Hi Jeff,

    I think you are confusing jQeury with Javascript.

    GP only uses jQuery if the sticky navigation or blog masonry options are activated – we are working to replace those with vanillla JS.

    Take a look at Elvin’s answer here is you need to remove them:
    https://generatepress.com/forums/topic/how-to-remove-javascript/#post-1557185

    #1620689
    Jeff

    Hello, the sticky is turned off, so how can I get rid of the sticky javascript?
    How can I get rid of all these javascripts?

    ~~~
    /wp-content/plugins/gp-premium/menu-plus/functions/js/sticky.min.js?ver=1.12.3
    /wp-content/themes/generatepress/assets/js/navigation-search.min.js?ver=3.0.2
    /wp-content/themes/generatepress/assets/js/dropdown-click.min.js?ver=3.0.2
    /wp-content/themes/generatepress/assets/js/main.min.js?ver=3.0.2
    ~~~

    And how can I stop loading jquery?

    I have zero plugins loading jquery. Is all of this loading because of Menu Plus?

    #1621104
    David
    Staff
    Customer Support

    Hi there,

    can you share a link to your site where we can see these scripts being requested ?

    #1621162
    Jeff

    Site: https://www.ufafun88.com

    I see these scripts loaded when seeing the waterfall of resource loading using gtmetrix.com

    #1621454
    David
    Staff
    Customer Support

    You have the Mobile Sticky Header and Navigation Search enabled….

    #1622599
    Jeff

    Ah, I had Sticky Navigation: Off, but in the Header it was still turned on. I’ve turned that off. It looks like jquery is no longer loading when that is turned off. Fantastic!

    I see where I can turn Search off.

    The only questions I have are how to get these two turned off?

    
    /wp-content/themes/generatepress/assets/js/dropdown-click.min.js?ver=3.0.2
    /wp-content/themes/generatepress/assets/js/main.min.js?ver=3.0.2
    
    #1622835
    Elvin
    Staff
    Customer Support

    Hi there,

    /wp-content/themes/generatepress/assets/js/dropdown-click.min.js?ver=3.0.2
    /wp-content/themes/generatepress/assets/js/main.min.js?ver=3.0.2

    If you wish to remove them from being queued, you can try adding these.

    add_action( 'wp_enqueue_scripts', 'tu_remove_menu_scripts', 50 );
    function tu_remove_menu_scripts() {
        wp_dequeue_script('generate-dropdown-click');
        wp_dequeue_script('generate-main');
    }

    Reminder: Dropdown-click script is used when you have “click” or “click arrow” enabled on your customizer’s menu settings. Removing it may cause issues.

    A wise man once said:
    "Have you cleared your cache?"

    #1622882
    Jeff

    Great! I changed to “hover” on the customizer’s menu settings, and the generate-dropdown-click script went away.

    I can manually remove generate-main as you suggest. But is there anything I need it for? Is it always queued by default in GeneratePress regardless?

    #1622933
    Elvin
    Staff
    Customer Support

    I can manually remove generate-main as you suggest. But is there anything I need it for? Is it always queued by default in GeneratePress regardless?

    It is used by the theme for toggling things as well. Some lines in the script are being used for the navigation menu’s tablet view.

    Here’s the readable view.
    https://github.com/tomusborne/generatepress/blob/master/assets/js/main.js

    A wise man once said:
    "Have you cleared your cache?"

    #1623118
    Jeff

    The mobile menu doesn’t work at all with generate-main disabled. I’ve re-enabled it, as it is a small price to pay for mobile menu support, until I take the time to figure out a workaround.

    Thanks!

    #1624267
    Elvin
    Staff
    Customer Support

    No problem. 🙂

    A wise man once said:
    "Have you cleared your cache?"

Viewing 12 posts - 1 through 12 (of 12 total)
  • You must be logged in to reply to this topic.