Révision 2c8c2b87
Ajouté par Assos Assos il y a presque 9 ans
drupal7/sites/all/modules/jquery_update/replace/misc/1.9/overlay-parent.js | ||
---|---|---|
395 | 395 |
return re.test(url); |
396 | 396 |
}; |
397 | 397 |
|
398 |
/** |
|
399 |
* Constructs an internal URL (relative to this site) from the provided path. |
|
400 |
* |
|
401 |
* For example, if the provided path is 'admin' and the site is installed at |
|
402 |
* http://example.com/drupal, this function will return '/drupal/admin'. |
|
403 |
* |
|
404 |
* @param path |
|
405 |
* The internal path, without any leading slash. |
|
406 |
* |
|
407 |
* @return |
|
408 |
* The internal URL derived from the provided path, or null if a valid |
|
409 |
* internal path cannot be constructed (for example, if an attempt to create |
|
410 |
* an external link is detected). |
|
411 |
*/ |
|
412 |
Drupal.overlay.getInternalUrl = function (path) { |
|
413 |
var url = Drupal.settings.basePath + path; |
|
414 |
if (!this.isExternalLink(url)) { |
|
415 |
return url; |
|
416 |
} |
|
417 |
}; |
|
418 |
|
|
398 | 419 |
/** |
399 | 420 |
* Event handler: resizes overlay according to the size of the parent window. |
400 | 421 |
* |
... | ... | |
583 | 604 |
// If the link contains the overlay-restore class and the overlay-context |
584 | 605 |
// state is set, also update the parent window's location. |
585 | 606 |
var parentLocation = ($target.hasClass('overlay-restore') && typeof $.bbq.getState('overlay-context') == 'string') |
586 |
? Drupal.settings.basePath + $.bbq.getState('overlay-context')
|
|
607 |
? this.getInternalUrl($.bbq.getState('overlay-context'))
|
|
587 | 608 |
: null; |
588 | 609 |
href = this.fragmentizeLink($target.get(0), parentLocation); |
589 | 610 |
// Only override default behavior when left-clicking and user is not |
... | ... | |
663 | 684 |
} |
664 | 685 |
|
665 | 686 |
// Get the overlay URL from the current URL fragment. |
687 |
var internalUrl = null; |
|
666 | 688 |
var state = $.bbq.getState('overlay'); |
667 | 689 |
if (state) { |
690 |
internalUrl = this.getInternalUrl(state); |
|
691 |
} |
|
692 |
if (internalUrl) { |
|
668 | 693 |
// Append render variable, so the server side can choose the right |
669 | 694 |
// rendering and add child frame code to the page if needed. |
670 |
var url = $.param.querystring(Drupal.settings.basePath + state, { render: 'overlay' });
|
|
695 |
var url = $.param.querystring(internalUrl, { render: 'overlay' });
|
|
671 | 696 |
|
672 | 697 |
this.open(url); |
673 | 698 |
this.resetActiveClass(this.getPath(Drupal.settings.basePath + state)); |
Formats disponibles : Unified diff
Weekly update of contrib modules