summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2013-03-22 19:21:51 +0100
committerAleksander Machniak <alec@alec.pl>2013-03-22 19:21:51 +0100
commitd227eda9cba8f120b49ab6b9d6d3b46651f8c6c2 (patch)
treeb2c21a3a8b6606602555b23558fa0b77f4e70424
parentf38d15c700303b3d63e7ad1b06a418986ac815f9 (diff)
Call resize handler in intervals to prevent lags and double onresize calls in Chrome (#1489005)
-rw-r--r--CHANGELOG1
-rw-r--r--skins/larry/ui.js46
2 files changed, 28 insertions, 19 deletions
diff --git a/CHANGELOG b/CHANGELOG
index bcbe2643e..04ec31d47 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,7 @@
CHANGELOG Roundcube Webmail
===========================
+- Call resize handler in intervals to prevent lags and double onresize calls in Chrome (#1489005)
- Fix javascript error in IE9 when loading form with placeholders into an iframe (#1489008)
- Fix handling of some conditional comment tags in HTML message (#1489004)
- Add rel="noreferrer" for links in displayed messages (#1484686)
diff --git a/skins/larry/ui.js b/skins/larry/ui.js
index b787dbb8d..58e03fbdc 100644
--- a/skins/larry/ui.js
+++ b/skins/larry/ui.js
@@ -287,28 +287,36 @@ function rcube_mail_ui()
/**
* Update UI on window resize
*/
- function resize()
+ function resize(e)
{
- if (rcmail.env.task == 'mail') {
- if (rcmail.env.action == 'show' || rcmail.env.action == 'preview')
- layout_messageview();
- else if (rcmail.env.action == 'compose')
- layout_composeview();
- }
+ // resize in intervals to prevent lags and double onresize calls in Chrome (#1489005)
+ var interval = e ? 10 : 0;
- // make iframe footer buttons float if scrolling is active
- $('body.iframe .footerleft').each(function(){
- var footer = $(this),
- body = $(document.body),
- floating = footer.hasClass('floating'),
- overflow = body.outerHeight(true) > $(window).height();
-
- if (overflow != floating) {
- var action = overflow ? 'addClass' : 'removeClass';
- footer[action]('floating');
- body[action]('floatingbuttons');
+ if (rcmail.resize_timeout)
+ window.clearTimeout(rcmail.resize_timeout);
+
+ rcmail.resize_timeout = window.setTimeout(function() {
+ if (rcmail.env.task == 'mail') {
+ if (rcmail.env.action == 'show' || rcmail.env.action == 'preview')
+ layout_messageview();
+ else if (rcmail.env.action == 'compose')
+ layout_composeview();
}
- });
+
+ // make iframe footer buttons float if scrolling is active
+ $('body.iframe .footerleft').each(function(){
+ var footer = $(this),
+ body = $(document.body),
+ floating = footer.hasClass('floating'),
+ overflow = body.outerHeight(true) > $(window).height();
+
+ if (overflow != floating) {
+ var action = overflow ? 'addClass' : 'removeClass';
+ footer[action]('floating');
+ body[action]('floatingbuttons');
+ }
+ });
+ }, interval);
}
/**