Topic-icon Javascript conflicts with other extensions

Active Subscriptions:

None
10 years 8 months ago #54946 by devinvail
I'm having problems with List Manager and Easy Blog extensions, and it is possible that the issues stem from JFBC. The site in question is here:

staging.racetracks.club

The developer of List Manager inspected the backend and reported the following:

We've debugged at your site and found this is the plugin causing the js error:

System - JFBCSystem system jfbcsystem Public 10179

if you disable it for a while you should see your records showing again. The problem is that this plugin looks for any 'html' tag inside the page and rewrites all content inside, in order to add its extra code. The jquery library includes one 'html' word, the plugin parses it incorrectly as if it was the html tag of your page and breaks all js of the page (maybe for same reason you also have a js error 'jQuery is not defined' at the system validation library on every other page of your site).

The proper solution would be to ask this plugin devs to fix the plugin, in order to avoid code replacing inside js code like the jquery. In the meantime, the workaround for LM is try to 'cheat' the plugin, modifying the jquery library to hide the html word. This can be done at this file: JOOMLA\components\com_listmanager\assets\js\jquery-1.9.0.js about line 7096 you'll find: doc.write('<!doctype html><html><body>'); Replace this line with: doc.write('<!d'+'oc'+'ty'+'pe '+'ht'+'ml>'+'<ht'+'ml>'+'<bo'+'dy>'); and try again the page with the plugin enabled, we hope it will pass by this section without replacing.

I have installed both these plugins on Joomla sites that do not use JFBC and they work perfectly. Can you shed some light on this?

Thanks

Devin
The topic has been locked.
Support Specialist
10 years 8 months ago #54949 by alzander
Devin,
Thanks for all the information. I'm having a difficult time understanding what the issue actually is. I went to the URL you specified above and things 'seem' correct. However, I don't know what List Manager is or the problem you're running into, so it's hard to diagnose the problem.

Can you explain how we can recreate the issue and what we should be looking for so that we can debug things? The description from the List Manager developer is excellent. What he describes is something we do. However, we have many, many checks in our code to find the 'correct' html tag and not inadvertently alter the whole page.. and it works on thousands of sites. We'll need to understand what's happening on your site to be able to tweak things.

We also don't scan or alter any code in Javascript files, so I'm not sure how altering the jquery-1.9.0.js file would fix anything.

Once we know how to see the problem, we'll help however we can.

Thanks,
Alex
The topic has been locked.
Active Subscriptions:

None
10 years 8 months ago #54955 by devinvail
Hi Alex,

Thanks for the quick reply.

Here is a page on a site with JFBC installed where List Manager should be showing records but is not:

staging.racetracks.club/racetracks

A different site without JFBC using the same LM set up:

www.racetracks.directory/index.php/racetracks/

I am having similar errors with the EasyBlog extension when JFBC is installed.

Please check the above List pages and let me know if this helps.

Thanks!

Devin
The topic has been locked.
Support Specialist
10 years 8 months ago #54960 by alzander
Thank you for sending the details. I see where JFBConnect is altering the auto-generated Javascript from List Manager and think we have a solution. Can you try editing the /plugins/system/jfbcsystem/jfbcsystem.php file. Around line 174, you'll see:
if (!JFactory::getApplication()->isAdmin())
Update that to:
if (!JFactory::getApplication()->isAdmin() && JFactory::getDocument()->getType() == 'html')

We already perform that check to make sure the page is HTML in other sections of the code, but omitted it there. Hopefully, that's all you need. Please let us know how that goes either way!

Thanks,
Alex
The topic has been locked.
Active Subscriptions:

None
10 years 8 months ago #54980 by devinvail
Hi Alex,

we tried that, and now we're getting this error:

Fatal error: Call to undefined method JDocumentRaw::isHtml5() in /home/racetra8/public_html/staging/libraries/joomla/document/html/renderer/head.php on line 66

Devin
The topic has been locked.
Support Specialist
10 years 8 months ago #54986 by alzander
I'm a bit confused as to why that error would be thrown then. JFBConnect doesn't make the isHTML5 call anywhere (we don't care if the output is HTML5). The issue sounds like Joomla is loading an HTML document instead of RAW. You can try a similar fix to the one above in our file at line 89 as well. The code in that block could be inappropriately instructing Joomla to create an HTML document instead of generating the RAW one that List Manager wants.

Please test that and let us know how it goes. On a side note, I'm not sure why List Manager is loading their Javascript the way they are. Generating that very large (15000 line) file on every page load has got to be time consuming on your server. It's not my place to say they are doing it wrong as there can be reasons to do so if there is dynamic content in the Javascript file, but the general method is to load Javascript statically (a file) and only have little snippets of dynamic code generated for each page. It can really decrease load on the server.

Again, JFBConnect is definitely not accounting for this rare use-case and we need to get to the bottom of it and fix it, but I think List Manager could likely improve things on their end as well.

I'm glad their current workaround is working though while we narrow things down further.

Thanks,
Alex
The topic has been locked.
Active Subscriptions:

None
10 years 8 months ago #54993 by devinvail
Hi Alex,

I think you are right in that the issue involves the raw filetype. I should mention that I installed List Manager on a simpler site, and it works fine. But then I install and enable JFBConnect, and then all the errors occur.

www.racetracks.directory/index.php/racetracks/

So something strange is going on - either between the 2 extensions, or one of the extensions is creating issues in Joomla that is affecting the other.

Can you have another look, and try to explain why the List Manager errors are only occurring when JFBConnect is enabled?

Thanks

Devin
The topic has been locked.
Support Specialist
10 years 8 months ago #54997 by alzander
I explained the situation in my last post. JFBConnect is causing some conflicts with how List Manager is trying to dynamically create it's 15,000 line Javascript file. That's something that the change I asked you to make above may fix, but we'd need to have your feedback on if it does or not. In case you missed it, the new change was:
You can try a similar fix to the one above in our file at line 89 as well.
That's in our JFBCSystem.php file.

In general, Joomla and each extension is very complex. There are times when conflicts happen between extensions and we always try to help fix things in whatever way we can, as it seems the List Manager developers have been very helpful in doing as well, which is great!

Thanks,
Alex
The topic has been locked.
Active Subscriptions:

None
10 years 8 months ago #55002 by devinvail
Hey Alex,

That fix worked perfectly on my simple site that has fewer mods and extensions - thanks!

But the bad news is that now I am getting this error in my main site:

Fatal error: Call to undefined method JDocumentRaw::isHtml5() in .../libraries/joomla/document/html/renderer/head.php on line 66

Hopefully we're getting close to solving all this. Thanks for your patience.

Devin
The topic has been locked.
Support Specialist
10 years 8 months ago #55011 by alzander
There's going to have to be some shooting in the dark from here. We don't call the isHtml5 function and the fix above works on one site.. which means that there's now a conflict between JFBConnect, ListManager *and* something else going on.

My best guess now is to re-order the JFBCSystem plugin to be either the first ordered plugin and/or the last plugin to see if either makes an improvement. If not, then I'd recommend selectively disabling any system plugins until the issue goes away. Once we determine the other factor that's different between your two sites, then we'll be able to move forward more from there.

Let me know if the above helps narrow things down and, if not, we'll figure out the next steps.

Thanks,
Alex
The topic has been locked.