|
|
|
@ -7,19 +7,9 @@ ajaxify = window.ajaxify || {};
|
|
|
|
|
var apiXHR = null;
|
|
|
|
|
var ajaxifyTimer;
|
|
|
|
|
|
|
|
|
|
var translator;
|
|
|
|
|
var Benchpress;
|
|
|
|
|
var retry = true;
|
|
|
|
|
var previousBodyClass = '';
|
|
|
|
|
|
|
|
|
|
// Dumb hack to fool ajaxify into thinking translator is still a global
|
|
|
|
|
// When ajaxify is migrated to a require.js module, then this can be merged into the "define" call
|
|
|
|
|
require(['translator', 'benchpress'], function (_translator, _Benchpress) {
|
|
|
|
|
translator = _translator;
|
|
|
|
|
translator.translate('[[error:no-connection]]');
|
|
|
|
|
Benchpress = _Benchpress;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
ajaxify.count = 0;
|
|
|
|
|
ajaxify.currentPage = null;
|
|
|
|
|
|
|
|
|
@ -170,26 +160,27 @@ ajaxify = window.ajaxify || {};
|
|
|
|
|
|
|
|
|
|
function renderTemplate(url, tpl_url, data, callback) {
|
|
|
|
|
$(window).trigger('action:ajaxify.loadingTemplates', {});
|
|
|
|
|
require(['translator', 'benchpress'], function (translator, Benchpress) {
|
|
|
|
|
Benchpress.render(tpl_url, data)
|
|
|
|
|
.then(rendered => translator.translate(rendered))
|
|
|
|
|
.then(function (translated) {
|
|
|
|
|
translated = translator.unescape(translated);
|
|
|
|
|
$('body').removeClass(previousBodyClass).addClass(data.bodyClass);
|
|
|
|
|
$('#content').html(translated);
|
|
|
|
|
|
|
|
|
|
ajaxify.end(url, tpl_url);
|
|
|
|
|
|
|
|
|
|
if (typeof callback === 'function') {
|
|
|
|
|
callback();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Benchpress.render(tpl_url, data)
|
|
|
|
|
.then(rendered => translator.translate(rendered))
|
|
|
|
|
.then(function (translated) {
|
|
|
|
|
translated = translator.unescape(translated);
|
|
|
|
|
$('body').removeClass(previousBodyClass).addClass(data.bodyClass);
|
|
|
|
|
$('#content').html(translated);
|
|
|
|
|
|
|
|
|
|
ajaxify.end(url, tpl_url);
|
|
|
|
|
|
|
|
|
|
if (typeof callback === 'function') {
|
|
|
|
|
callback();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$('#content, #footer').removeClass('ajaxifying');
|
|
|
|
|
$('#content, #footer').removeClass('ajaxifying');
|
|
|
|
|
|
|
|
|
|
// Only executed on ajaxify. Otherwise these'd be in ajaxify.end()
|
|
|
|
|
updateTitle(data.title);
|
|
|
|
|
updateTags();
|
|
|
|
|
});
|
|
|
|
|
// Only executed on ajaxify. Otherwise these'd be in ajaxify.end()
|
|
|
|
|
updateTitle(data.title);
|
|
|
|
|
updateTags();
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function updateTitle(title) {
|
|
|
|
|