From 9fed61aae15b4eecfe10482b6cb0f93e96cd7de2 Mon Sep 17 00:00:00 2001 From: Dan Helfman Date: Thu, 31 Jul 2008 15:50:25 -0700 Subject: [PATCH] Skipping clearing of messages/errors if they haven't been open long enough to read. --- NEWS | 4 ++++ static/js/Wiki.js | 25 ++++++++++++++++++------- 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/NEWS b/NEWS index 39ade1d..a79c4c0 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,7 @@ +1.4.22: + * Skipping clearing of messages/errors if they haven't been open long enough + to read. + 1.4.21: July 30, 2008: * Fixed bug in IE 7 in which there was too much horizontal spacing at very wide resolutions. diff --git a/static/js/Wiki.js b/static/js/Wiki.js index cc33fd3..f7607be 100644 --- a/static/js/Wiki.js +++ b/static/js/Wiki.js @@ -2257,6 +2257,7 @@ Wiki.prototype.display_message = function ( text, nodes, position_after ) { var div = DIV( { "class": "message" }, inner_div ); div.nodes = nodes; + div.init_time = new Date(); if ( position_after ) insertSiblingNodesAfter( position_after, div ) @@ -2297,6 +2298,7 @@ Wiki.prototype.display_error = function ( text, nodes, position_after ) { var div = DIV( { "class": "error" }, inner_div ); div.nodes = nodes; + div.init_time = new Date(); if ( position_after ) insertSiblingNodesAfter( position_after, div ) @@ -2323,6 +2325,11 @@ Wiki.prototype.clear_messages = function () { for ( var i in results ) { var result = results[ i ]; + + // only close the message if it's been open at least a quarter second + if ( new Date() - result.init_time < 250 ) + continue + blindUp( result, options = { "duration": 0.25, afterFinish: function () { try { for ( var j in result.nodes ) @@ -2336,6 +2343,10 @@ Wiki.prototype.clear_messages = function () { for ( var i in results ) { var result = results[ i ]; + + if ( new Date() - result.init_time < 250 ) + continue + blindUp( result, options = { "duration": 0.25, afterFinish: function () { try { removeElement( result ); @@ -2350,14 +2361,14 @@ Wiki.prototype.clear_pulldowns = function ( ephemeral_only ) { for ( var i in results ) { var result = results[ i ]; - // close the pulldown if it's been open at least a quarter second - if ( new Date() - result.pulldown.init_time >= 250 ) { - if ( ephemeral_only && !result.pulldown.ephemeral ) - continue; + // only close the pulldown if it's been open at least a quarter second + if ( new Date() - result.pulldown.init_time < 250 ) + continue + if ( ephemeral_only && !result.pulldown.ephemeral ) + continue; - result.pulldown.shutdown(); - result.pulldown = null; - } + result.pulldown.shutdown(); + result.pulldown = null; } }