Commit 13f8a952 authored by Dries's avatar Dries
Browse files

- Patch #762348 by tstoeckler, BarisW, casey: update the document title using...

- Patch #762348 by tstoeckler, BarisW, casey: update the document title using jQuery while using the overlay window.
parent 03d7c314
...@@ -70,6 +70,8 @@ Drupal.overlay.open = function (url) { ...@@ -70,6 +70,8 @@ Drupal.overlay.open = function (url) {
return this.load(url); return this.load(url);
} }
this.isOpening = true; this.isOpening = true;
// Store the original document title.
this.originalTitle = document.title;
// Create the dialog and related DOM elements. // Create the dialog and related DOM elements.
this.create(); this.create();
...@@ -184,6 +186,8 @@ Drupal.overlay.close = function () { ...@@ -184,6 +186,8 @@ Drupal.overlay.close = function () {
this.isClosing = true; this.isClosing = true;
this.isOpen = false; this.isOpen = false;
$(document.documentElement).removeClass('overlay-open'); $(document.documentElement).removeClass('overlay-open');
// Restore the original document title.
document.title = this.originalTitle;
// Allow other scripts to respond to this event. // Allow other scripts to respond to this event.
$(document).trigger('drupalOverlayClose'); $(document).trigger('drupalOverlayClose');
...@@ -273,6 +277,9 @@ Drupal.overlay.loadChild = function (event) { ...@@ -273,6 +277,9 @@ Drupal.overlay.loadChild = function (event) {
if (this.isOpen && !this.isClosing) { if (this.isOpen && !this.isClosing) {
// And child document is an actual overlayChild. // And child document is an actual overlayChild.
if (iframeWindow.Drupal && iframeWindow.Drupal.overlayChild) { if (iframeWindow.Drupal && iframeWindow.Drupal.overlayChild) {
// Replace the document title with title of iframe.
document.title = iframeWindow.document.title;
this.activeFrame = $(iframe) this.activeFrame = $(iframe)
.addClass('overlay-active') .addClass('overlay-active')
// Add a title attribute to the iframe for accessibility. // Add a title attribute to the iframe for accessibility.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment