• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.
Defer JS

Defer JS 2.2.4

No permission to download

Jeremy P

Well-known member
#1
Jeremy P submitted a new resource:

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

This addon collects javascript in post-view output and moves them to the bottom of the page. This has a noticeable impact on page-load times as pending HTTP requests postpone rendering of a page.

Much of the heavy lifting was derived (with permission) from @Luke Foreman's XFOptimise addon, which is no longer maintained.
Read more about this resource...
 

tajhay

Well-known member
#2

Jeremy P

Well-known member
#3
This requires PHP 5.4+ as stated in the requirements section. Disable listeners via config.php then uninstall and delete the addon.
 

Sheratan

Well-known member
#4
be careful if installing this. Tried installing this with the auto installer and and this was the error i received "
Parse error: syntax error, unexpected '[' in /home/xxx/public_html/www.xyz.com/library/Jrahmy/DeferJs/Defer.php on line 56"

Furthermore my site is now offline and says the following when i try to go there:
"Parse error: syntax error, unexpected '[' in /home/xxx/public_html/www.xyz.com/library/Jrahmy/DeferJs/Defer.php on line 56"

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

On side note, what is the meaning of admin.php?options/list/jrahmy_deferJs
 

Jeremy P

Well-known member
#5
Maybe it's not designed for installation with auto installer?

On side note, what is the meaning of admin.php?options/list/jrahmy_deferJs
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.
 

DRE

Well-known member
#9
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.
 

Chris D

XenForo developer
Staff member
#10
This requires PHP 5.4+ as stated in the requirements section. Disable listeners via config.php then uninstall and delete the addon.
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:
PHP:
[$this, 'collect']
Instead of:
PHP:
array ($this, 'collect')
In my testing, I have just adjusted the array syntax and it appears to be working fine.

upload_2014-3-14_9-8-16.png

upload_2014-3-14_9-8-37.png
 

TBDragon

Active member
#13
wow great addon but there is small problem =(

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

see this

upload_2014-3-14_13-38-59.png

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

waiting ur replay
 

Jeremy P

Well-known member
#15
Will this help defer parsing of javscript seen here when testing of my site being poor in this area?
Yup, as much as possible. Depends on the site but you can generally expect modest improvements.

wow great addon but there is small problem =(

its take all java script to the bottom + the advertisement code also =(
Check out the options ;)
Enter a string from the ad code and it will skip over it.
 

TBDragon

Active member
#16
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.
same thing

this is my code

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

hsoub
hsoub_adplace

nothing change =(
 

Jeremy P

Well-known member
#17
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.
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.
 

tommydamic68

Well-known member
#18
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?

Thanks
 

Jeremy P

Well-known member
#20
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?

Thanks
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.