Hi,
this feature just comes in handy to those people, who don't like to edit all the theme files. It uses Javascript (in fact jquery) to attach the ThickBox to every link that contains an image with the classes "image" and "thumbnail" (defaults uses by image.module for thumbs).
The link of the original link isn't changed, which has a pro and a con: the image nodes can still be opened in a new window/tab on doing a middle click, but therefor the image grouping functionality is not longer working. This could only be changed by "hacking" the ThickBox main javascript.
Heres the patch to the current cvs thickbox.module (sorry for inserting it directly, but it is just allowed to upload one file :/
<code>
--- thickbox.orig Mon Oct 02 19:02:59 2006
+++ thickbox.module Tue Oct 03 15:45:59 2006
@@ -23,13 +23,41 @@
*/
function thickbox_menu($may_cache) {
if (!$may_cache) {
- if (arg(0) == ('node' || 'blog') && arg(2) == '') {
+ if (variable_get('thickbox_auto', false) || variable_get('thickbox_load_all', false) || (arg(0) == ('node' || 'blog') && arg(2) == '')) {
$path = drupal_get_path('module', 'thickbox');
drupal_set_html_head(theme_stylesheet_import(base_path() . $path .'/thickbox.css'));
drupal_add_js($path . '/jquery.js');
drupal_add_js($path . '/thickbox.js');
+ if (variable_get('thickbox_auto', false)) {
+ drupal_add_js($path . '/thickbox_auto.js');
+ }
}
}
}
-?>
\ No newline at end of file
+function thickbox_settings() {
+ $form = array();
+ $form['thickbox_options'] = array(
+ '#type' => 'fieldset',
+ '#title' => t('Extended ThickBox Options')
+ );
+
+ $form['thickbox_options']['thickbox_auto'] = array(
+ '#type' => 'checkbox',
+ '#title' => t('Enable for Image Nodes'),
+ '#description' => t('Checking this box will enable automatic URL formatting for Image Nodes. (Overwrites ThickBox loading behavior on all pages to true.)'),
+ '#default_value' => variable_get('thickbox_auto', false),
+ '#return_value' => true
+ );
+
+ $form['thickbox_options']['thickbox_load_all'] = array(
+ '#type' => 'checkbox',
+ '#title' => t('Load ThickBox on every page.'),
+ '#description' => t('By default ThickBox loads only on "node/" and "blog/" pages. You can change this behavior to load on every page if required.'),
+ '#default_value' => variable_get('thickbox_load_all', false),
+ '#return_value' => true,
+ '#attributes' => variable_get('thickbox_auto', false) ? array('disabled' => 'disabled') : array()
+ );
+
+ return $form;
+}
\ No newline at end of file
| Comment | File | Size | Author |
|---|---|---|---|
| thickbox_auto.js.txt | 808 bytes | kleingeist |
Comments
Comment #1
frjo commentedThis look like a neat function, thanks! I dont use the image module myself but many other do. I will commit this when I have checked it does not break anything.
Comment #2
frjo commentedCommitted to head/cvs.
Comment #3
(not verified) commented