Can style developers go easy on the javascript extras?

Brent W

Well-known member
Or at least make it so that javascript isn't being loaded if we aren't using the features. Just look at what is used on UI.X. I like the look of the style but it really sucks that Javascript is so heavily relied on. We aren't using the sticky navigation, yet all the code is present. I don't mean to pick on just them. Others do the exact same as well.

I couldn't even submit this post because of how many lines of javascript were present.

https://www.religiousforums.com/js.txt
 

Arty

Well-known member
Problem is js files aren't parsed by template engine and styles cannot run any server side scripts. So there is no way to do it without add-on. Unless code is directly included in template or split into multiple files, both of which are even worse.

Its one of reasons my future styles will all require an add-on. It will make installation a bit more complicated, but I think benefits outweigh it.
 

Brent W

Well-known member
Problem is js files aren't parsed by template engine and styles cannot run any server side scripts. So there is no way to do it without add-on. Unless code is directly included in template or split into multiple files, both of which are even worse.

Its one of reasons my future styles will all require an add-on. It will make installation a bit more complicated, but I think benefits outweigh it.
But UI.X comes with an add-on already. Not sure how many other developers do it or not. I am hopeful that XF2 will rid my of relying on 3rd party styles. I really like the look out of the box.
 

Mike Creuzer

Well-known member
Or at least make it so that javascript isn't being loaded if we aren't using the features. Just look at what is used on UI.X. I like the look of the style but it really sucks that Javascript is so heavily relied on. We aren't using the sticky navigation, yet all the code is present. I don't mean to pick on just them. Others do the exact same as well.

I couldn't even submit this post because of how many lines of javascript were present.

https://www.religiousforums.com/js.txt
That is a drop in the bucket compared to what XenForo loads in. We load it there because as @Arty pointed out we have no choice. In other words if you want to be able to say control whether users can collapse the sidebar, you did a line of code there.

The JavaScript for UI.X has been optimized so much that it only adds 3% load to your site. Other styles add as much as 50% because they use jQuery. We use raw JS.
 

Brent W

Well-known member
That is a drop in the bucket compared to what XenForo loads in. We load it there because as @Arty pointed out we have no choice. In other words if you want to be able to say control whether users can collapse the sidebar, you did a line of code there.

The JavaScript for UI.X has been optimized so much that it only adds 3% load to your site. Other styles add as much as 50% because they use jQuery. We use raw JS.
Thanks for the explanation.
 

Mike Creuzer

Well-known member
Thanks for the explanation.
No problem and if you are ever curious as to some of the optimizations Id be happy to show you! We needed to make UI.X work on sites like Yahoo fantasy, Rivals, MacRumors, etc so we went out of our way to overly optimize and test for oddball devices.
 
Top