Hi Folks,
This block of code is causing the above error on my Joomla site.
Can anyone please tell me how I can rewrite this or fix the problem?
Thanks in advanceCode:<script type="text/javascript"> SqueezeBox.initialize({}); </script>
| SitePoint Sponsor |


Hi Folks,
This block of code is causing the above error on my Joomla site.
Can anyone please tell me how I can rewrite this or fix the problem?
Thanks in advanceCode:<script type="text/javascript"> SqueezeBox.initialize({}); </script>

Hi,
I found something relating to this on the Joomla Forums.
Here's the link: http://forum.joomla.org/viewtopic.php?f=471&t=300470
Does this help at all?
How well do you know your JavaScript from your jQuery?
Check out SitePoint's latest JavaScript challenge
My blog


Thanks very much for the reply.
The thread is a few years old and the file that need changing looks quite a bit different.
Any ideas?
Thanks again.

Hi,
How long is the file in question?
Would it be possible to post it somewhere (Pastebin, for example)?
Although the thread in the forum is a few years old, I think it would still be worth having a look at this file.
How well do you know your JavaScript from your jQuery?
Check out SitePoint's latest JavaScript challenge
My blog


OK great.
Here is the page:
http://pastebin.com/nUrmYD3z
Thanks again

Hi,
Line 349 is the one you need to change.
Try changing this:
into this:Code JavaScript:window.addEvent('domready', function() {
Not sure if it'll work, but this is what they were on about in the forum discussion I posted a link to.Code JavaScript:window.addEvent('load', function() {
Let me know how it goes.
How well do you know your JavaScript from your jQuery?
Check out SitePoint's latest JavaScript challenge
My blog


Thanks very much for the reply. I;ve made that change, and the function has changed in the webpage. Problem is, I cant see any javascript library referenced in the head of the document. Is that right?
Thanks again
HTML Code:<html class="firefox firefox16" xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-gb" dir="ltr" lang="en-gb"> <head> <base href="xxx/"> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <meta name="keywords" content="joomla, Joomla"> <meta name="description" content="Joomla! - the dynamic portal engine and content management system"> <meta name="generator" content="Joomla! - Open Source Content Management"> <title>Home - xxx</title> <link rel="stylesheet" type="text/css" href="/plugins/system/jch_optimize/cache/jscss.php?f=97f10f3853728535494f0bfa8c2702dd-cache-plg_jch_optimize-2f27a3976b7ea1654e79274298daa592&type=css&gz=gz&d=2"> <link href="/?format=feed&type=rss" rel="alternate" type="application/rss+xml" title="RSS 2.0"> <link href="/?format=feed&type=atom" rel="alternate" type="application/atom+xml" title="Atom 1.0"> <link href="/favicon.ico" rel="shortcut icon" type="image/vnd.microsoft.icon"> <link href="/component/search/?format=opensearch" rel="search" title="Search xxx" type="application/opensearchdescription+xml"> <script src="https://ssl.google-analytics.com/ga.js" async="" type="text/javascript"></script> <script type="text/javascript"> window.addEvent('load',function(){new JCaption('img.caption');});</script> </head> <body> <div class="custom cookie"> <p>We use cookies to improve your experience of using this website. <a href="/cookies">Find out more.</a></p> </div> <link rel="stylesheet" href="/templates/bccg_2/css/font-awesome.css"> <!--[if IE 6]><link rel="stylesheet" href="/templates/bccg_2/css/template.ie6.css" type="text/css" media="screen" /><![endif]--> <!--[if IE 7]><link rel="stylesheet" href="/templates/bccg_2/css/template.ie7.css" type="text/css" media="screen" /><![endif]--> <!--[if IE 7]><link rel="stylesheet" href="/templates/bccg_2/css/font-awesome-ie7" type="text/css" media="screen" /><![endif]--> <script type="text/javascript"> if('undefined'!=typeof jQuery)document._artxJQueryBackup=jQuery;</script> <script type="text/javascript"> jQuery.noConflict();</script> <script type="text/javascript" src="/plugins/system/jch_optimize/cache/jscss.php?f=97f10f3853728535494f0bfa8c2702dd-cache-plg_jch_optimize-6896560e59a7a716cf1caea0710e3b45&type=js&gz=gz&d=2"></script> <script type="text/javascript"> if(document._artxJQueryBackup)jQuery=document._artxJQueryBackup;</script>


Thanks again, really appreciate it. IE 7 still gives operation aborted and shuts down.
I still get the errors:
Timestamp: 30/11/2012 12:47:14
Error: TypeError: window.addEvent is not a function
Source File: https://www.xxx/
Line: 2
Timestamp: 30/11/2012 12:55:26
Error: ReferenceError: jQuery is not defined
Source File: https://www.xxx/
Line: 4

I'm afraid I'm not sure.
If everything still works as expected, then it's probably all good.
If something seems to be broken or has stopped working, then we'll have to look for another solution.
How well do you know your JavaScript from your jQuery?
Check out SitePoint's latest JavaScript challenge
My blog

Hmm, tricky one!
Is it possible for you to post a link to the page, where I can have a look at what is going wrong and get an idea of the bigger picture.
How well do you know your JavaScript from your jQuery?
Check out SitePoint's latest JavaScript challenge
My blog


Thanks again!
OK great, Is there a way I can post a link without search engines picking it up?

You could PM me.
Or when composing your message click "Go Advanced" and remove the tick by "Automatically parse urls" (don't know how effective that is).
Or, you could get creative, e.g.:
domain = mydomain
tld = .com
remote folder = testing
Go to: www.domain.tld/remote folder/index.php
How well do you know your JavaScript from your jQuery?
Check out SitePoint's latest JavaScript challenge
My blog

Hi,
So I've had a look at the site.
Did you revert the changes we made to 'behavior.php'?
It would be good if you could do this then summarize the problem in IE7
How well do you know your JavaScript from your jQuery?
Check out SitePoint's latest JavaScript challenge
My blog


Thanks for the replies and advice once again.
Changed behaviour.php to this:Pullo
Hi,
So I've had a look at the site.
Did you revert the changes we made to 'behavior.php'?
It would be good if you could do this then summarize the problem in IE7
Still get the errors below in FF, IE 7 just closes with the operation aborted error.PHP Code:// Attach modal behavior to document
$document
->addScriptDeclaration(
"
window.addEvent('load', function() {
SqueezeBox.initialize(" . $options . ");
SqueezeBox.assign($$('" . $selector . "'), {
parse: 'rel'
});
});"
);
Timestamp: 02/12/2012 11:55:40
Error: TypeError: window.addEvent is not a function
Source File: https://www.xxx/
Line: 2
Timestamp: 02/12/2012 11:55:40
Error: ReferenceError: jQuery is not defined
Source File: https://www.xxx/
Line: 4
Thanks for the reply, do you know how I can edit the code to do that? which page do I need to edit?As I recall, the usual cause of that problem was when a script block positioned within a child element of <body>, attempted to generate an element. If that block is so positioned, try moving it out of the child element.
Thanks again, really appreciate it.

Hi there,
The first errror is being caused by this line of code:
Code JavaScript:window.addEvent('load',function(){new JCaption('img.caption');});
This is a small block of MooTools code which Joomla adds to the head of every page to initialise JCaption image captions.
This is actually a bug for which there is a patch submitted: http://joomlacode.org/gf/project/joo..._item_id=28511
The easiest thing to do would be to remove this code. You can do this by adding the following code to the template index.php file, before the html output:
Code PHP:if (isset($this->_script['text/javascript'])){ $this->_script['text/javascript'] = preg_replace('%window\.addEvent\(\'load\',\s*function\(\)\s*{\s*new\s*JCaption\(\'img.caption\'\);\s*}\);\s*%', '', $this->_script['text/javascript']); if (empty($this->_script['text/javascript'])) unset($this->_script['text/javascript']); }
This should fix the first issue.
Please let me know when you have done that.
How well do you know your JavaScript from your jQuery?
Check out SitePoint's latest JavaScript challenge
My blog






Hi Pullo
Thanks again!
Do you mean index.php in the root?
http://pastebin.com/Yk0sUJBZ
I'm not sure whereabouts that code needs to go

Hi,
I think index.php in the root is correct, but I'm not a Joomla user, so I'm working this out as I go.
Nonetheless, let's give it a try.
Insert the code I gave you into this file at line 52, just before the HTML output, like this:
Code PHP:// NEW CODE BEGIN// if (isset($this->_script['text/javascript'])){ $this->_script['text/javascript'] = preg_replace('%window\.addEvent\(\'load\',\s*function\(\)\s*{\s*new\s*JCaption\(\'img.caption\'\);\s*}\);\s*%', '', $this->_script['text/javascript']); if (empty($this->_script['text/javascript'])) unset($this->_script['text/javascript']); } // NEW CODE END// // Return the response. echo $app;
Please let me know when you have done that.
How well do you know your JavaScript from your jQuery?
Check out SitePoint's latest JavaScript challenge
My blog


HI Pullo,
Thanks again
I get the error, when I make that change:
500 - Internal server error.
There is a problem with the resource you are looking for, and it cannot be displayed.
http://pastebin.com/qmvt6i8y

Oh dear!
Which version of Joomla! are you using?
Also, you seem to have a plugin installed called "jch_optimize"
Could you disable that (temporarily)?
It seems to be minifying the majority of your JS into one huge chunk and that is making the debugging process more difficult.
How well do you know your JavaScript from your jQuery?
Check out SitePoint's latest JavaScript challenge
My blog


PHP Built On Windows NT CP5-14537 6.1 build 7600 (Windows Server 2008 R2 Standard Edition) i586
Thanks again!
I've looked in components and can't an extension of that name
Version info below
Database Version 5.5.24
Database Collation utf8_general_ci
PHP Version 5.3.13
Web Server Microsoft-IIS/7.5
WebServer to PHP Interface cgi-fcgi
Joomla! Version Joomla! 2.5.6 Stable [ Ember ] 19-June-2012 14:00 GMT
Joomla! Platform Version Joomla Platform 11.4.0 Stable [ Brian Kernighan ] 03-Jan-2012 00:00 GMT

Hi,
What plugins do you have installed, then?
It would be a whole lot easier to debug this if we could disable the minification.
How well do you know your JavaScript from your jQuery?
Check out SitePoint's latest JavaScript challenge
My blog


Hi Pullo,
I have found the plugin and disabled it :-)


Tested it in IE 7.0.5, and it seems to work now!
Disabling the plugin must of fixed it :-)

Hi there mattastic,
Yup, I can confirm that the error has disappeared from FireFox, Chrome, Opera (all latest), as well as IE 7 - IE10.
If you look at the source code of the page (e.g. with Ctrl + U in Chrome or Firefox), you can see that all of the scripts are being included in the correct order.
Whatever that plugin was doing, it was lumping the JavaScript together like that which was causing the error.
That's not to say that minifying or caching your site's pages is a bad idea, quite the contrary.
There seem to be a number of other plugins that offer this service. Maybea different one works better for you:
https://www.google.co.uk/search?q=caching+plugin+joomla
https://www.google.co.uk/search?q=minify+joomla
Anyway, all's well that ends well.
Can we consider this particular problem solved?
How well do you know your JavaScript from your jQuery?
Check out SitePoint's latest JavaScript challenge
My blog
Bookmarks