Révision 7e72b748
Ajouté par Assos Assos il y a plus de 6 ans
drupal7/sites/all/modules/ctools/js/modal.js | ||
---|---|---|
268 | 268 |
// We also have to check jQuery version to prevent |
269 | 269 |
// IE8 + jQuery 1.4.4 to break on other events |
270 | 270 |
// bound to the submit button. |
271 |
if (jQuery.fn.jquery === '1.4' && typeof event.bubbles === "undefined") { |
|
271 |
if (jQuery.fn.jquery.substr(0, 3) === '1.4' && typeof event.bubbles === "undefined") {
|
|
272 | 272 |
$(this.form).trigger('submit'); |
273 | 273 |
return false; |
274 | 274 |
} |
... | ... | |
302 | 302 |
|
303 | 303 |
// Attach behaviors within a modal dialog. |
304 | 304 |
var settings = response.settings || ajax.settings || Drupal.settings; |
305 |
Drupal.attachBehaviors('#modalContent', settings);
|
|
305 |
Drupal.attachBehaviors($('#modalContent'), settings);
|
|
306 | 306 |
|
307 | 307 |
if ($('#modal-content').hasClass('ctools-modal-loading')) { |
308 | 308 |
$('#modal-content').removeClass('ctools-modal-loading'); |
... | ... | |
554 | 554 |
|
555 | 555 |
// Create our content div, get the dimensions, and hide it |
556 | 556 |
var modalContent = $('#modalContent').css('top','-1000px'); |
557 |
var $modalHeader = modalContent.find('.modal-header'); |
|
557 | 558 |
var mdcTop = wt + ( winHeight / 2 ) - ( modalContent.outerHeight() / 2); |
558 | 559 |
var mdcLeft = ( winWidth / 2 ) - ( modalContent.outerWidth() / 2); |
559 | 560 |
$('#modalBackdrop').css(css).css('top', 0).css('height', docHeight + 'px').css('width', docWidth + 'px').show(); |
... | ... | |
561 | 562 |
|
562 | 563 |
// Bind a click for closing the modalContent |
563 | 564 |
modalContentClose = function(){close(); return false;}; |
564 |
$('.close').bind('click', modalContentClose); |
|
565 |
$('.close', $modalHeader).bind('click', modalContentClose);
|
|
565 | 566 |
|
566 | 567 |
// Bind a keypress on escape for closing the modalContent |
567 | 568 |
modalEventEscapeCloseHandler = function(event) { |
... | ... | |
577 | 578 |
// close button, but we should save the original focus to restore it after |
578 | 579 |
// the dialog is closed. |
579 | 580 |
var oldFocus = document.activeElement; |
580 |
$('.close').focus(); |
|
581 |
$('.close', $modalHeader).focus();
|
|
581 | 582 |
|
582 | 583 |
// Close the open modal content and backdrop |
583 | 584 |
function close() { |
... | ... | |
586 | 587 |
$('body').unbind( 'focus', modalEventHandler); |
587 | 588 |
$('body').unbind( 'keypress', modalEventHandler ); |
588 | 589 |
$('body').unbind( 'keydown', modalTabTrapHandler ); |
589 |
$('.close').unbind('click', modalContentClose); |
|
590 |
$('.close', $modalHeader).unbind('click', modalContentClose);
|
|
590 | 591 |
$('body').unbind('keypress', modalEventEscapeCloseHandler); |
591 | 592 |
$(document).trigger('CToolsDetachBehaviors', $('#modalContent')); |
592 | 593 |
|
... | ... | |
662 | 663 |
$('body').unbind('focus', modalEventHandler); |
663 | 664 |
$('body').unbind('keypress', modalEventHandler); |
664 | 665 |
$('body').unbind( 'keydown', modalTabTrapHandler ); |
665 |
$('.close').unbind('click', modalContentClose); |
|
666 |
var $modalContent = $('#modalContent'); |
|
667 |
var $modalHeader = $modalContent.find('.modal-header'); |
|
668 |
$('.close', $modalHeader).unbind('click', modalContentClose); |
|
666 | 669 |
$('body').unbind('keypress', modalEventEscapeCloseHandler); |
667 |
$(document).trigger('CToolsDetachBehaviors', $('#modalContent'));
|
|
670 |
$(document).trigger('CToolsDetachBehaviors', $modalContent);
|
|
668 | 671 |
|
669 | 672 |
// jQuery magic loop through the instances and run the animations or removal. |
670 | 673 |
content.each(function(){ |
Formats disponibles : Unified diff
Weekly update of contrib modules