WordPress.org

Ready to get started?Download WordPress

Forums

Autoptimize
[resolved] Ignore certain inline JavaScript (7 posts)

  1. Michael Cannon
    Member
    Posted 1 year ago #

    Is it possible to ignore certain blocks of inline JavaScript?

    My Zendesk Zenbox helper is getting pulled out and sent to cache file but it doesn't work then.

    http://wordpress.org/extend/plugins/autoptimize/

  2. Michael Cannon
    Member
    Posted 1 year ago #

    In checking out autoptimizeScripts.php, I wonder if you could put a filter on loading vars like dontmove so that we can customize our themes to work better with Autoptimize.

    Ah… wait there's a JavaScript option on things to exclude. Oh, I see how it works now. Guess, what, I'm okay now.

  3. noapi1
    Member
    Posted 1 year ago #

    Michael, could you please explain what you did enter in the admin page in the field "Exclude scripts from autoptimize:" to exclude an inline JS?

    Thanks!

  4. Michael Cannon
    Member
    Posted 1 year ago #

    Thank you for this. You just made me figure out how to get Gist includes working on my site. I had forgotten about Autoptimize moving inlines to bottom.

    in "Exclude scripts from autoptimize", I simple add a comma "," and then a keyword from the start of the actual JavaScript that I'm working with.

    Check out the source code of http://aihr.us and see how the following bits are left alone, "s_sid,smowtion_size,sc_project,WAU_,wau_add,comment-form-quicktags,edToolbar,ch_client,zenbox.js,Zenbox.init,ClickTale,gist.github.com".

  5. noapi1
    Member
    Posted 1 year ago #

    Thanks, I got it. Yesterday I tried nearly the same, but it didn't work. Today I used some variables from the code and it worked.

  6. talgalili
    Member
    Posted 1 year ago #

    Great answer, thank you.

  7. Frank Goossens
    Member
    Plugin Author

    Posted 10 months ago #

    fyi; I'm pushing a "beta"-version of 1.6.6 out (download here), which has noptimize-support.

    A simple example of JS being excluded;
    <!--noptimize--><script>alert('this will not get autoptimized');</script><!--/noptimize-->

    Looking forward to your feedback!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.