1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Defer JS 2.2.4

Moves XenForo javascripts to before the </body> tag for performance.

  1. Jeremy P

    Jeremy P Well-Known Member

    Jeremy P submitted a new resource:

    Defer JS - Moves XenForo javascripts to before the </body> tag for performance

    Read more about this resource...
    Digital Doctor likes this.
  2. tajhay

    tajhay Well-Known Member

  3. Jeremy P

    Jeremy P Well-Known Member

    This requires PHP 5.4+ as stated in the requirements section. Disable listeners via config.php then uninstall and delete the addon.
  4. Sheratan

    Sheratan Well-Known Member

    Maybe it's not designed for installation with auto installer?

    On side note, what is the meaning of admin.php?options/list/jrahmy_deferJs
    vanhoa8989 likes this.
  5. Jeremy P

    Jeremy P Well-Known Member

    Per the description:
    Enter a unique string of text from any script tags which should not be moved. One per line.

    If one of the lines entered there is found in an inline javascript or script URL it will not be moved to the bottom of the page. For example if the default ad settings were not here it would move advertisements which would otherwise be a nasty side effect.
  6. kezako

    kezako Active Member

    i tried to install and :

    Callback Jrahmy\DeferJs\Listener::fileHealthCheck is invalid (Invalid Class).
    vanhoa8989 likes this.
  7. Sheratan

    Sheratan Well-Known Member

    Well, GTMetrix show improvement in Defer JS section. Good. :)
    otto, vanhoa8989 and Jeremy P like this.
  8. Jeremy P

    Jeremy P Well-Known Member

    It sounds like you didn't upload the files correctly.
    vanhoa8989 and kezako like this.
  9. DRE

    DRE Well-Known Member

    Works with Waindigo's Install and Upgrade. Thank you! Guess I'll do a GTMetrix test. Not sure if possible from my phone but I'll give it a shot.
    vanhoa8989 likes this.
  10. Chris D

    Chris D XenForo Developer Staff Member

    I have this working in PHP 5.3.

    Unless I've overlooked something, the only thing that isn't PHP 5.3 compatible is your array syntax. You're using the relatively new array shorthand.

    So you're using:
    Instead of:
    array ($this'collect')
    In my testing, I have just adjusted the array syntax and it appears to be working fine.


    pecadm, Walter and vanhoa8989 like this.
  11. tommydamic68

    tommydamic68 Well-Known Member

    Will this help defer parsing of javscript seen here when testing of my site being poor in this area?

    Screen Shot 2014-03-14 at 5.30.32 AM.png
    vanhoa8989 likes this.
  12. tommydamic68

    tommydamic68 Well-Known Member

    Apparently here is the issue on the first two lines:

    Screen Shot 2014-03-14 at 5.33.45 AM.png
    vanhoa8989 likes this.
  13. TBDragon

    TBDragon Active Member

    wow great addon but there is small problem =(

    its take all java script to the bottom + the advertisement code also =(

    see this


    so is there way to make an exclude for some code like but an if statements for them or something else =(

    waiting ur replay
    vanhoa8989 likes this.
  14. Chris D

    Chris D XenForo Developer Staff Member

    The add-on has options. There you can exclude certain JS from being deferred.
    vanhoa8989, Jeremy P and TBDragon like this.
  15. Jeremy P

    Jeremy P Well-Known Member

    Yup, as much as possible. Depends on the site but you can generally expect modest improvements.

    Check out the options ;)
    Enter a string from the ad code and it will skip over it.
    vanhoa8989 and Adam Howard like this.
  16. TBDragon

    TBDragon Active Member

    same thing

    this is my code

    <!-- Begin Hsoub Ads Ad Place code -->
    <script type="text/javascript"><!--
    hsoub_adplace = xxxxxxxx;
    hsoub_adplace_size = '160x600';
    <script src="http://ads2.hsoub.com/show.js" type="text/javascript"></script>
    <!-- End Hsoub Ads Ad Place code -->
    in the option i tried


    nothing change =(
    vanhoa8989 likes this.
  17. Jeremy P

    Jeremy P Well-Known Member

    Yeah. The filesums contains an array so you'll want to patch that too.

    I couldn't find a Linux distro with a pre 5.4 PHP in the latest stable version, so I'm not really interested in maintaining compatibility with prior versions.
    gfc, vanhoa8989 and Adam Howard like this.
  18. tommydamic68

    tommydamic68 Well-Known Member

    How do you know how to properly set this up with ease or must you have coding knowledge. Do you want google ads bypassed I guess? Is there anything else needing bypassing to function properly?

    vanhoa8989 likes this.
  19. Jeremy P

    Jeremy P Well-Known Member

    Oops, I forgot to namespace some old code (originally wrote this when 1.1 came out). Pushing out a fix gimme a minute or two.
    vanhoa8989, TBDragon and Adam Howard like this.
  20. Jeremy P

    Jeremy P Well-Known Member

    Adsense (and Adbrite? I think) are bypassed by default for the most common setups. Unless you have a funky addon or different ad vendor you should be good. If something isn't working I'd be happy to take a look.
    vanhoa8989 likes this.

Share This Page