Chat still loading JS/CSS outside of designated pages & slowing down website.

Hey guys, the release today states in the changelog:

"- Updated JS/CSS enqueue logic to only load JS/CSS where essentially needed."

However when I View Source outside of a page where I've designated a page with the chat room shortcode I STILL see the chat js & css being loaded which slows down the site considerably for some reason. I've turned off the sitewide chat feature so that's not the reason either. I think you guys forgot to turn the feature listed above on correctly or something in your code. Any hope it might be updated in future updates? Thanks a lot and keep up the great plugins!

  • wp_questions

    Thanks Tom, if you need a link to my site or any details let me know how I can help. This is a really awesome plugin but after downloading this and the Friends plugin the other day I noticed both plugins slowed down my website considerably so unfortunately I had to disable BOTH of them so you can imagine my joy as I logged in today to see this update but unfortunately it isn't working properly yet :slight_frown: I can't wait till they both are really sped up as they are simply OUTSTANDING FEATURES FOR ANY WEBSITE :slight_smile:!

  • Paul

    @phrmc,

    However when I View Source outside of a page where I've designated a page with the chat room shortcode I STILL see the chat js & css being loaded

    The note in the change log was to be specific to wp-admin area. In prior versions we were loading many of the files like farbtastic (color picker) and tinymce popup JS on all pages within wp-admin where is is really only uses on places like the Post editor form and the Chat settings pages.

    Because Chat 2.x allows for private chats the chat runs on all pages. This is actually by design. Not just those that have the shortcode. At the moment there is only the ability to hide the bottom corner chat from loading/showing on certain pages.

    If you are having trouble with server performance try adjusting the poll interval on Chat > Settings Common. Also, how much memory are you allowing WP per your wp-config.php? How many other plugins are you running? This can severely impact performance since Chat polls by default every second for every user.

  • Paul

    if you need a link to my site or any details let me know how I can help

    Yes, please!

    This is a really awesome plugin but after downloading this and the Friends plugin the other day I noticed both plugins slowed down my website considerably so unfortunately I had to disable BOTH

    Well the Friends plugins should have very little impact on your site. The only thing it does currently is load the user's Friends into the WP toolbar. Unlike Chat which polls for new messages and such. The Friends data is pretty static. What sort of hosting are you using? Again Chat plugins are by nature server resource drains. Give me a URL and maybe I can help figure things out.

    Oh and this means you will need to turn at least the chat plugin back on. Sorry.

  • wp_questions

    Hey Paul how are you buddy?

    Give me a URL and maybe I can help figure things out.

    Okay here's a link http://bit.ly/118Mc48

    Also, how much memory are you allowing WP per your wp-config.php?

    define('WP_MEMORY_LIMIT', '512M');

    How many other plugins are you running?

    Not a lot

    If you are having trouble with server performance try adjusting the poll interval on Chat > Settings Common.

    Changed it to 2 but really doesn't make much of a difference.

    Well the Friends plugins should have very little impact on your site. The only thing it does currently is load the user's Friends into the WP toolbar.

    Yeah odd I don't know both of these plugins just make an immediate impact on slowing down my site. I'm sure as you guys refine the plugins things will get better.

    ANY PLANS to have an option to not load the jss/css/etc files unless on a page that is using the shortcode? This would considerably speed up this application as well as any others. Thanks!

  • Paul

    ANY PLANS to have an option to not load the jss/css/etc files unless on a page that is using the shortcode? This would considerably speed up this application as well as any others.

    I guess we do now. Will probably be some option to disable private chat. So that means the not loading the one file wpmudev-chat.js which is the core to the message polling. But will be loaded on page where you have user the shortcode.

    So looking at your site. To my is doesn't seem slow or sluggish. And I know your site is somewhat under construction. But I noticed when I view the Chat page for example I see many JS files that in my opinion aren't needed:

    ColReorderWithResize.js
    Some Maps API JS libraries
    jquery.dataTables.min.js
    jwplayer.js
    anti-captcha
    upcoming calendar widget (From our Events+ plugins)

    Are you by chance running any caching plugins? Seems with these you would require it. Sorry I'm getting into your business and I apologize. I'll work on Chat.

    Moving this to feature request. Might have a beta for you to test in a few days.

  • wp_questions

    I guess we do now. Will probably be some option to disable private chat. So that means the not loading the one file wpmudev-chat.js which is the core to the message polling. But will be loaded on page where you have user the shortcode.

    Genius mode on. Rock on brother I'm looking forward to that.

    ColReorderWithResize.js
    Some Maps API JS libraries
    jquery.dataTables.min.js
    jwplayer.js
    anti-captcha
    upcoming calendar widget (From our Events+ plugins)

    Hey Paul you might have a little trick I can use. Anyway you know to not have some css/jss/etc load unless on certain pages, *.com/*** etc.? If I can figure out some simple code then that would save me from having to load these scripts on every page (since all I do now is just throw it in a box in the theme I'm using that is for Google Analytics code which inserts anything you put there in the < head > section). I'm glad I was able to help however and that you guys will be implementing this :slight_smile:! I'm sure it will help many folks! As for the upcoming calendar widget you should do the same thing with events so it doesn't load on every page too (but I am using it on most pages just not the main chat room one).

    Are you by chance running any caching plugins? Seems with these you would require it.

    Yes I'm using this one http://codecanyon.net/item/dynamic-website-compressor/2838376 (btw I can turn it off if you need to see the View Source better).

    Sorry I'm getting into your business and I apologize. I'll work on Chat.

    No problem at all my friend, if I don't give you the information you need I will miss out on some knowledge you can share or so might the community here.

    Moving this to feature request. Might have a beta for you to test in a few days.

    Nice!

  • Paul

    @phrmc,

    Ok. I think I'm done but still testing. Decided to let this loose so maybe another set of eyes will find something.

    https://dl.dropboxusercontent.com/u/2616987/WPMUDev/wordpress-chat/wordpress-chat-2.0.3.1-Beta1.zip

    On the Chat > Settings Common page I renamed the 'WP admin' tab to just 'Blocked URLs' Seemed appropriate wince the other tabs are 'Blocked IP/User' and 'Blocked Words'.

    On this new tab you will fine the new section (see image) to allow include/exclude of the Chat JS/CSS on specific pages.

    1. The first dropdown is an all or none switch. Setting this to No will exclude the JS/CSS on all URLs that don't need it. So on pages that don't have the page shortcode and/or widget defined. If this is set to No the other options are hidden.

    2. The second dropdown selects the action for any URLs entered into the #3 field. You can include or exclude

    3. This is where you enter the URLs if needed.

    In addition to the above. I've added similar logic to the Chat > Settings Wigets then Advanced tab. To let you exclude the widget from display. Also added a dropdown to not show the widget on pages where the page shortcode was being used.

    I have some other things to close out before me trip. Just post back here and I'll review on my return. Thanks.

  • wp_questions

    Hey Paul thanks for the update! Can't wait to see what else you add!

    Here's a couple issues,

    For Chat Settings Common->Blocked URLs,
    I notice when I select on
    Load JS/CSS on ALL URLs,
    "No, only URLs..."
    that the second and third boxes below it
    titled "Select Action" and "WP Front URLs"
    disappear BUT this doesn't happen on the Advanced tabs for Settings Page, Settings Site or Settings Widget. Shouldn't it not disappear?

    So what is the difference between Select Action->Show on Front URLs Only and Select Action on->Hide on Front URLs which as of right now both are only accessible when Load JS/CSS on ALL URLs->Yes all URLs is active or was this how you meant to code it and do you think that's the best way to display those option?

    Also, for the "Chat Settings Widget" when you Enable

    On Chat Settings Site->Advanced,
    1.) "You may also want to configure the global Blocked URLs", the link takes you to the save changes button, maybe you used the wrong #anchor?

    2.) So for Show on URLs Only vs Hide on URLs, can you give me some examples how I'd use each. So does the first mean it will show on just those URLs listed and the second option mean it will show on all URLs except the ones listed? Do you type in the full url with the http:// or how exactly are you expected to enter these lines? Also with the Hide on URLs won't that be overrided by the Settings Common->Advanced option of not loading CSS/JS on every page?

    Thanks!!!

  • Paul

    @phrmc,

    For Chat Settings Common->Blocked URLs,
    I notice when I select on
    Load JS/CSS on ALL URLs,
    "No, only URLs..."
    that the second and third boxes below it
    titled "Select Action" and "WP Front URLs"
    disappear BUT this doesn't happen on the Advanced tabs for Settings Page, Settings Site or Settings Widget. Shouldn't it not disappear?

    Correct, This is by design. The Load JS/CSS setting is just for URLs where no other shortcode, widget or bottom corner chat are going to show. For example you setup a shortcode on a page http://www.somesite.com/register By default Chat loads the needed JS/CSS on all page. If you set the load JS/CSS to 'No' then it will not be loaded on the register page because it is not needed. Different example. You have a page http://www.somesite.com/chat where you have loaded the chat shortcode. You set the load JS/CSS to no. When you visit that page the JS/CSS still loads because there is a shortcode on the page which needed to function.

    So what is the difference between Select Action->Show on Front URLs Only and Select Action on->Hide on Front URLs which as of right now both are only accessible when Load JS/CSS on ALL URLs->Yes all URLs is active or was this how you meant to code it and do you think that's the best way to display those option?

    The assumption is when you set the load JS/CSS to 'No' that you basically want to exclude the unneeded JS/CSS on pages where there is not a shortcode, widget or bottom corner chat. So the other two fields are taken away. I mean what would be the point. But supposed you want the load JS/CSS to load on 'most' pages. But need a way to only exclude a few. This is where the other two fields come in. Like the above example you have a /register page you don't want the chat loaded because you have some other videos or whatever. The page is heavy enough. So you set the first option to 'exclude' and enter in the URL of the /register page.

    Also, for the "Chat Settings Widget" when you Enable

    The other Settings Site and Settings Widget are specific to those chat options. The Settings Site section controls the site (bottom corner) chat. Once enabled, will show the bottom corner chat on all pages. But via the Settings Site > Advanced tab you can exclude the bottom corner chat from showing. The Settings Widget is similar. By default once you add the widget to a sidebar you have no control when the widget is used other than playing tricks with the sidebar. So Settings Widget> Advanced provides the ability to only control include/exclude URLs where the widget will appear. Maybe you only want the widget to appears on your product pages. Or wherever.

    On Chat Settings Site->Advanced,
    1.) "You may also want to configure the global Blocked URLs", the link takes you to the save changes button, maybe you used the wrong #anchor?

    I'll double check. It is supposed to take you to Settings Global >Blocked URLs tab.

    2.) So for Show on URLs Only vs Hide on URLs, can you give me some examples how I'd use each. So does the first mean it will show on just those URLs listed and the second option mean it will show on all URLs except the ones listed? Do you type in the full url with the http:// or how exactly are you expected to enter these lines? Also with the Hide on URLs won't that be override by the Settings Common->Advanced option of not loading CSS/JS on every page?

    First there is not a tab Settings Common > Advanced. The Advanced tabs are only on Settings Page/Site/Widget. See my examples above on how I think the dropdowns will be used. As for entering the URL I thought I noted that to the left of the input fields. You can enter the full URL. Or I would prefer just using the relative URL. So again you can enter the full URL as http://www.somesite/products/cameras/Nikon or just enter the relative URL /products/cameras/Nikon

    Hope this helps. And yes I've very worried about the confusion this might bring. But I know users that get it will need it.

  • wp_questions

    Okay cool thanks for the explanation! Can't wait for this to be out of beta, I think it's a really smash idea and who knows, one day it may be even as fast SITE WIDE as Facebook chat but for now I'm happy with it not loading on every page and being able to have a reliable chat solution for a single page :slight_smile:! Let me know when it's out of beta. Thank you once again my friend!

  • Paul

    @phrmc,

    Let me know when it's out of beta.

    I guess I'm confused now. I provided the beta for you to test out to make sure you can exclude the JS/CSS on pages where it is not needed. So I had expected you to be all in the beta testing not wait for this to be out of beta.

    one day it may be even as fast SITE WIDE as Facebook chat

    Doubtful. Not sure if you use Facebook chat on any other platform other than web. When you are logged into Facebook sure the chat is fast. Same with Google+ But then again they have full control of the front-end and backend servers. What I mean is you are running chat on their closed system. and I can guarantee the servers are tuned much better than any web hosting system you or I have access to.

  • Paul

    @phrmc,

    Sorry, I didn't see your bugs. I'll go back and reread your previous comments.

    I'll not be releasing this just yet. I'm about to take a trip and will be out tomorrow through beginning of next week. So don't want to release these changes until next week.

    But I have some emergency bug I do need to get out today for Chat. Today's release will be the official 2.0.3.1 containing the bug fixes. Moving this JS/CSS filtering to the 2.0.4 release for next round.

    Thanks.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.