Support » Plugin: Autoptimize » Making Ninja Popups work with Autoptimize – optimize JS option

  • Resolved JayPatrol

    (@jaypatrol)


    Hi

    I came across Autoptimize because it’s recommended by WPEngine who I use for my higher traffic website. I’ve been really pleased with the results, thank you, and have donated suitably to a good cause!

    However a site I am trying to optimize at the moment uses Ninja Popups. Whilst I have read that other people have been able to make Ninja Popups work the Autoptimize I have so far failed.

    I wondered if the CDN was causing a problem so have excluded the Autoptimize cache from the CDN – that wasn’t the solution.

    I’ve also tried excluding ninjapopups.min.js and jquery.js from the JS optimization in the Autoptimize advanced settings.

    I did see if ARSCode the developers could help. They had admin access and FTP access but came back with “Ok it looks like from using this plugin Autoptimize popups will not work well.”

    I have the live site here running Ninja Popups:

    http://pgpt.co.uk

    and the same site in a staging area with autoptimize running with Javascript optimization. The popups are not working in this instance and I am getting these errors:

    SyntaxError: expected expression, got ‘<‘ – in the php file that Autoptimize generates

    and ReferenceError: snp_enable_mobile is not defined in ninjapopups.min.js

    If you’re happy to look at this I can privately send you access to the staging area and FTP access.

    I want to be able to make the most of the benefits of Autoptimize and it would be a shame to lose out on so much of that if there is a workaround to the Ninja Plugin problem.

    I hope you can help please.

    J

    https://wordpress.org/plugins/autoptimize/

