You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by hl...@apache.org on 2009/03/03 19:10:10 UTC

svn commit: r749673 - in /tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5: corelib/components/exceptiondisplay.js dark-ajax-loader.gif default.css dialog-background.gif tapestry.js

Author: hlship
Date: Tue Mar  3 18:10:10 2009
New Revision: 749673

URL: http://svn.apache.org/viewvc?rev=749673&view=rev
Log:
TAP5-544: Improve JavaScript handling to prevent the user from clicking Ajax-oriented links and forms before the page is "ready"

Added:
    tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/dialog-background.gif   (with props)
Removed:
    tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/dark-ajax-loader.gif
Modified:
    tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/components/exceptiondisplay.js
    tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/default.css
    tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/tapestry.js

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/components/exceptiondisplay.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/components/exceptiondisplay.js?rev=749673&r1=749672&r2=749673&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/components/exceptiondisplay.js (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/components/exceptiondisplay.js Tue Mar  3 18:10:10 2009
@@ -16,7 +16,7 @@
 {
     var checkbox = $(id);
 
-    checkbox.observe("change", function()
+    checkbox.observe("click", function()
     {
         var newDisplay = checkbox.checked ? "none" : "list-item";
 

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/default.css
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/default.css?rev=749673&r1=749672&r2=749673&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/default.css (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/default.css Tue Mar  3 18:10:10 2009
@@ -480,18 +480,22 @@
 
 DIV.t-dialog-overlay {
     position: absolute;
-    top: 0;
-    left: 0;
+    top: 0px;
+    left: 0px;
     z-index: 90;
     width: 100%;
-    background: black;
+    background: transparent url("dialog-background.gif");
 }
 
 DIV.t-page-loading-banner {
-    float: left;
+    position: absolute;
+    top: 5px;
+    left: 5px;
     width: auto;
     font-weight: bold;
-    padding-right: 20px;
-    color: white;
-    background: transparent url(dark-ajax-loader.gif) no-repeat right top;
+    padding: 2px 4px 2px 24px;
+    color: black;
+    background: white url(ajax-loader.gif) no-repeat 4px center;
+    border-right: 2px solid black;
+    border-bottom: 2px solid black;
 }
\ No newline at end of file

Added: tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/dialog-background.gif
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/dialog-background.gif?rev=749673&view=auto
==============================================================================
Binary file - no diff available.

Propchange: tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/dialog-background.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/tapestry.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/tapestry.js?rev=749673&r1=749672&r2=749673&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/tapestry.js (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/tapestry.js Tue Mar  3 18:10:10 2009
@@ -59,9 +59,11 @@
     {
         if (Tapestry.pageLoaded) return;
 
-        // TODO: Figure out how to make this work in IE!
 
-        event.preventDefault();
+        event = event || window.event;
+        Event.extend(event);
+
+        event.stop();
 
         var body = $$("BODY").first();
 
@@ -77,9 +79,7 @@
 
         body.insert({ top: overlay });
 
-        // Fade it in to 30% opacity
-
-        new Effect.Appear(overlay, {duration: 0.2, from: 0.0, to: 0.3});
+        new Effect.Appear(overlay, {duration: 0.2});
 
         var messageDiv = new Element("div", { 'class' : 't-page-loading-banner' }).update(Tapestry.Messages.pageIsLoading);
         overlay.insert({ top: messageDiv });
@@ -94,6 +94,11 @@
         };
 
         document.observe("dom:loaded", hideDialog);
+
+        // An rare race condition.
+
+        if (Tapestry.pageLoaded)
+            hideDialog.call(null);
     },