Download link:
JQThickBoxFrom the ThickBox homepage:
ThickBox is a webpage UI dialog widget written in JavaScript on top of the jQuery library. Its function is to show a single image, multiple images, inline content, iframed content, or content served through AJAX in a hybrid modal.
Now developers can integrate ThickBox functionality into their extensions quickly and easily, without having to worry about conflicting with other extensions using older/different versions of ThickBox.
I'm using
Klaus Hartl's ThickBox 2.1 variant currently, as it seems that little bit better than the *ahem* vanilla ThickBox 2.1.
JQuery extension needs to be installed and enabled first in order for this to work.
To do:
+ Convince extension authors to support this package!
Thank you to Johan Sundström for the
"#TB_window *" CSS trick that was preventing me from releasing this.
Comments
$("body").append("<div id='TB_load'><img src='loadingAnimation.gif' alt='Loading' /></div>");could be$("body").append("<div id='TB_load'><img src='extensions/JQThickBox/loadingAnimation.gif' alt='Loading' /></div>");and below the line 26 default.php
'termsofservice.php')))may be$Head->AddStylesheet('extensions/JQThickBox/thickbox.css');
$Head->AddString('
<!--[if lte IE 7]><link rel="stylesheet" href="thickbox.ie.css" type="text/css" media="screen" /><![endif]-->
');
$Head->AddScript('extensions/JQThickBox/thickbox.js');
'termsofservice.php'))){or get preview extenstion error.$Head->AddStylesheet('extensions/JQThickBox/thickbox.css');
$Head->AddString('
<!--[if lte IE 7]><link rel="stylesheet" href="thickbox.ie.css" type="text/css" media="screen" /><![endif]-->
');
$Head->AddScript('extensions/JQThickBox/thickbox.js');
}
$this->Context->Configuration['APPLICATION_PATH']
get_settings('siteurl')
You could echo each one to make sure you are getting what you need.
As I'm updating my Inline Images extension, I came accross your JQuery and JQThickBox extensions. I have the following remarks:
- You use the following code:
$Configuration["JQTHICKBOX_PATH"] = 'extensions/JQThickBox/';But it isn't used in your extension, so why add that Configuration parameter?
- You use the following code to add configuration settings:
AddConfigurationSetting($Context, 'JQTHICKBOX_VERSION_EXT', '1.0.0');But this code gets executed everytime your refresh your browser, which means it will write to the configuration file every page load. I suggest you add:
// Set the Extension and JavaScript version numbers.if( !array_key_exists('JQTHICKBOX_VERSION_EXT', $Configuration)) {
AddConfigurationSetting($Context, 'JQTHICKBOX_VERSION_EXT', '1.0.0');
AddConfigurationSetting($Context, 'JQTHICKBOX_VERSION_JS', '2.1');
}
- I've noticed the JQuery extension needs to be loaded BEFORE JQThickBox is loaded. Maybe you could mention that in your ReadMe's (if you haven't done already)
Other than that, these are fine extensions :) And they work flawlessly with my Inline Images extension :)
Is there a way for "JQPluginExtensions" to check to see if the JQuery extension is enabled and if not, not enable themselves and tell the admin? Perhaps even have them enable the JQuery extension if it is there and THEN enable themselves with a little message telling the admin that JQuery has been enabled?
Is there a way for extensions to check for other ones and then enable themselves and others in a specific order?
Edit: I misunderstood you as well :) I shall add that check.
// Set the Extension and JavaScript version numbers.if( !array_key_exists('JQTHICKBOX_VERSION_EXT', $Configuration)) {
AddConfigurationSetting($Context, 'JQTHICKBOX_VERSION_EXT', '1.0.1');
}
if( !array_key_exists('JQTHICKBOX_VERSION_JS', $Configuration)) {
AddConfigurationSetting($Context, 'JQTHICKBOX_VERSION_JS', '2.1');
}
And if there's an older version in, such as JQTHICKBOX_VERSION_EXT 1.0.0, will it update it to the newer value, in this case 1.0.1?
$Head->AddString('<!--[if lte IE 7]><link rel="stylesheet" href="'.$Context->Configuration['APPLICATION_PATH'].$Context->Configuration['JQTHICKBOX_PATH'].'thickbox.ie.css" type="text/css" media="screen" /><![endif]-->
');
But that gives me:
<!--[if lte IE 7]><link rel="stylesheet" href="/home/exhibitq/public_html/treasurytoday/extensions/JQThickBox/thickbox.ie.css" type="text/css" media="screen" /><![endif]-->Instead of what I want, which is a nice neat:
<!--[if lte IE 7]><link rel="stylesheet" href="/extensions/JQThickBox/thickbox.ie.css" type="text/css" media="screen" /><![endif]-->Is there another variable (is that what they're called?) that will give me the result I want?
P.S. Jazzman, I'm using that Configuration dooberry now ;)
JQThickBox 1.0.1 released!
Is it possible to do a check to see...
if the value first exists,
if it doesn't, create it
and if it does,
check to see if it is different,
and if so, overwrite it.
This way if you put an older version of the extension back in, it will update the version info to the correct value.
Do you have SmoothPageJump installed? Can I see the forum where you're getting this problem?
edit: wala! After adding the InlineImages 1.3 and activating thickbox setting, all is well. So, for dummies like me, there should be a message that tells me I need Attachments2.1, InlineImages1.3, jQuery, and jqThickbox for this to work.
edit part deux: Oh well, no success on my live site. All worked well on my local forum, but when I did everything live, the image opens in a new browsed window. And I still have the js error.
edit part3: I looked at the error again (which I see in FF using FireBug) and it is from the thickbox.js in JQThickBox.
Edit: I just downloaded a brand new copy of JQThickBox from the add-ons site and did a file compare with the thickbox.js on your site and they're identical, so it must be conflicting with something, because that exact same file works perfectly for me.
or could it be a conflict with Attachments which also has thickbox and jquery?
InlineImages does NOT have jQuery and ThickBox.
InlineImages DOES use the JQuery and JQThickBox extensions IF you enable the option.
Regarding the jquery.js file being one long line, that is because I'm using the packed version - this is recommended by the jQuery people. Do not worry about this.
I've finally done what I should have in the first place, and that's check to see if you have the crrect version of jquery.js. It appears that this file isn't where it should be as when I go to http://www.jwurster.us/Vanilla.1/extensions/JQuery/jquery.js I get a 404 error. I suggest you solve this problem first as that is almost certainly why you are getting that JS error and the JQThickBox extension is not working as expected.
Still, it's nice to see that things degrade gracefully with the InlineImages extension when jQuery isn't there :)
You will see the jquery.js file if you use "jQuery" as the folder name. Should it be "JQuery"?
These were form the 1.4.1 installation as they were integrated into those IIRC. They shouldn't have been interfering with anything, but it's better to get rid of them.
Yes, the folder name should be "JQuery". I believe the lack of capitalisation is what may be creating the issue here.
Edit: Once I edited the extensions.php file to change the folder name, everything worked fine. See what a single character can do to you.