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,26 +94,29 @@ 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) {
$('#content').html(translatedTemplate); setTimeout(function() {
ajaxify.widgets.render(tpl_url, url, function() { $('#content').html(translatedTemplate);
if (typeof callback === 'function') { ajaxify.widgets.render(tpl_url, url, function() {
callback(); if (typeof callback === 'function') {
} callback();
}
app.processPage(); app.processPage();
$('#content, #footer').removeClass('ajaxifying'); $('#content, #footer').removeClass('ajaxifying');
ajaxify.initialLoad = false; ajaxify.initialLoad = false;
app.refreshTitle(url); app.refreshTitle(url);
$(window).trigger('action:ajaxify.end', {url: url}); $(window).trigger('action:ajaxify.end', {url: url});
}); });
ajaxify.variables.parse(); ajaxify.variables.parse();
$(window).trigger('action:ajaxify.contentLoaded', {url: url}); $(window).trigger('action:ajaxify.contentLoaded', {url: url});
ajaxify.loadScript(tpl_url);
}, ((new Date()).getTime() - startTime) - animationDuration * 100)
ajaxify.loadScript(tpl_url);
}); });
}); });
}); });
@ -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