fixed translator.load, it wasn't passing in language and was trying to
load undefined.json
v1.18.x
barisusakli 11 years ago
parent 093e373025
commit 8146358aac

@ -78,7 +78,7 @@ var ajaxify = ajaxify || {};
}, url, RELATIVE_PATH + '/' + url + hash); }, url, RELATIVE_PATH + '/' + url + hash);
} }
translator.load(tpl_url); translator.load(config.defaultLang, tpl_url);
$('#footer, #content').removeClass('hide').addClass('ajaxifying'); $('#footer, #content').removeClass('hide').addClass('ajaxifying');
var animationDuration = parseFloat($('#content').css('transition-duration')) || 0.2, var animationDuration = parseFloat($('#content').css('transition-duration')) || 0.2,
@ -196,10 +196,9 @@ var ajaxify = ajaxify || {};
$(window).trigger('action:ajaxify.loadingData', {url: url}); $(window).trigger('action:ajaxify.loadingData', {url: url});
if (ajaxify.preloader && ajaxify.preloader[url]) { if (ajaxify.preloader && ajaxify.preloader[url] && !ajaxify.preloader[url].loading) {
callback(null, ajaxify.preloader[url].data); callback(null, ajaxify.preloader[url].data);
ajaxify.preloader = {}; ajaxify.preloader = {};
return; return;
} }
@ -312,13 +311,16 @@ var ajaxify = ajaxify || {};
var url = this.href.replace(rootUrl + '/', ''), var url = this.href.replace(rootUrl + '/', ''),
currentTime = (new Date()).getTime(); currentTime = (new Date()).getTime();
if (!ajaxify.preloader[url] || currentTime - ajaxify.preloader[url].lastFetched > PRELOADER_RATE_LIMIT) { if (!ajaxify.preloader[url] || (!ajaxify.preloader[url].loading && currentTime - ajaxify.preloader[url].lastFetched > PRELOADER_RATE_LIMIT)) {
ajaxify.preloader[url] = null; ajaxify.preloader[url] = {
loading: true
};
ajaxify.loadData(url, function(err, data) { ajaxify.loadData(url, function(err, data) {
ajaxify.preloader[url] = err ? null : { ajaxify.preloader[url] = err ? null : {
url: url, url: url,
data: data, data: data,
lastFetched: currentTime lastFetched: currentTime,
loading: false
}; };
}); });
} }

@ -147,7 +147,6 @@
}; };
translator.load = function (language, filename, callback) { translator.load = function (language, filename, callback) {
if (isLanguageFileLoaded(language, filename)) { if (isLanguageFileLoaded(language, filename)) {
if (callback) { if (callback) {
callback(languages[language].loaded[filename]); callback(languages[language].loaded[filename]);

Loading…
Cancel
Save