You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lo...@apache.org on 2013/04/19 11:00:36 UTC
svn commit: r1469749 -
/myfaces/tobago/branches/tobago-1.5.x/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js
Author: lofwyr
Date: Fri Apr 19 09:00:36 2013
New Revision: 1469749
URL: http://svn.apache.org/r1469749
Log:
TOBAGO-1250: Wait-Animation while submit doesn't work on some browsers
- fixed for IE, FF and Chrome
- a new issue TOBAGO-1253 was created for Safari
Modified:
myfaces/tobago/branches/tobago-1.5.x/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js
Modified: myfaces/tobago/branches/tobago-1.5.x/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.5.x/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js?rev=1469749&r1=1469748&r2=1469749&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-1.5.x/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js (original)
+++ myfaces/tobago/branches/tobago-1.5.x/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js Fri Apr 19 09:00:36 2013
@@ -395,7 +395,7 @@ var Tobago = {
onBeforeUnload: function() {
if (Tobago.transition) {
- Tobago.createOverlay(jQuery("body"));
+ Tobago.createOverlay(jQuery("body"), false, false);
}
Tobago.transition = Tobago.oldTransition;
},
@@ -404,7 +404,7 @@ var Tobago = {
* Create a overlay barrier and animate it.
* @param element A jQuery element, must be only one single element.
*/
- createOverlay:function (element, error) {
+ createOverlay:function (element, error, ajax) {
// is not a jQuery object? XXX Support of non jQuery objects is deprecated since Tobago 1.5.1
if (element == null || typeof element.size != "function") {
@@ -430,16 +430,22 @@ var Tobago = {
Tobago.ie6bugfix(element.get(0));
- element.append("<div class='tobago-page-overlay tobago-page-overlay-markup-"
- + (error ? "error" : "wait")
- + "'><div class='tobago-page-overlayCenter'><img></div></div>");
+ element.append(
+ "<div class='tobago-page-overlay tobago-page-overlay-markup-" + (error ? "error" : "wait") + "'>"
+ + "<div class='tobago-page-overlayCenter'>"
+ + "</div>"
+ + "</div>");
var wait = element.find(".tobago-page-overlayCenter");
- var image = wait.children("img");
- var src = error
- ? jQuery("body > .tobago-page-overlayErrorPreloadedImage").attr("src")
- : jQuery("body > .tobago-page-overlayWaitPreloadedImage").attr("src");
- image.attr("src", src);
+ var image = jQuery(error
+ ? "body > .tobago-page-overlayErrorPreloadedImage"
+ : "body > .tobago-page-overlayWaitPreloadedImage");
+ // in case of AJAX, we may need more of these objects, on the other side, on an normal submit
+ // the animation stops, if we use the clone (don't know why, seems to be needed only in WebKit)
+ if (ajax) {
+ image = image.clone();
+ }
+ image.appendTo(wait).removeClass("tobago-page-overlayWaitPreloadedImage");
wait.show();
if (jQuery.browser.msie && parseInt(jQuery.browser.version) <= 6) {
@@ -646,6 +652,11 @@ var Tobago = {
try {
// LOG.debug("submit form with action: " + Tobago.action.value);
Tobago.form.submit();
+ if (jQuery.browser.msie) {
+ // without this "redundant" code the animation will not be animated in IE
+ var image = jQuery(".tobago-page-overlayCenter img");
+ image.appendTo(image.parent());
+ }
} catch (e) {
Tobago.deleteOverlay(jQuery("body"));
Tobago.isSubmit = false;
@@ -1764,7 +1775,7 @@ Tobago.Panel.prototype.reloadWithAction
};
Tobago.Panel.prototype.prepareReload = function() {
- Tobago.createOverlay(jQuery(Tobago.Utils.escapeClientId(this.id)));
+ Tobago.createOverlay(jQuery(Tobago.Utils.escapeClientId(this.id)), false, true);
};
Tobago.registerListener(Tobago.Panel.init, Tobago.Phase.DOCUMENT_READY);
@@ -2117,9 +2128,9 @@ Tobago.Updater = {
if (container && typeof container.prepareReload == 'function') {
container.prepareReload();
} else if (container) {
- Tobago.createOverlay(container);
+ Tobago.createOverlay(container, false, true);
} else {
- Tobago.createOverlay(jQuery(Tobago.Utils.escapeClientId(id)));
+ Tobago.createOverlay(jQuery(Tobago.Utils.escapeClientId(id)), false, true);
}
}
}
@@ -2344,7 +2355,7 @@ Tobago.Updater = {
// XXX Here also a double click will be logged, but "warn" is not appropriate.
LOG.warn("ERROR 500 when updating component id = '" + data.ajaxId + "'"); // @DEV_ONLY
Tobago.deleteOverlay(overlay);
- Tobago.createOverlay(overlay, true); // error overlay
+ Tobago.createOverlay(overlay, true, true); // error overlay
break;
default:
LOG.error('Unknown response code: ' + data.responseCode + " for component id = '" + data.ajaxId + "'"); // @DEV_ONLY