Commit 7e7181a4 authored by webchick's avatar webchick

#615130 by casey, Kiphaas7, David_Rothstein, ksenzee, seutje, and meatsack:...

#615130 by casey, Kiphaas7, David_Rothstein, ksenzee, seutje, and meatsack: Dramatically improve performance of the Overlay module.
parent eae4c336
......@@ -99,43 +99,51 @@ Drupal.overlayChild.behaviors.scrollToTop = function (context, settings) {
* @see Drupal.overlay.isAdminLink()
*/
Drupal.overlayChild.behaviors.parseLinks = function (context, settings) {
$('a:not(.overlay-exclude)', context).once('overlay').each(function () {
// Non-admin links should close the overlay and open in the main window.
if (!parent.Drupal.overlay.isAdminLink(this.href)) {
$(this).click(function () {
// We need to store the parent variable locally because it will
// disappear as soon as we close the iframe.
var parentWindow = parent;
if (parentWindow.Drupal.overlay.close(false)) {
parentWindow.Drupal.overlay.redirect($(this).attr('href'));
}
return false;
});
var closeAndRedirectOnClick = function (event) {
// We need to store the parent variable locally because it will
// disappear as soon as we close the iframe.
var parentWindow = parent;
if (parentWindow.Drupal.overlay.close(false)) {
parentWindow.Drupal.overlay.redirect($(this).attr('href'));
}
return false;
};
var redirectOnClick = function (event) {
parent.Drupal.overlay.redirect($(this).attr('href'));
return false;
};
$('a:not(.overlay-exclude)', context).once('overlay', function () {
var href = $(this).attr('href');
// Skip links that don't have an href attribute.
if (href == undefined) {
return;
}
// Non-admin links should close the overlay and open in the main window.
else if (!parent.Drupal.overlay.isAdminLink(href)) {
$(this).click(closeAndRedirectOnClick);
}
// Open external links in a new window.
else if (href.indexOf('http') > 0 || href.indexOf('https') > 0) {
$(this).attr('target', '_new');
}
// Open admin links in the overlay.
else {
var href = $(this).attr('href');
if (href.indexOf('http') > 0 || href.indexOf('https') > 0) {
$(this).attr('target', '_new');
}
else {
$(this).each(function(){
this.href = parent.Drupal.overlay.fragmentizeLink(this);
}).click(function () {
parent.window.location.href = this.href;
return false;
});
}
$(this)
.attr('href', parent.Drupal.overlay.fragmentizeLink(this))
.click(redirectOnClick);
}
});
$('form:not(.overlay-processed)', context).addClass('overlay-processed').each(function () {
$('form', context).once('overlay', function () {
// Obtain the action attribute of the form.
var action = $(this).attr('action');
if (action.indexOf('http') != 0 && action.indexOf('https') != 0) {
// Keep internal forms in the overlay.
// Keep internal forms in the overlay.
if (action == undefined || (action.indexOf('http') != 0 && action.indexOf('https') != 0)) {
action += (action.indexOf('?') > -1 ? '&' : '?') + 'render=overlay';
$(this).attr('action', action);
}
// Submit external forms into a new window.
else {
$(this).attr('target', '_new');
}
......
......@@ -10,11 +10,32 @@
background-image: none;
}
body.overlay-autofit {
overflow-y: scroll;
}
/**
* Overlay wrapper.
*/
#overlay-wrapper {
position: absolute;
top: 0;
left: 0;
width: 100%;
z-index: 501;
padding: 20px 0 15px 0;
}
/**
* jQuery UI Dialog classes.
*/
.overlay {
position: static;
padding-right: 26px;
margin: 0 auto;
width: 78%;
min-width: 700px;
min-height: 100px;
}
.overlay.ui-widget-content, .overlay .ui-widget-header {
......@@ -61,22 +82,22 @@
}
/**
* Overlay content and shadows.
* Overlay content.
*/
.overlay #overlay-container {
margin: 0;
padding: 0;
width: 100%;
overflow: visible;
background: #fff url(images/loading.gif) no-repeat 50% 50%;
-webkit-box-shadow: 8px 8px 8px rgba(0,0,0,.5);
-moz-box-shadow: 8px 8px 8px rgba(0,0,0,.5);
box-shadow: 8px 8px 8px rgba(0,0,0,.5);
}
.overlay-loaded #overlay-container {
background: none;
background: #fff;
}
.overlay #overlay-element {
overflow: hidden;
width: 100%;
height: 100%;
}
/**
......@@ -91,15 +112,17 @@
text-transform: uppercase;
}
.overlay .ui-dialog-titlebar ul li {
display: inline-block;
display: inline;
list-style: none;
margin: 0 0 0 -3px;
padding: 0;
}
.overlay .ui-dialog-titlebar ul li a,
.overlay .ui-dialog-titlebar ul li a:active,
.overlay .ui-dialog-titlebar ul li a:visited,
.overlay .ui-dialog-titlebar ul li a:hover {
display: inline-block;
background-color: #a6a7a2;
-moz-border-radius: 8px 8px 0 0;
-webkit-border-top-left-radius: 8px;
......@@ -107,16 +130,18 @@
border-radius: 8px 8px 0 0;
color: #000;
font-weight: bold;
padding: 5px 14px;
padding: 0 14px;
text-decoration: none;
font-size: 11px;
margin: 0 0 2px 0;
}
.overlay .ui-dialog-titlebar ul li.active a,
.overlay .ui-dialog-titlebar ul li.active a.active,
.overlay .ui-dialog-titlebar ul li.active a:active,
.overlay .ui-dialog-titlebar ul li.active a:visited {
background-color: #fff;
padding-bottom: 7px;
padding-bottom: 2px;
margin: 0;
}
.overlay .ui-dialog-titlebar ul li a:hover {
color: #fff;
......
This diff is collapsed.
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