[ticket/11928] Replace AJAX loading popup with animation.

PHPBB3-11928
This commit is contained in:
Cesar G 2013-10-15 21:37:53 -07:00
parent 2f1cf0d287
commit da4e0c4219
8 changed files with 55 additions and 15 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

View file

@ -1593,6 +1593,20 @@ input.button1:focus, input.button2:focus, input.button3:focus {
} }
} }
#loading_indicator {
background: #000000 url("../images/loading.gif") center center no-repeat;
border-radius: 5px;
display: none;
opacity: 0.8;
margin-top: -50px;
margin-left: -50px;
height: 50px;
width: 50px;
position: fixed;
left: 50%;
top: 50%;
}
/* Pagination /* Pagination
---------------------------------------- */ ---------------------------------------- */
.pagination { .pagination {

View file

@ -17,8 +17,8 @@
<div id="darkenwrapper" data-ajax-error-title="{L_AJAX_ERROR_TITLE}" data-ajax-error-text="{L_AJAX_ERROR_TEXT}" data-ajax-error-text-abort="{L_AJAX_ERROR_TEXT_ABORT}" data-ajax-error-text-timeout="{L_AJAX_ERROR_TEXT_TIMEOUT}" data-ajax-error-text-parsererror="{L_AJAX_ERROR_TEXT_PARSERERROR}"> <div id="darkenwrapper" data-ajax-error-title="{L_AJAX_ERROR_TITLE}" data-ajax-error-text="{L_AJAX_ERROR_TEXT}" data-ajax-error-text-abort="{L_AJAX_ERROR_TEXT_ABORT}" data-ajax-error-text-timeout="{L_AJAX_ERROR_TEXT_TIMEOUT}" data-ajax-error-text-parsererror="{L_AJAX_ERROR_TEXT_PARSERERROR}">
<div id="darken">&nbsp;</div> <div id="darken">&nbsp;</div>
<div class="jalert" id="loadingalert"><h3>{L_LOADING}</h3><p>{L_PLEASE_WAIT}</p></div>
</div> </div>
<div id="loading_indicator"></div>
<div id="phpbb_alert" class="phpbb_alert" data-l-err="{L_ERROR}" data-l-timeout-processing-req="{L_TIMEOUT_PROCESSING_REQ}"> <div id="phpbb_alert" class="phpbb_alert" data-l-err="{L_ERROR}" data-l-timeout-processing-req="{L_TIMEOUT_PROCESSING_REQ}">
<a href="#" class="alert_close"></a> <a href="#" class="alert_close"></a>

View file

@ -12,7 +12,7 @@ var keymap = {
}; };
var dark = $('#darkenwrapper'); var dark = $('#darkenwrapper');
var loadingAlert = $('#loadingalert'); var loadingAlert = $('#loading_indicator');
var phpbbAlertTimer = null; var phpbbAlertTimer = null;
@ -22,18 +22,14 @@ var phpbbAlertTimer = null;
* @returns object Returns loadingAlert. * @returns object Returns loadingAlert.
*/ */
phpbb.loadingAlert = function() { phpbb.loadingAlert = function() {
if (dark.is(':visible')) { if (!loadingAlert.is(':visible')) {
loadingAlert.fadeIn(phpbb.alertTime); loadingAlert.fadeIn(phpbb.alertTime);
} else { // Wait fifteen seconds and display an error if nothing has been returned by then.
loadingAlert.show(); phpbbAlertTimer = setTimeout(function() {
dark.fadeIn(phpbb.alertTime, function() { if (loadingAlert.is(':visible')) {
// Wait fifteen seconds and display an error if nothing has been returned by then. phpbb.alert($('#phpbb_alert').attr('data-l-err'), $('#phpbb_alert').attr('data-l-timeout-processing-req'));
phpbbAlertTimer = setTimeout(function() { }
if (loadingAlert.is(':visible')) { }, 15000);
phpbb.alert($('#phpbb_alert').attr('data-l-err'), $('#phpbb_alert').attr('data-l-timeout-processing-req'));
}
}, 15000);
});
} }
return loadingAlert; return loadingAlert;
@ -66,6 +62,10 @@ phpbb.alert = function(title, msg, fadedark) {
div.find('.alert_title').html(title); div.find('.alert_title').html(title);
div.find('.alert_text').html(msg); div.find('.alert_text').html(msg);
if (!dark.is(':visible')) {
dark.fadeIn(phpbb.alertTime);
}
div.bind('click', function(e) { div.bind('click', function(e) {
e.stopPropagation(); e.stopPropagation();
}); });
@ -131,6 +131,10 @@ phpbb.confirm = function(msg, callback, fadedark) {
var div = $('#phpbb_confirm'); var div = $('#phpbb_confirm');
div.find('.alert_text').html(msg); div.find('.alert_text').html(msg);
if (!dark.is(':visible')) {
dark.fadeIn(phpbb.alertTime);
}
div.bind('click', function(e) { div.bind('click', function(e) {
e.stopPropagation(); e.stopPropagation();
}); });
@ -372,13 +376,16 @@ phpbb.ajaxify = function(options) {
phpbb.loadingAlert(); phpbb.loadingAlert();
} }
$.ajax({ var request = $.ajax({
url: action, url: action,
type: method, type: method,
data: data, data: data,
success: returnHandler, success: returnHandler,
error: errorHandler error: errorHandler
}); });
request.always(function() {
loadingAlert.fadeOut(phpbb.alertTime);
});
event.preventDefault(); event.preventDefault();
}); });

