Posted by imbalanced on September 28, 2009 at 3:38pm
| Project: | Thickbox |
| Version: | 5.x-1.x-dev |
| Component: | User interface |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Issue Summary
This is from another issue which is now closed, but I'm getting the same thing. On the top-right corner is shown: Close,Close or Esc Key,or Esc Key. (Two times Close and 2x Esc key). Is there any way to fix this, even if it's a short term hack?
I'm currently using Thickbox 6.x-1.5 and Splash 6.x-2.5.
Comments
#1
I would like to add that I think it's probably a jQuery conflict. I'm currently using Lightbox2 for the entire website, including a photo gallery section. The only reason I'm using Thickbox at all is because it's the only one supported by Splash.
So yeah, currently I use Thickbox ONLY for the Splash implementation.
EDIT: The conflict isn't Lightbox2. I completely removed it from Drupal but Thickbox was still displaying the doubletext. The search continues!
#2
i second that where to remove?
#3
Found the problem and fixed it. I'll have a release up later today.
#4
Pardon making this active again, but I think you forgot to release this particular fix, (either in a full release or even a dev release) and I wanted a quick reminder it was still a problem : )
#5
It seems as though this behavior is caused by the function _thickbox_doheader in the .module being called multiple times.
I didn't have time to sort out why it would need to call the header more than once... but it was pretty apparent that the header was checking to see if it had already been added with this line:
if ($already_added) { return; }Unfortunately, it doesn't seem like this var is being set to true at any point.
So I changed
STATIC $already_added = FALSE;to
global $already_added;and then made sure to set
$already_added = TRUE;at the very last line of the function.
Again, this may not be the correct fix for this... but if you have a 4pm deadline, and you need this functionality, it works :D
#6
I've got this issue as well. I'll try the quick fix above and let you know how it goes.
#7
Hmmm... maybe I'm missing something. I opened splash.module, and while I could find _thickbox_doheader, I could not see $already_added anywhere. Is is possible to get line numbers for the above fix? Thanks!
#8
the suggested changes in #5 have to be made in thickbox.module. the fix works for me as well. however, an official fix would be appreciated.
thanks!
#9
Another Hack:
I just killed it with an addition to my theme CSS file until it get's ironed out.
I hid the duplicate text.
#TB_closeAjaxWindow {visibility: hidden;}Then added background text to say what I wanted it to say.
#TB_title background: #e8e8e8 url(/sites/default/files/escape-close.gif) no-repeat right;}The background image says "Escape to Close."
#10
I've changed
if ($already_added) {return; // Don't add the JavaScript and CSS multiple times.
}
to
if ($already_added) {return; // Don't add the JavaScript and CSS multiple times.
}
else
{
$already_added = TRUE;
}
in the thickbox.module file. It seems to be no duplicates after that.
#11
I just added the change in the previous comment and it worked for me. (#10) #5 did not work.
#12
Just confirming #10 worked.
Thank you!
#13
I can confirm this issue, although with the latest edition of thickbox these fixes do not seem to resolve this problem.
Any suggestions?
#14
#5 worked also. Two steps:
1. Modify thickbox/thickbox.module file
<?php96 function _thickbox_doheader() {
97 global $user;
98 /* static $already_added = FALSE; */
99 global $already_added;
100 if ($already_added) {
101 return; // Don't add the JavaScript and CSS multiple times.
102 }
103
104 if(_thickbox_active()) {
105 $path = drupal_get_path('module', 'thickbox');
106 drupal_add_css($path .'/thickbox.css');
107 if (variable_get('thickbox_ie_css', 0) != 1) {
108 drupal_add_css($path .'/thickbox_ie.css');
109 }
110
111 // Insert options and translated strings as javascript settings.
112 $js_settings = array(
113 'close' => t('Close'),
114 'next' => t('Next >'),
115 'prev' => t('< Prev'),
116 'esc_key' => t('or Esc Key'),
117 'next_close' => t('Next / Close on last'),
118 'image_count' => t('Image !current of !total')
119 );
120 drupal_add_js(array('thickbox' => $js_settings), 'setting');
121
122 if ($user->uid == 0 && variable_get('thickbox_login', 0)) {
123 drupal_add_js($path .'/thickbox_login.js');
124 }
125
126 if (variable_get('thickbox_auto', 0) && module_exists('image')) {
127 drupal_add_js(array('thickbox' => array('derivative' => variable_g et('thickbox_derivative', 'preview'))), 'setting');
128 drupal_add_js($path .'/thickbox_auto.js');
129 }
130
131 drupal_add_js($path .'/thickbox.js');
132 }
133 $already_added = TRUE;
134 }
?>
AND after: Performance -> Clear cached data.
#10 Worked also.
#15
Moving to thickbox as it appears this needs to be fixed there.
#16
Looks like the 6.x version may have fixed this but it persists in 5.x.