Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I recently upgraded to 1.3 and received the following error: Cannot read property 'height' of undefined. Was led to the following code snippet:
Drupal.behaviors.JiraIssueCollector = {
attach: function(context, settings) {
// Use ajax() instead of getScript() as this allows cache to be enabled.
// This is preferable for performance reasons. The JIRA Issue Collector
// script should not change much.
if (typeof settings.jiraIssueCollector != 'undefined') {
jQuery.ajax({
url: settings.jiraIssueCollector.url,
type: "get",
dataType: "script",
cache: true,
success: function() {
// If we use a issue collector located at the top of the page
// ("Prominent" style) and show a toolbar, then the toolbar will be
// positioned over the issue collector button. Adjust the position so
// it shows below the toolbar.
// We cannot set attributes directly on the element as we do not know
// when it will be available.
// .atlwdg-TOP class ensures we affect only issue collectors with the
// prominent style.
$('<style>')
.attr("type", "text/css")
.html('body.toolbar .atlwdg-TOP { top: ' + <strong>Drupal.toolbar.height() + 'px; }')</strong>
.appendTo('head');
}
});
}
}
};
Reverted to the JS from 1.2 and the JIRA tab was no longer visible.
Comment | File | Size | Author |
---|---|---|---|
#4 | js_error_cannot_read-2653580-4.patch | 843 bytes | mdeltito |
Comments
Comment #2
adixb CreditAttribution: adixb commentedComment #3
adixb CreditAttribution: adixb as a volunteer commentedI commented out this section and the error was resolved:
Comment #4
mdeltito CreditAttribution: mdeltito at Phase2 commentedAttached patch checks if the Toolbar is enabled before attempting to apply styles to the collector widget.
Comment #5
LittleRedHen CreditAttribution: LittleRedHen commentedThe patch at #4 works for me. Thanks!
Comment #7
kasperg CreditAttribution: kasperg at Reload commentedI have committed the patch in #4. Thanks a bunch.