Viewing 15 replies - 1 through 15 (of 17 total)
  • Plugin Author Frank Goossens

    (@futtta)

    interesting challenge 🙂

    could you provide me with the link to the staging site?

    frank

    Thread Starter JayPatrol

    (@jaypatrol)

    Hi Frank

    Sorry, new I’d forget to include something:

    http://pgpt.staging.wpengine.com

    J

    Plugin Author Frank Goossens

    (@futtta)

    OK, on staging this error

    SyntaxError: expected expression, got ‘<‘ – in the php file that Autoptimize generates

    doesn’t appear.

    This one

    ReferenceError: snp_enable_mobile is not defined in ninjapopups.min.js

    does and I would try adding snp_f (to exclude the block of inline code which sets multiple snp_ values) to the comma-seperated JS optimization exclusion-list for that.

    frank

    Thread Starter JayPatrol

    (@jaypatrol)

    Hi Frank

    Thank for this. I’ve done that but now I’m getting

    Uncaught TypeError: jQuery.cookie is not a function

    J

    Plugin Author Frank Goossens

    (@futtta)

    ok, either

    exclude jquery.ck.min.js
    OR
    exclude arscode-ninja-popups/js (which is a catch-all for all JS by ninja-popups, including jquery.ck.min.js)

    frank

    Thread Starter JayPatrol

    (@jaypatrol)

    I’m sorry this is becoming iterative…

    Now I’m getting:

    jQuery.fancybox2 is not a function

    Plugin Author Frank Goossens

    (@futtta)

    arscode-ninja-popups/fancybox2/jquery.fancybox.min.js?ver=4.4.2′

    is the culprit. kind of illogical folder organisation on arscode’s part maybe 🙂

    so we’ll have to exclude arscode-ninja-popups

    regarding this proces being iterative; that is how troubleshooting works actually, cfr. some more info in the FAQ 🙂

    Thread Starter JayPatrol

    (@jaypatrol)

    Sorry, my comment about it being iterative was my clumsy way of apologising that it was continuing to take up your time – I hope you didn’t take it any other way.

    Thank you that has done the trick.

    Plugin Author Frank Goossens

    (@futtta)

    Thank you that has done the trick.

    Great, be sure to let the ARSCode guys know! Actually it’s a pity they weren’t able to help you out here; you’re paying them after all, the solution in the end is pretty simple (exclude jquery.js, arscode-ninja-popups) and AO is far from an obscure little plugin.

    I hope you didn’t take it any other way.

    absolutely not. my reply seems pretty clumsy in hindsight, as it made you feel uncomfortable, so .. 🙂

    have fun!
    frank

    Thread Starter JayPatrol

    (@jaypatrol)

    Sorry Frank – I thought we’d reached the “show a man how to fish and he can feed himself” stage.

    However, I am now stuggling with the CSS optimization.

    I’ve tried exluding:

    arscode-ninja-popups,reset.min.css,newtheme8.css

    but still can’t get the popup to style correctly with CSS optimization turned on.

    How it should look: pgpt.co.uk

    How it looks without the customer styling with AO CSS Styling activated (and with the above excluded): pgpt.staging.wpengine.com

    Plugin Author Frank Goossens

    (@futtta)

    Sorry Frank – I thought we’d reached the “show a man how to fish and he can feed himself” stage.

    no problem

    but still can’t get the popup to style correctly with CSS optimization turned on.

    based on what is on staging now (comparing in “inspector” between optimized and non-optimized code by adding ?ao_noptimize=1 to the URL) I would suggest to add .snp-pop- to the CSS optimization exclusion list.

    fingers crossed 😉
    frank

    Thread Starter JayPatrol

    (@jaypatrol)

    Many thanks. That did solve that problem.

    I now have a couple of other issues to do with the main stylesheet and the twitter feed not loading in the live (ie. CDN version) of the site with AO activated.

    WPEngine told me to try adding the: define(“AUTOPTIMIZE_LEGACY_MINIFIERS”,”true”); which is mentioned in one of your threads and that wasn’t the solution in my case.

    Not wanting to do testing on the live site, and the staging version not having a CDN, I’m going to create a clone of the site for testing and will start a new thread if you might be able to help at that stage.

    Thanks very much for your help again.

    Plugin Author Frank Goossens

    (@futtta)

    I now have a couple of other issues to do with the main stylesheet and the twitter feed not loading in the live (ie. CDN version) of the site with AO activated.

    the twitter feed issue is likely a JS optimization problem, have a look at your browser’s (error) console to see if anything pops up there.

    Not wanting to do testing on the live site, and the staging version not having a CDN, I’m going to create a clone of the site for testing and will start a new thread if you might be able to help at that stage. Thanks very much for your help again.

    sure, no problem 🙂

    Thread Starter JayPatrol

    (@jaypatrol)

    Hi Frank

    I’ve now set up a clone of the live site – although I think I’ve now excluded the CDN from being the cause of the problem so the staging environment might have proved just as revealing. I think my problem with the twitter feed was also a red herring.

    The site clone is here:
    http://pgpttest.wpengine.com

    I thought I had a solution two posts ago but now think I might not have purged the cache so it wasn’t actually solved.

    So, now I am left with one issue which is when I turn on Optimize CSS Code, I get a largely unstyled page.

    I have added back in to the wp-config.php the line:
    define("AUTOPTIMIZE_LEGACY_MINIFIERS","true");

    but that doesn’t change things for me.

    I’ve tried to interpret the console results and am seeing 404 errors for AO cached files.

    My excludes for CSS Optimization are:

    admin-bar.min.css, dashicons.min.css,arscode-ninja-popups,reset.min.css,newtheme8.css,.snp-pop-

    Can you help please?

    Plugin Author Frank Goossens

    (@futtta)

    I’ve tried to interpret the console results and am seeing 404 errors for AO cached files.

    this is probably due to the AO-cache being purged without the WPE-cache being cleared as well (AO does not do that, yet). clear any/ all caches (WPE + AO) and see if that fixes the problem.

    frank

Viewing 15 replies - 1 through 15 (of 17 total)
  • The topic ‘Making Ninja Popups work with Autoptimize – optimize JS option’ is closed to new replies.