don't ajaxify in until animation is completed; reduced minimum wait duration for preloader

v1.18.x
psychobunny 11 years ago
parent 9aeab08109
commit 2851a9a96b

@ -81,6 +81,8 @@ var ajaxify = ajaxify || {};
translator.load(tpl_url); translator.load(tpl_url);
$('#footer, #content').removeClass('hide').addClass('ajaxifying'); $('#footer, #content').removeClass('hide').addClass('ajaxifying');
var animationDuration = parseFloat($('#content').css('transition-duration')) || 0.2,
startTime = (new Date()).getTime();
ajaxify.variables.flush(); ajaxify.variables.flush();
ajaxify.loadData(url, function(err, data) { ajaxify.loadData(url, function(err, data) {
@ -92,6 +94,7 @@ var ajaxify = ajaxify || {};
templates.parse(tpl_url, data, function(template) { templates.parse(tpl_url, data, function(template) {
translator.translate(template, function(translatedTemplate) { translator.translate(template, function(translatedTemplate) {
setTimeout(function() {
$('#content').html(translatedTemplate); $('#content').html(translatedTemplate);
ajaxify.widgets.render(tpl_url, url, function() { ajaxify.widgets.render(tpl_url, url, function() {
if (typeof callback === 'function') { if (typeof callback === 'function') {
@ -112,6 +115,8 @@ var ajaxify = ajaxify || {};
$(window).trigger('action:ajaxify.contentLoaded', {url: url}); $(window).trigger('action:ajaxify.contentLoaded', {url: url});
ajaxify.loadScript(tpl_url); ajaxify.loadScript(tpl_url);
}, ((new Date()).getTime() - startTime) - animationDuration * 100)
}); });
}); });
}); });
@ -194,7 +199,7 @@ var ajaxify = ajaxify || {};
setTimeout(function() { setTimeout(function() {
callback(null, ajaxify.preloader[url].data); callback(null, ajaxify.preloader[url].data);
ajaxify.preloader[url] = null; ajaxify.preloader[url] = null;
}, 100); }, 50);
return; return;
} }

Loading…
Cancel
Save