By Dayo on Saturday, 17 June 2017
Posted in Technical Issues
Likes 0
Views 1.3K
Votes 0
Seems EB has sort of tried to replace "JQuery" with "EasyBlog" but my page display is broken with the following message in the JS console triggered wherever there is "EasyBlog": Uncaught ReferenceError: EasyBlog is not defined. An example trigger is "EasyBlog.ready(function($) {...}" in the entry view.

Another JS error is "Cannot read property 'environment' of undefined" triggered by "environment: window.eb.environment" in site-5.1.8-basic.min.js.

Any pointers? For the first one, it would seem a js file that should be loaded before is not.

BTW, a few constants/defines are missing in EB (haven't checked ED yet). Seems to be perennial issue as in https://stackideas.com/forums/bug-mod-easydiscuss-similar-discussions-undefined-constants.

Example is COM_EASYBLOG_COMPOSER_TEMPLATES_TITLE_NEWS. Seen quite a few pop up here and there
Hello Dayo,

I am really sorry for the delay of this reply as it is a weekend for us here. In EasyBlog 5.1, we have optimized it in a way where it will by default inherit jQuery from Joomla without rendering it's own. There is a caveat to that because if there is another module or plugin that tries to load a 3rd party library (which EasyBlog also tries to load) but runs on a different version, things would break.

The other alternative is to configure EasyBlog to use it's own jQuery library. This can be configured under Settings > General > System as you can see here, http://take.ms/YXA2k
·
Saturday, 17 June 2017 12:41
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi Mark,

Sorry, I got lost with your answer. I already have jquery loaded in Joomla and the issue is does not seem to be Jquery anyway as the error is NOT "Uncaught ReferenceError: Jquery is not defined" but "Uncaught ReferenceError: EasyBlog is not defined"

To help get to an answer quicker, as EasyBlog is running "EasyBlog.ready(function($) {...}" and similar, there must be a js file where the EasyBlog object actually defined/loaded. Can you tell me what this is ... as it is not getting loaded in my case for whatever reason?

Same applies to the "window.eb" object.

BTW, I just confirmed that loading the EB Jquery version does not solve the issue as expected. I.E., this is not a jquery issue.

Hope my explanation is clear
·
Saturday, 17 June 2017 18:04
·
0 Likes
·
0 Votes
·
0 Comments
·
Been doing some digging and seeing some slightly messy stuff going on.

Firstly, on the "Cannot read property 'environment' of undefined" error. This is triggered by "environment: window.eb.environment" statement in site-5.1.8-basic.min.js. On looking into the source code of the rendered html, I see that site-5.1.8-basic.min.js is loaded in the head before a block of inline js that defines "window.eb".

<script src="https://www.example.com/media/com_easyblog/scripts/site-5.1.8-basic.min.js"></script>
//Some other Inline JS
<script type="text/javascript">
window.eb = {
"environment": "production",
"rootUrl": "https://www.example.com",
"ajaxUrl": "https://www.example.com/?option=com_easyblog&lang=&Itemid=123",
"baseUrl": "https://www.example.com/?option=com_easyblog&lang=none&Itemid=123",
"token": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"mobile": false,
"ios": false,
"locale": "en-GB",
"momentLang": "en-gb",
"direction": "ltr"
};
</script><script type="text/javascript">window.ed_site = "https://www.on1user.net/";</script>


As the section where windows.eb is defined is located below reference is located below the call in site-5.1.8-basic.min.js, that call would always fail.

Secondly, on the "Uncaught ReferenceError: EasyBlog is not defined" error, it appears some complicated attempt has been made to namescape "JQuery" to "EasyBlog" so that the latter name would be used instead of JQuery.

Issue is that after checking the available js files in "/media/com_easyblog/scripts", the actual namespacing only appears in "composer-5.1.8-basic.min.js" and in "site-5.1.8-basic.min.js".

The EasyBlog namespace is used in "composer-5.1.8.min.js" and in "site-5.1.8.min.js" as well as in inline js within the HTML code such as in the social buttons section but neither of the js files where this namespace is defined ["composer-5.1.8-basic.min.js" or "site-5.1.8-basic.min.js"] is loaded on the page (such as Entry Page) meaning that all calls to EasyBlog.this and EasyBlog.that methods would always fail.

Hope this gives you some pointers as to modifications needed to fix these bugs.
·
Saturday, 17 June 2017 20:45
·
0 Likes
·
0 Votes
·
0 Comments
·
The "basic" version is loaded without any jQuery and EasyBlog will try to use the jQuery copy that is loaded by Joomla but this is temperamental because if you have a 3rd party plugin or module that could be loading additional jquery plugins.

Can you try turning on the option highlighted here, http://take.ms/YXA2k
·
Saturday, 17 June 2017 22:17
·
0 Likes
·
0 Votes
·
0 Comments
·
Thanks Mark,

I have tried that and it does not work. This is not surprising as JQuery by itself is not the problem and my mention of JQuery seems to have turned out to be a bit of a distraction. It was just background which I thought would let you see that I have looked at things and understand the problem.

Perhaps go over my posts again as I tried to explain the issue is not a JQuery issue. Also note how I explained the first issue and the second one.

I repeat here:

- For first issue, windows.eb is called before it is defined.
- For second one, namespacing is done in "composer-5.1.8-basic.min.js" and in "site-5.1.8-basic.min.js"and neither of these are ever loaded.
·
Saturday, 17 June 2017 22:28
·
0 Likes
·
0 Votes
·
0 Comments
·
Hang on, I see that "site-5.1.8-basic.min.js" is indeed loaded. Even there in my code post.Hmmm. Not sure what is up then.

Let me flush all caches and tick the button you suggested just in case
·
Saturday, 17 June 2017 22:31
·
0 Likes
·
0 Votes
·
0 Comments
·
Hm, if the load jquery in EasyBlog is enabled, it should not render the "basic" version. Instead, it should just load site-5.1.8.min.js
·
Saturday, 17 June 2017 23:40
·
0 Likes
·
0 Votes
·
0 Comments
·
Correct. With the "load jquery" in EasyBlog enabled, it uses site-5.1.8.min.js and without, it uses the one with basic. With both ways, the issues are there.

Obviously the first issue about windows.eb is a loading order thing.
The second one with "EasyBlog is not defined" is something else.
·
Saturday, 17 June 2017 23:56
·
0 Likes
·
0 Votes
·
0 Comments
·
Rolled back to 5.0 as this version is just not working for me. Got too many things broken. Might have another go after a few point updates.
·
Sunday, 18 June 2017 02:26
·
0 Likes
·
0 Votes
·
0 Comments
·
Hey Dayo,

I am sorry for the delay of this reply, perhaps you can setup a development site so we can able to troubleshoot this?
·
Monday, 19 June 2017 10:23
·
0 Likes
·
0 Votes
·
0 Comments
·
Seems this was somehow related to RokBooster as switching that off resolves the various js errors. Wasn't an issue with 5.0 but nevermind.

The main EB article page is not rendering properly though and looking into that.

Will post a separate query on that once I have a better understanding.
·
Tuesday, 20 June 2017 03:23
·
0 Likes
·
0 Votes
·
0 Comments
·
Keep us updated if you need any further assistance on other question
·
Tuesday, 20 June 2017 10:17
·
0 Likes
·
0 Votes
·
0 Comments
·
Summation:

Switching RokBooster off resolved the various JS issues. Not sure what changed between 5.0 and 5.1 of J3.6.x and 3.7.x in this regard as it it worked just fine before.

On the entry pages not rendering properly, it turns out that with 5.1 when I enter a blog with this general structure:


<div>
<p>
<!-- Main Content -->
</p>
</div>
<div>
<p>
<!-- Other Content -->
</p>
</div>


I end up with the the first opening div missing in the rendered HTML which breaks things.

Resolved it by changing my existing blogs to be ...


<p>
<!-- Main Content -->
</p>
<p>
<!-- Other Content -->
</p>


That is, avoid the divs.

Again, not sure why this is the case. Affects stuff created with TinyMCE. Shows up fine when I click "source code" but just doesn't render in EasyBlog. Stuff created as regular Joomla Articles do render properly even with RokBooster on.

So the issues are resolved by avoidance rather than actually fixing them but I suppose this can be closed now although it would be great if they were to be actually cured.

Thanks
·
Wednesday, 21 June 2017 01:59
·
0 Likes
·
0 Votes
·
0 Comments
·
That was quite strange, based on what you explanation, it seems like some where remove these div HTML tag when render blog content on the page.

Perhaps you can consider setup a staging site and provide us with your site access so we can able to check on this further.

Because that was quite difficult for us to know what is the issue caused this without access your site.

For now, I will close this ticket, you can start a new thread on our forums if you need any further assistance.
·
Wednesday, 21 June 2017 09:31
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post