View file

@ -34,8 +34,8 @@
<div id="darkenwrapper" data-ajax-error-title="{L_AJAX_ERROR_TITLE}" data-ajax-error-text="{L_AJAX_ERROR_TEXT}" data-ajax-error-text-abort="{L_AJAX_ERROR_TEXT_ABORT}" data-ajax-error-text-timeout="{L_AJAX_ERROR_TEXT_TIMEOUT}" data-ajax-error-text-parsererror="{L_AJAX_ERROR_TEXT_PARSERERROR}"> <div id="darkenwrapper" data-ajax-error-title="{L_AJAX_ERROR_TITLE}" data-ajax-error-text="{L_AJAX_ERROR_TEXT}" data-ajax-error-text-abort="{L_AJAX_ERROR_TEXT_ABORT}" data-ajax-error-text-timeout="{L_AJAX_ERROR_TEXT_TIMEOUT}" data-ajax-error-text-parsererror="{L_AJAX_ERROR_TEXT_PARSERERROR}">
<div id="darken">&nbsp;</div> <div id="darken">&nbsp;</div>
<div class="phpbb_alert" id="loadingalert"><h3>{L_LOADING}</h3><p>{L_PLEASE_WAIT}</p></div>
</div> </div>
<div id="loading_indicator"></div>
<div id="phpbb_alert" class="phpbb_alert" data-l-err="{L_ERROR}" data-l-timeout-processing-req="{L_TIMEOUT_PROCESSING_REQ}"> <div id="phpbb_alert" class="phpbb_alert" data-l-err="{L_ERROR}" data-l-timeout-processing-req="{L_TIMEOUT_PROCESSING_REQ}">
<a href="#" class="alert_close"></a> <a href="#" class="alert_close"></a>

View file

@ -1104,6 +1104,11 @@ input.disabled {
background-color: #000000; background-color: #000000;
} }
#loading_indicator {
background-color: #000000;
background-image: url("./images/loading.gif");
}
#notification_list ul li { #notification_list ul li {
border-bottom-color: #B9B9B9; border-bottom-color: #B9B9B9;
} }

View file

@ -821,6 +821,20 @@ li.pagination ul {
opacity: 0.5; opacity: 0.5;
} }
#loading_indicator {
background: center center no-repeat;
border-radius: 5px;
display: none;
opacity: 0.8;
margin-top: -50px;
margin-left: -50px;
height: 50px;
width: 50px;
position: fixed;
left: 50%;
top: 50%;
}
/* Miscellaneous styles /* Miscellaneous styles
---------------------------------------- */ ---------------------------------------- */
#forum-permissions { #forum-permissions {

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB